A template repository for Python development
-
Install
pyenv
:curl https://pyenv.run | bash
Then install a Python interpreter in
pyenv
:pyenv install 3.12 pyenv global 3.12
To allow multi-version testing, install multiple versions, e.g.:
pyenv install 3.12 3.11 3.10 pyenv global 3.12 3.11 3.10
-
Install the development dependencies:
pip install -r requirements-dev.txt
-
Install the pre-commit hooks:
pre-commit install
-
If your IDE or editor doesn't do it for you, create virtual environment:
python -m venv venv
Then activate it (do this every time you work on the project):
. venv/bin/activate
After you're done, deactivate the virtual environment:
deactivate
-
Change
pyproject.toml
to match your needs (in particular project name, description, keywords, authors, and maintainers). -
Change the
multiplier
directory to your project name, write your project code, your tests, and your example scripts. -
Install your package locally:
pip install -e .
-
After programming, put all packages you used into the
requirements.txt
file:pip freeze > requirements.txt
Then remove the local package from the file (line starts with
-e
). -
Test your code:
tox
-
Add all new files via
git add
. -
Do a dry-run of all pre-commit checks:
pre-commit run --all-files
-
Commit and push your code, then check result of GitHub actions.