To set up the development environment on a local machine, follow the steps described below.
- OS: tested on
Ubuntu
andMacOS
, but recommendUbuntu 20.04.4 LTS
- Database: tested on
Postgres 12
- Follow the installation guide
- Check venv path of poetry by running
poetry env info
Virtualenv
Python: 3.8.10
Implementation: CPython
Path: /home/koelkast/.cache/pypoetry/virtualenvs/python-api-example-R7RR5aY2-py3.8
Valid: True
System
Platform: linux
OS: posix
Python: /usr
- Copy the venv path from the above output (e.g.
~/.cache/pypoetry/virtualenvs/python-api-example-R7RR5aY2-py3.8
) - Paste it to the Python interpreter path at your IDE
- (Optionally) restart the terminal in your IDE
- Finally, install dependencies by running
poetry install
All set! just run the following command from the root folder of the project.
uvicorn src.main:app --reload
And..
Call the API running locally on: http://127.0.0.1:8000
Please follow these two steps before commiting any new changes.
- This project uses Black for code formatting.
- Before committing any change, run
black ./
- This project uses pytest for unit tests & integration test.
- Run
pytest
(this will run all tests in the project)- Tests for the DB-access module depend on the testdb setup
- Therefore, please ensure
Postgres
is installed & running locally before running tests