Template Checklist
- Create a repository using this template.
- Rename module
src/python_package_template->src/your_package_name - Rename tests module
tests/python_package_template->tests/your_package_name - Update
pyproject.toml:[project]section based on your package name, versioning, and metadata. - Update
README.mdreferences ofpython-package-template->your-package-name - Configure PyPI trusted publishing for the repository.
- Publish your package to PyPI by creating a release.
- Remove this section
Table of Contents
Introduction
This template repository aims to streamline the creation, testing, and publishing of isolated Python packages.
Quick Start
Since this is just a package, and not a service, there is no real "run" action. But you can run the tests immediately.
Here are a list of available commands via make.
Bare Metal (i.e. your machine)
make install- install the required dependencies.make test- runs the tests.
Installation
For Dev work on the repo
Install uv, (if you haven't already)
https://docs.astral.sh/uv/getting-started/installation/#installation-methods
brew install uv
Initialise pre-commit (validates ruff on commit.)
uv run pre-commit install
Install dependencies (including dev dependencies)
uv sync
If you are adding a new dev dependency, please run:
uv add --dev {your-new-package}
Package module
Import this package into your project:
from python_package_template.placeholder import placeholder_func
Usage
Adding the dependency to your project
The library is available on PyPI. You can install it using the following command:
Using pip:
pip install python-package-template
Using UV
Add the dependency:
uv add python-package-template
Using poetry:
poetry add python-package-template
How tos
Example Usage
# Please update this based on your package!
from python_package_template.placeholder import placeholder_func
if __name__ == "__main__":
print("This is a placeholder: ", placeholder_func())
Formatting and linting
We use Ruff as the formatter and linter. The pre-commit has hooks which runs checking and applies linting automatically. The CI validates the linting, ensuring main is always looking clean.
You can manually use these commands too:
make lint- check for linting issues.make format- fix linting issues.
CICD
Publishing to PyPI
We publish to PyPI using GitHub releases and PyPI trusted publishing. Steps are as follows:
- Manually update the version in
pyproject.tomlfile using a PR and merge to main. Useuv version --bump {patch/minor/major}to update the version. - Create a new release in GitHub with the tag name as the version number. This will trigger the
publishworkflow. In the Release window, type in the version number and it will prompt to create a new tag. - Verify the release on PyPI.
Credits
This template repository has taken inspiration from the following repositories.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlalchemy_persisted_hybrid_property-1.0.0.tar.gz.
File metadata
- Download URL: sqlalchemy_persisted_hybrid_property-1.0.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1eb8a939ded97040c288b0aa12cc78c19b046cf1036553fc126d0f04538ff3f
|
|
| MD5 |
74ae4e9e6253d5bdcee442e22761b1ad
|
|
| BLAKE2b-256 |
1739f0da885aab9be34a8e108e9a3d56bbf769a85f73926067453a2f4944a42e
|
File details
Details for the file sqlalchemy_persisted_hybrid_property-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sqlalchemy_persisted_hybrid_property-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
033a8f1599e8d435b3459f4c6a0c6604a9f333b89e0df0172b9312496591c1c9
|
|
| MD5 |
088d3e8858b90d38e81e2ffcd446effb
|
|
| BLAKE2b-256 |
2383cb008493ad55a27a018733b2f5a40c6ac1095ac4928beec776999d325563
|