Simple template for python project
- Change project folder name from 'app_name' to your project slug.
- Find and replace all occurrences of 'app_name' to your project slug and 'app-name' to project name.
- Open
pyproject.toml
and update information about the project like authors, description etc.
Copy env file
cp -n .env.example .env
Create new venv
python3 -m venv ./venv
Activate venv
. ./venv/bin/activate
Install needed requirements
pip install -r requirements/dev.txt
Run unit tests
pytest .
Run unit tests and check coverage
coverage run -m pytest .
coverage report -m
Run linter
ruff check --fix
Run formatter
ruf format
If you need to package your project you can use hatch.
Install hatchling
pip install hatchling==1.25.0
Build a package
hatch build
Publish (you need to define repository and credentials)
hatch publish
Build image
docker build . --tag app-image
Create container and run it
docker run app-image