Library of re-usable utilities for python web apps .
Before getting started, ensure that Python 3.12 is installed on your computer.
MongoDB is a document-oriented database that use JSON-like documents to store data. You will need to install MongoDB 6.0 locally or sign up for a free hosted one with MongoDB Atlas. Once you install MongoDB, make sure to create a database.
Clone the repo and open a terminal at the root of the cloned repo.
- Setup a virtual env. Only do this on your first run.
python3.12 -m venv .venv
- Activate the virtualenv
source .venv/bin/activate
- Install all dependencies:
pip install -r requirements-dev.txt
- Set up pre-commit
pre-commit install
Allow pre-commit custom hooks execution
git update-index --chmod=+x scripts/*
- Init environment variables. Duplicate the env template file:
cp ./.env.tpl ./.env
Open .env
file with a text editor and update the env vars as needed.
Note that some env vars need to be update manually, so make sure
to follow the instructions in the .env
file.
Keep in mind that those are automated formatting assistant tools. They will not always give the best result, as they just apply rules blindly. As a developer you still have the responsibility to ensure that the code is formatted with perfection.
- Use black to format the code From the project root run:
black .
- Use isort to sort the import From the project root run:
isort .
Linters are useful to ensure that your code quality matches with standards.
- Running pre-commit on the project to run all linters.
pre-commit run --all-files
- Use pylint to check for common mistakes. From the project root, run:
pylint AppMain sap tests
- Use mypy to check for typing issues. From the project root, run:
mypy .
- Use mypy to check for documentation issues. From the project root, run:
pydocstyle .
Tests are run using the pytest library.. From the project root, run:
pytest