Copier template for Python libraries in the bedrock-python organization.
# Install copier
pip install copier
# Create a new library
copier copy gh:bedrock-python/python-library-template my-new-lib
cd my-new-libCopier will prompt for:
| Variable | Description | Example |
|---|---|---|
project_name |
Display name | my-library |
project_slug |
PyPI package name (kebab-case) | my-library |
package_name |
Python import name (snake_case) | my_library |
project_description |
One-line description | A great library |
author_name |
Author full name | Alex Shalaev |
author_email |
Author email | you@example.com |
github_org |
GitHub org or username | bedrock-python |
python_min_version |
Minimum Python version, 3.10 to 3.14. The unit-test matrix and the classifiers run from it to the newest version (python_max_version in copier.yml) |
3.11 |
initial_version |
Initial version | 0.0.0 |
# Install dependencies
uv sync --group dev
# Install pre-commit hooks
uv run pre-commit install --hook-type commit-msg
# Verify everything works
make checkThen:
- Create a GitHub repo:
gh repo create bedrock-python/my-library --public - Configure repo (after the first CI pass), from a checkout of this template
repository — the script lives here, not in the library:
Idempotent. Sets the org standard: a
python scripts/setup_repo.py bedrock-python/my-library
pypienvironment onlymastermay deploy to, thegithub-pagesenvironment and Pages, read-only workflow tokens, squash/merge-commit only with branches deleted on merge, secret scanning + push protection + Dependabot security updates + private vulnerability reporting, topics frompyprojectkeywords, and amasterruleset (pull requests only, no force-push or deletion, "All checks passed" required). - Push (
⚠️ noCo-Authored-By:in commits!):git init && git add . && git commit -m "feat: initial release" && git push -u origin master
- Set up PyPI Trusted Publisher at pypi.org/manage/account/publishing/
- Add
CODECOV_TOKENsecret in repo Settings → Secrets → Actions
A render records its answers and the template commit it came from in
.copier-answers.yml. Commit that file and leave it to Copier. To bring a library up to
the template's master, from the library's clean working tree:
uvx --with jinja2-time copier update --trust --defaultsCopier applies what changed in the template since the recorded commit as a three-way
merge with the library's own edits, leaves conflicts as inline markers, and moves
_commit forward. A file the library deleted, such as the checklist, stays deleted.
A library rendered before the answers file existed needs one written by hand first: the
answers it was rendered with, _src_path: gh:bedrock-python/python-library-template,
and as _commit the template commit it was rendered from, or the closest one.
Release Please opens and updates its release PR with a token of an org-owned GitHub App.
With the workflow's own GITHUB_TOKEN, the PR's CI run is held and never starts, the
required "All checks passed" never reports, and the PR can only be merged after someone
closes and reopens it. One App serves every library and is set up once:
- Create a GitHub App owned by the org (org Settings → Developer settings → GitHub Apps): webhook off, repository permissions Contents: Read and write and Pull requests: Read and write, installable on this account only.
- Install it on the org, for all repositories.
- In org Settings → Secrets and variables → Actions, visible to all repositories:
variable
RELEASE_PLEASE_APP_CLIENT_ID= the App's Client ID, secretRELEASE_PLEASE_APP_PRIVATE_KEY= a private key generated for it.
Release PRs, tags and GitHub Releases are then authored by the App's bot account. While
the variable is unset, the workflow falls back to GITHUB_TOKEN and its run carries a
warning, and setup_repo.py warns for any repository that cannot see the two names.
See .claude/LIBRARY_CREATION.md for important rules:
- Never add AI agents as co-authors in commits
- Run
scripts/setup_repo.pyfrom this repository; a render contains neither it nor.claude/LIBRARY_CREATION.md - Start with version
0.0.0(Release Please creates0.1.0)
pyproject.toml— uv + hatchling + ruff + mypy + pytestMakefile— fmt, check, test-unit, test-integration, test, build, docs-serve, docs-build.github/workflows/— CI (lint + unit + integration), publish to PyPI, deploy docs, Release Please.github/— dependabot, issue templates, PR templatedocs/— zensical (MkDocs Material) setup with mkdocstrings, a Copy page control that hands any page to an LLM as Markdown, anddocs/agents.md, the one-page brief for coding assistants (ships as a skeleton — fill it in).pre-commit-config.yaml— ruff, mypy, conventional commitsrelease-please-config.json— automated semver + CHANGELOG generation