- run
$ docker compose up
🏗- after docker compose finishes and runs up containers, go to http://localhost:8000/
- enjoy the app ✨ (if there are some problems - see troubleshoots 🔥🚒 section of this readme file)
- run
$ docker compose exec backend bash
- run
$ source /venv/bin/activate
to activate virtual environment- run
$ cd app/
- run
$ ./scripts/tests.sh
to run tests.- run
$ ./scripts/pylint.sh
to run pylinter.- run
$ ./scripts/mypy
to run mypy.
Installing mamba:
- Follow official installation guide https://mamba.readthedocs.io/en/latest/installation.html
Running using mamba:
- using mamba install conda-lock package, running
$ mamba install conda-lock
- in the project root run
$ ./scripts/create_or_update_env.sh
to create LSD-server environment to run the application- run
$ mamba activate LSD-server
to activate new installed environment- run
$ docker compose up db
to run postgresql database- run
$ cd app/app/
and then$ python -m main
to start application- go to http://localhost:8000/ and enjoy the app ✨
- run
$ cd ../
and then$ ./scripts/tests.sh -c
to run tests with coverage.- run
$ ./scripts/pylint.sh
to run pylinter.- run
$ ./scripts/mypy.sh
to run mypy.
Installing conda:
- Follow official installation guide https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html
- It is recommended to install Miniconda, because it will take less disk space.
Running using conda:
- using conda install conda-lock package, running
$ conda install conda-lock
- in the project root run
$ ./scripts/create_or_update_env.sh
to create LSD-server environment to run the application- run
$ conda activate LSD-server
to activate new installed environment- run
$ docker compose up db
to run postgresql database- run
$ cd app/app/
and then$ python -m main
to start application- go to http://localhost:8000/ and enjoy the app ✨
- run
$ cd ../
and then$ ./scripts/tests.sh -c
to run tests with coverage.- run
$ ./scripts/pylint.sh
to run pylinter.- run
$ ./scripts/mypy.sh
to run mypy.
We use pylint to check quality of our code. There is a script to run pylint on the whole codebase. To run it just run the script:
$ ./scripts/pylint.sh
There can be situation where pylint is wrong, but we can avoid it by using comments for pylint, which tell it to disable warning.
# some code without warnings ...
# here we want to disable warning with the name no-self-argument:
# pylint: disable=no-self-argument
# reason: pydantic validator doesn't work with self argument.
# some code which causes the warning...
# pylint: enable=no-self-argument
# some code without warnings ...
Also we have the .pylintrc
file, which stores global settings for pylinter, for example good names:
# Good variable names which should always be accepted
# Pylinter will not give warnings to these short names
good-names=i, j, df, db
- FastAPI documentation.
- Make sure you run commands from appropriate directory. If you run scripts, run them in the directory where the scripts/ directory lies, not inside the scripts/ directory.
- If you have problems with conda, try to run
$ ./scripts/set_up_conda_channels.sh
in the project root to add conda-forge channel to conda. Then try to create conda environment again. - If you have problems with docker compose, be sure you run newer
docker compose
tool instead of olderdocker-compose