Skip to main content

bitranox_template_py_lib

CI CodeQL License: MIT Open in Codespaces PyPI PyPI - Downloads Code Style: Ruff codecov Maintainability security: bandit

A scaffold for backward-compatible (Python 3.10+) libraries that ship a registered CLI command, with a rich-click entry point, strict typing, and a full test-and-release pipeline already wired.

Why a template

Starting a new Python library feels like it should be about the library. It almost never is. The first day goes on the scaffolding nobody brags about: which linter, which type checker, how the version number stays in step across three files, how a tag becomes a PyPI release, which Python versions you have quietly promised to keep working. None of that is the thing you set out to build, and all of it has to be right before the thing you set out to build can ship.

The tax on that work is invisible, which is exactly why people underprice it. A blank directory looks free. It is not. It is a stack of small decisions you will make in a hurry, slightly wrong, and then copy by hand into the next project, where you will make them slightly wrong again. A blank page is not a fresh start so much as a bill you have agreed to pay later.

A template is the boring answer that settles the bill up front. You inherit a working set of defaults, tests green across five Python versions and three operating systems, strict typing, a lint/type/test/release pipeline behind a single make command, a CLI that already runs, so the only decisions left are the ones that are actually about your library. The point is not that these are the only good choices. The point is that they are already made and already wired together, so you get to disagree with one on purpose rather than rediscover all of them by accident.

So clone it, delete the parts you do not want, and spend day one on the problem you actually care about. That is the whole trick: make the sensible path the lazy one.

Quickstart

1. Start a new library from this template

The first thing you do is copy the template into a new directory named for your package, rename it to that package, and reset the git history to one fresh commit. The directory name drives the rename, so name it for your library first.

# copy the template into a new dir named for your package
git clone --depth 1 https://github.com/bitranox/bitranox_template_py_lib.git lib_wombat
cd lib_wombat
git remote remove origin      # detach from the template so nothing ever pushes back to it
git branch -m master main     # new repos use main, not master

# rename the project to your package (rename-project, run via uvx)
./rename_dry.sh               # preview: rename-project --dry-run. Confirm every detected
                              #   name and path reads "lib_wombat" before applying.
./rename.sh                   # apply: rename-project --yes. Takes NO argument - the new name
                              #   comes from the directory, so `./rename.sh lib_wombat` is wrong.

# squash the template history into a single fresh commit
./reset_git_history.sh        # with the remote removed above, this rewrites local history only

Now create your own empty GitHub repo, add it as origin, and push main. Removing the template remote first matters: reset_git_history.sh force-pushes to the first remote it finds, and right after a clone that would be the template itself.

See docs/development.md for the full develop-test-release flow (bmk).

2. Try the CLI and API

To see what you get, install the template's own package from PyPI (uv recommended, plain pip works too):

uv pip install bitranox_template_py_lib

Run the CLI:

bitranox_template_py_lib hello     # -> Hello World
bitranox_template_py_lib info      # print resolved package metadata
bitranox_template_py_lib --help

Or run it without installing:

uvx bitranox_template_py_lib hello
python -m bitranox_template_py_lib hello

Use it as a library:

import bitranox_template_py_lib as lib

lib.emit_greeting()  # writes "Hello World" to stdout
lib.print_info()  # print the package metadata block

See docs/usage.md for the full command and API reference.

Documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitranox_template_py_lib-2.0.1.tar.gz (56.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bitranox_template_py_lib-2.0.1-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file bitranox_template_py_lib-2.0.1.tar.gz.

File metadata

  • Download URL: bitranox_template_py_lib-2.0.1.tar.gz
  • Upload date:
  • Size: 56.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bitranox_template_py_lib-2.0.1.tar.gz
Algorithm Hash digest
SHA256 125c523baf0345c839e41cbcb288709bd42d2f34c9e78d0577682eaf38f5432e
MD5 92c5f7119fb0cd599ad2c875390c0f94
BLAKE2b-256 ce652ffea2f8cb5a2e095e99147407895a9abcf8136148344870226872ef3109

See more details on using hashes here.

File details

Details for the file bitranox_template_py_lib-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bitranox_template_py_lib-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b83bcc4f52903cdceb80c1b9f23d970071e685ca35265e6e5bf0b5fb4fcbede5
MD5 34d88459f6dedb58a2c9fa6869771685
BLAKE2b-256 7e498411135c8c401d0667804df5022d85245d886268753b2bd6310872ec9efe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page