Template for a Python project. Check the project's documentation here.
To run the project, it is necessary the following tools:
- Python 3.7 or higher
It can also be run with
Or
Choose one of the next sections to setup your development environment.
To create a virtual environment, run
virtualenv .venv
To activate the virtual environment, run
source .venv/bin/activate
To install the template's development requirements in the virtual environment, run
pip install -r requirements/dev.txt
pip install -e .
To deactivate the virtual environment, run deactivate
.
Run the commands of the following sections with the virtual environment active.
To install project dependencies and create a virtual environment, run
poetry install
To activate the virtual environment, run
poetry shell
To deactivate the virtual environment, run CTRL+D
or exit
.
Run the commands of the following sections with the virtual environment active.
To connect to Container's shell, run
./scripts/docky.py run
To exit the container's shell, run CTRL+D
or exit
.
To run Dockerfile linter, run
./scripts/docky.py lint
To scan Docker Image, run
./scripts/docky.py scan
To remove the project's Containers, Networks, Images and Volumes, run
./scripts/docky.py down
To get script help, run
./scripts/docky.py
./scripts/docky.py <command> --help
To change Container configuration, change the variables in .env
file.
Run the commands of the following sections in the Container.
To update requirements files, run
dev requirements
The quality metrics of the project are reproduced by the continuos integration (CI) pipeline of the project. CI configuration in .github/workflows/ci.yml
file.
To run tests and coverage report, run
pytest
To see the html report, check tests/coverage-results/htmlcov/index.html
.
Tests and coverage configuration in pyproject.toml
file, at [tool.pytest.ini_options]
section.
To run Python type checker, run
mypy .
Python type checker configuration in pyproject.toml
file, at [tool.mypy]
section.
To run Python linter, run
dev lint
Python linter configuration in .prospector.yaml
and tests/.prospector.yaml
files.
To run Shell script linter, run
dev lint --shell
To check Python code format, run
dev format --check
To format Python code, run
dev format
Python code formatters configuration in pyproject.toml
file, at [tool.black]
and [tool.isort]
sections.
To check all repository's files format, run
ec -verbose
File format configuration in .editorconfig
file.
To check common security issues in Python code, run
dev scan --code
To check known security vulnerabilities in Python dependencies, run
dev scan --dependencies
To check Python documentation generation, run
dev doc --check
To generate Python documentation, run
dev doc
To see the documentation , check public/index.html
.
Python documentation generator configuration in docs/conf.py
file.
The documentation is updated automatically by the continuous deploy (CD) pipeline of the project. CD configuration in .github/workflows/cd.yml
file.
To configure pre-commit automatically when cloning this repo, run
git config --global init.templateDir ~/.git-template
pre-commit init-templatedir --hook-type commit-msg --hook-type pre-commit ~/.git-template
pre-commit must be installed globally.
To configure pre-commit locally, run
pre-commit install --hook-type commit-msg --hook-type pre-commit
To test it, run
pre-commit run --all-files
pre-commit configuration in .pre-commit-config.yaml
file.
This repository is licensed under the terms of MIT License.