Overview¶
A minimal working example of a packaged Python project built with uv.
Key integrations include:
| Component | Tool |
|---|---|
| Dev Environment Manager | mise |
| Build System | uv |
| Test Framework | pytest |
| Multi-Environment Testing | tox |
| Documentation as Code | zensical |
| Git Hooks | prek |
| Local Automation | task |
| CI/CD | GitHub Actions |
This document explains how to use and extend this template.
Tip
The automated website for this repository is generated directly from source code and docstrings.
Getting Started¶
%%{init: {"flowchart": {"htmlLabels": false}} }%%
flowchart TD
create-a-repository["`Create a repository`"]
--> installation["Installation"]
--> package-setup["`Package setup`"]
--> ci-setup["`CI setup`"]
--> add-code["`Add code`"]
click create-a-repository href "#create-a-repository"
click installation href "#installation"
click package-setup href "#package-setup"
click ci-setup href "#ci-setup"
click add-code href "#add-code"
Create a Repository¶
- Generate a new repository from this template.
- Rename the package directory from
jambazid/demoto${namespace}/${component}.${namespace}typically represents your GitHub username or organization (uselower_snake_case).${component}is the name of your specific project or package.- See the Namespace guide for more details.
Installation¶
Important
A Unix-like environment (e.g., Linux or macOS) is recommended for development.
Install mise:
Navigate to the project root directory and run:
Package Setup¶
- Update the project
README. - Update
pyproject.toml:- Adjust author and contact details.
- Add or remove dependencies.
- Configure environment variables for testing.
- Run
task checkto validate the configuration.
- Update the package
README.
CI Setup¶
Configure the following parameters in release.yaml.
- Parameters:
python-versioninit-script(for custom setup steps)
- PyPI publishing (optional):
- Set
create-release: true. - Create a deployment environment named
releasein GitHub Actions:- Add a
TEST_PYPI_API_TOKENenvironment variable containing yourtest.pypi.orgAPI token. - Add a
PYPI_API_TOKENenvironment variable containing yourupload.pypi.orgAPI token.
- Add a
- Set
Tip
Support for publishing packages to private registries is planned.
OIDC authentication support for PyPI will be integrated after the resolution of this issue.
See the release workflow documentation for more information.
Add Code¶
- Develop your project under the
python/srcdirectory.- Ensure your code replaces the placeholder
${namespace}/${component}structure. - Update test cases in
python/teststo target the new${namespace}/${component}package.
- Ensure your code replaces the placeholder
- Run
task updateto synchronize dependencies. - Run
task testto execute the test suite.