Template for python project structure (with annotations).
- Uses
pyproject.toml
as project specification file per PEP 518, PEP 517, PEP 621, and PEP 660. - Uses Poetry as build tools to manage package dependencies.
- Uses Just for project-specific commands (e.g. for testing and linting tools, documentation generation).
Install Poetry to manage python virtual environments and package dependencies. More information can be read from Poetry documentation.
If the required version of Python is not installed on the local development machine,
we recommend using pyenv
to manage multiple installations of Python on the machine.
First, following these instructions to install pyenv
.
For Linux distributions, we recommend the automatic installer options.
Make sure to follow the instructions closely and add pyenv
bin directories to $PATH
.
Once installed, we can install the desired version of Python (we assume version 3.12.0
here):
$ pyenv install 3.12.0
- If
pyenv
command is not present, perhaps restart the terminal or machine first. - If there are other problems while installing, consult the troubleshooting page.
Use Poetry to create virtual environments and install dependencies:
$ poetry install --with dev
Install Just to be able to run project-specific commands. Once installed, you can see the list of commands by running:
$ just
Also, do not forget to run post-installation scripts:
$ just post-install
Before committing changes in Git Repository, please run through the following checklist:
- Run
just check
to test for code quality (such asruff
code lint,mypy
type checking,pytest
unit tests, etc.) Fix any complaints until there is no error message. - Run
just format
to format the code withruff
code formatter. - Run
git status
to see the status of file changes. Verify with your eye that it is what is expected.