ryansurf / cli-surf

Get surf and ocean data from the command line interface
7 stars 10 forks source link

Refactor directory structure and unify frontend and backend #21

Closed K-dash closed 2 months ago

K-dash commented 2 months ago

@ryansurf This PR addresses the directory structure changes discussed in https://github.com/ryansurf/cli-surf/pull/19#issue-2319916494.

The modifications turned out to be more extensive than initially anticipated. Please refer to the commit messages for the specific changes made. https://github.com/ryansurf/cli-surf/commit/65ea49e666283ce31a89e0b3f858069ffdf5b92f https://github.com/ryansurf/cli-surf/commit/e7acc8fdaed62c5b99673a48395cdec83a3dfad5 https://github.com/ryansurf/cli-surf/commit/136f2e07f7ca82ab0e79991115e8530a7ad6f637 https://github.com/ryansurf/cli-surf/commit/60001d6556e45cd28bdc8781074e9b5de7ea31fe

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 to cli.py.

The reason for changing main.py to cli.py was to resolve the naming conflict between the module name and the function name when importing the main function in test_code.py. Initially, the main.py file contained a function named main. In the test_code.py file, the main function was imported using from 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:

  1. The main.py file was renamed to cli.py. This avoids the naming conflict between the module and the function.
  2. The main function within cli.py was renamed to run. This allows test_code.py to import the run function using from 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 to cli.py provides a clearer indication of the file's role and purpose within the project.

Fixes #20