Group project for NTU MSFT, MH6803 course, Python Programming
- Python 3.7+
- Choose either:
- Poetry (https://poetry.eustace.io/)
- if you're on Mac, follow this instruction: https://python-poetry.org/docs/#osx--linux--bashonwindows-install-instructions
- if you're on Windows, then this https://python-poetry.org/docs/#windows-powershell-install-instructions
- or Venv:
- run
python -m venv mh6803_python_programming - then
source mh6803_python_programming/bin/activate - then
pip install -r requirements.txt
- run
- Poetry (https://poetry.eustace.io/)
(Only if you want to see the web app)
- Node.js 18.2.0+ (maybe older versions would work too, but we haven't tested)
- Run
npm installin thefrontenddirectory
- Clone the repository
- File structure:
- in the
/backenddirectory, there are the Python files- Run
poetry installto install the dependencies cli.pyis the entry point for the CLIsource/contains the source code, wheremain.pycontains most of the functionstests/contains the testsnotebooks/contains the notebooks- Worth mentioning:
requirements.txtcontains the requirementspyproject.tomlcontains the project configurationREADME.md(this file!) contains the instructions
- Run
- in the
/frontenddirectory, there are TypeScript files- Run
npm installto install the dependencies src/contains the source codecomponents/contains the React componentspages/contains the pages (which use the components)public/contains the static files- Worth mentioning:
package.jsoncontains the project configurationtsconfig.jsoncontains the TypeScript configurationREADME.mdcontains the instructions (as default from NextJS)
package.jsoncontains the project configurationtsconfig.jsoncontains the TypeScript configuration
- Run
- in the
From the /backend directory:
- Run
poetry run pytest - Video: https://www.loom.com/share/6a002dc823754e5686e6a243a9c3d8ba
Method 1: Wizard
- Run
poetry run python cli.pyto go through the CLI wizard - Video: https://www.loom.com/share/31f910f24b6645f2b3e73ed7a977bf86
Method 2: Functions
- Run
poetry run python source/main.py <command>to test each component of the wizard- Example 1:
poetry run python source/main.py get_price bitcoin 1656604800 1659283200 - Example 2:
poetry run python source/main.py get_coin_description solana
- Example 1:
- Run
poetry run python gui.pyto see the GUI - Click through buttons to enter your choices as guided by the wizard!
- View the background processes in the terminal for debugging if needed.
- From the
/backenddirectory, runpoetry run python web.pyto see get FastAPI server running- The server will be running on
http://localhost:8000 - You can check the API documentation at
http://localhost:8000/docs - You can do health-check at
http://localhost:8000/health
- The server will be running on
- Then, from the
/frontenddirectory, runnpm run devto see the frontend running- The frontend will be running on
http://localhost:3000 - You can check the frontend at
http://localhost:3000 - There are two routes available:
/- the home page/retire- the price chart & retirement calculator page
- The frontend will be running on
- Video: https://www.loom.com/share/e6e4781c783644abb02901d29e943623
From the /backend directory:
- Run
poetry run jupyter notebookorpoetry run jupyter lab(whichever you prefer) - Open
notebooks/explore.ipynband play around!