Skip to content

thousandbrainsproject/tbp.python_library

Repository files navigation

Python library template

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:

Use this template

Make it yours

After copying the template, you need to address the following TODOs.

pyproject.toml

  • Update the project description
  • Update the project name
  • Confirm desired Python version in requires-python
  • Update the Repository and Issues URLs

Delete template images

  • Delete delete_me.png
  • Delete delete_me_too.png

README.md

  • Update for your project

Recommendations

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.

Pull Request Settings

Development

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.

Install uv

On a Mac, brew install uv is sufficient. For additional options, see the uv installation instructions.

Install dependencies

uv sync

Run formatter

uv run ruff format

Run style checks

uv run ruff check

Run dependency checks

uv run deptry src tests

Run static type checks

uv run mypy

Run tests

uv run pytest

Build package

uv build

About

TBP Python library template repository

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages