-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructure the project layout and improving package usage #71
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the restructuring! Everything is a lot clearer now. The new structure of the code makes sense and helps to reduce the number of files.
I tested the code locally with the simple
game and it still works. There are only a few suggestions:
-
It would help a lot if you would update the
README
file on how to execute the project. It took a little bit to figure that out. -
The
hockeygame
and therock_paper_scissors
game don't work anymore. It would be best to make a new issue to update them. -
other changes below.
Yeah I forgot to mention how exactly to start the server, thought I already added it last week |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All requested changes are impementet and the code still works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed that the end
method in IGame
still uses dummy values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now are all requested changes implemented and the code works
Description
This PR resolves #62, due to this is a major change in the way the end-user interacts with our product it was not really possible to split this into smaller PR's.
The new structure of our project looks like this:
I restructured the project so that we have a module (in python this is a .py file) for every component of the packages (which are folders in python). Generally we can say
networking
modules contain all twisted related code,interfaces
contain interfaces needed for the abstraction between networking and logic, like managers.The networking also got completely separated from the rest of our code, for this I used interfaces which get passed to the corresponding twisted-networking implementation. Both the server and the client networking modules provide a global function which is capable of connecting a subclass from the given interface to the networking code. By this we don't need to worry about networking in the rest of our logic, also we don't even know what drives our code. So we could add tests for the non networking parts.
A major change also included redesigning the entry point of our server. We now have the app module in the server package which implements not only our server class, but also includes the main function. Previously the end user needed to start the server by creating a server object in custom python code, this got completely scrapped. The server now can be started via the command line with additional args or by providing a toml config file. The toml file causes the upgrade to python 3.11 due to the 'tomllib' gets introduced with it.
Update: I added support for python 3.10 as @luator suggested
(If you are wondering where the examples went, I moved the outside our package. You can find them in
/examples/
now.)