An example to help create and maintain a new Python project. Detailed documentation about the project structure lies in about page.
- Python >= 3.10
- Python venv
- Make 4 or higher
Use command make
. It will:
- Create or update the project virtual environment according to the dependencies declared in Python project descriptor.
- Build a wheel file in dist directory.
Once you have built the project, launch make test
.
- Build project:
make
- Activate pre-commit checks:
pre-commit install
- Push production code in
src/<my_package_name>
. - Push test code in
tests
directory.
If you require access to additional files from tests, you can push them in test resource directory. You can then access them like this:
from tests.resources import resources_dir as resources
resource_file = resources / "my-folder" / "my-file"
with open(resource_file, mode="r") as file_stream:
# process file
pass
WARNING: Beware of pushed file size ! Large files may bloat the git repository.
To execute pre-commit checks on the entire repository (i.e. check all source files, not only your local changes), use make check
.