-
Notifications
You must be signed in to change notification settings - Fork 30
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
Refactor directory structure and unify frontend and backend #21
Refactor directory structure and unify frontend and backend #21
Conversation
- Remove backend/frontend directories and move files under src - Rename frontend directory to static (convention for Flask) - Update import paths and references accordingly - Rename main.py to cli.py to avoid naming conflicts - Allow Flask app to accept requests from all network interfaces(0.0.0.0)
- Modify test directory structure to match the updated source directory - Update import paths and references in test files - Adjust pytest.yaml configuration to reflect the new directory structure
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.
Fantastic work. Reworking the structure was more tedious than I imagined, thanks for tackling it. Nice catch on the Docker container IP
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.
Looks like you cleaned up the code, very nice. Are you using Pylint?
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.
@ryansurf
I ran the code through the Black formatter.
By the way, since there is currently no linter implemented, how about using ruff? Ruff not only has a linter function but also a formatter function, so you can unify everything under ruff and eliminate Black :)
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.
Ah, forgot about the black formatter 😂
Two birds one stone! Sounds like a good plan to me, lets do it
@ryansurf
This PR addresses the directory structure changes discussed in #19 (comment).
The modifications turned out to be more extensive than initially anticipated. Please refer to the commit messages for the specific changes made.
65ea49e
e7acc8f
136f2e0
60001d6
I have also thoroughly verified that the application runs without issues using Docker and that the frontend functionality works as expected.
Once this PR is merged, I can start working on creating the unit test files!
Please review the changes and provide any feedback or suggestions.
Please feel free to ask if you have any questions or uncertainties.
Most significant change
The
main.py
file has been renamed tocli.py
.The reason for changing
main.py
tocli.py
was to resolve the naming conflict between the module name and the function name when importing themain
function intest_code.py
.Initially, the
main.py
file contained a function namedmain
. In thetest_code.py
file, the main function was imported usingfrom src.main import main
.However, this approach resulted in importing the main module instead of directly calling the main function. The error message
TypeError: 'module' object is not callable was encountered
.To resolve this issue, two changes were made:
main.py
file was renamed tocli.py
. This avoids the naming conflict between the module and the function.cli.py
was renamed torun
. This allowstest_code.py
to import therun
function usingfrom src.cli import run
.These changes resolved the naming conflict between the module and the function, enabling the test code to execute successfully.
Additionally, renaming
main.py
tocli.py
provides a clearer indication of the file's role and purpose within the project.Fixes #20