This is a Python library template. A library provides function and objects for other projects to consume. Libraries are intended to be built and distributed, e.g., by uploading them to PyPI.
For a Python package template, see https://github.com/thousandbrainsproject/tbp.python_package.
To create a repository from this template, find and click the "Use this template" button:
After copying the template, you need to address the following TODOs.
- Update the project
description
- Update the project
name
- Confirm desired Python version in
requires-python
- Update the
Repository
andIssues
URLs
- Delete
delete_me.png
- Delete
delete_me_too.png
- Update for your project
For a cleaner project commit history, go to your repository settings and in the Pull Requests section, only "Allow squash merging". It also helps to set your default commit message to the "Pull request title" option.
The development of this project is managed with uv, "a single tool to replace pip
, pip-tools
, pipx
, poetry
, pyenv
, twine
, virtualenv
, and more." You will need to install it.
We use uv
as it tracks the latest PEP standards while relying on existing infrastructure like pip
, venv
, etc.
uv.lock
is non-standard in Python, but as Python does not yet define a lockfile standard, any lockfile format is non-standard. The benefit of uv.lock
is that it is cross-platform and "captures the packages that would be installed across all possible Python markers such as operating system, architecture, and Python version". This makes it safe to check-in to the repository.
On a Mac, brew install uv
is sufficient. For additional options, see the uv installation instructions.
uv sync
uv run ruff format
uv run ruff check
uv run deptry src tests
uv run mypy
uv run pytest
uv build