Releasing Karni¶
This page is for maintainers. Users, see the stability promise and the migration notes (0.5, 0.4, 0.3, 0.2, 1.0).
Lockstep versions¶
One tag publishes every package at the same version:
| Package | Registry | Directory |
|---|---|---|
karni |
PyPI | packages/karni |
karni-cli |
PyPI | packages/karni-cli |
karni-payments |
PyPI | modules/karni-payments |
karni-approvals |
PyPI | modules/karni-approvals |
karni-impersonation |
PyPI | modules/karni-impersonation |
karni-site |
PyPI | modules/karni-site |
karni-charts |
PyPI | modules/karni-charts |
karni-reports |
PyPI | modules/karni-reports |
karni-ai |
PyPI | modules/karni-ai |
karni-storage |
PyPI | modules/karni-storage |
karni-commerce |
PyPI | modules/karni-commerce |
karni-game |
PyPI | modules/karni-game |
@karni/ui |
npm | packages/karni-ui |
@karni/payments-ui |
npm | modules/karni-payments/ui |
@karni/approvals-ui |
npm | modules/karni-approvals/ui |
@karni/impersonation-ui |
npm | modules/karni-impersonation/ui |
@karni/charts-ui |
npm | modules/karni-charts/ui |
@karni/reports-ui |
npm | modules/karni-reports/ui |
@karni/ai-ui |
npm | modules/karni-ai/ui |
@karni/storage-ui |
npm | modules/karni-storage/ui |
@karni/commerce-ui |
npm | modules/karni-commerce/ui |
@karni/game |
npm | modules/karni-game/ui |
The table is PYTHON_PACKAGES and NPM_PACKAGES in
.github/ci/check_release.py, the one list of what a tag publishes. A test
(packages/karni-cli/tests/test_release.py) holds this page, the release
workflows and the release check to it. A new package goes into that list
first.
Lockstep keeps "which @karni/ui goes with karni 0.7?" from ever being a
question. A module's range on core (karni>=0.7,<0.8 and "@karni/ui":
"^0.7.0" in 0.7) moves with every minor release.
Cutting a release¶
- Changelog. If the release breaks or deprecates anything, its
packages/karni/karni/changelog/<version>.tomlanddocs/migrations/<major.minor>.mdexist and are complete. They are written in the pull requests that made the changes (CONTRIBUTING.md), not at release time. - Date the changelog. While a release is being built, the top section
of
CHANGELOG.mdreads## X.Y.Z (unreleased). In the release commit, replace(unreleased)with the release date:## X.Y.Z (YYYY-MM-DD).check_release.pyrefuses a tag whose section is not dated. A dry run on a branch, which has no tag, accepts it. After the release, the next change opens## X.Y.Z (unreleased)with the next version. - Versions. Set the new version in the manifest of every package in the
table: its
pyproject.tomlor itspackage.json(and its lockfile). A Python package's__version__reads its distribution's version, so it needs no edit. For a minor release, also move the module ranges on core. - Check locally:
make test lint typecheck PYTHON=.venv/bin/python
python .github/ci/check_release.py --tag vX.Y.Z --repo <owner>/karni
- Tag and push:
The tag runs .github/workflows/release.yml:
- mode: decides whether this run publishes, and to which registries. It
does only when the repository variable
KARNI_PUBLISHINGnames at least one registry and the ref is avX.Y.Ztag (a tag push, or "Run workflow" on the tag withdry_rununchecked). Everything else is a dry run, which the run's summary says up front. - ci: every CI gate, re-run on the tagged commit. That includes the
examples/eventhubbuild, seed, tests and end-to-end run. - check:
check_release.pyverifies that every package's version equals the tag, every Python package's__version__comes from its distribution, every repository URL is this repository (npm provenance is verified against it), every package's LICENSE equals the root LICENSE, the modules' ranges on core include the release, and every package is in every build and upload list of the release workflows, with PyPI upload steps that are all alike, andCHANGELOG.mdopens with the release's dated section. A dry run on a branch has no tag, so the version comes frompackages/karni/pyproject.tomland the section may still read(unreleased). - build-python: sdists and wheels for every Python package, then
twine check --strict, then the wheels installed into a clean venv wherekarni --helpandkarni explain E104must work. Uploaded as thepython-distartifact. - build-npm:
npm ci,npm run buildandnpm publish --dry-runfor every npm package (the full publish pipeline short of the upload, and it needs no credentials), thennpm pack. Uploaded asnpm-dist. - publish-pypi (when
KARNI_PUBLISHINGincludespypi): trusted publishing (OIDC, no stored token), with PEP 740 attestations as provenance. One upload per project, core first, withskip-existing. - publish-npm (when
KARNI_PUBLISHINGincludesnpm):npm publish --provenancethrough npm trusted publishing (OIDC, no stored token).@karni/uipublishes first, because the module UIs peer on it. When PyPI publishes too, this step runs after it, so npm is never ahead of the backend it talks to. - github-release (publishing runs only): a GitHub release with the Python distributions and npm tarballs attached, or those files replaced on a release that already exists.
- dry-run-summary (dry runs only): writes to the run summary what passed and which artifacts to inspect.
When a publishing run succeeds, .github/workflows/container.yml builds
ghcr.io/<owner>/karni (the karni command, from docker/karni/Dockerfile)
from the new version on PyPI. It waits for PyPI to serve the files, checks
that karni --version, karni new and karni explain work in the image, and
pushes it for linux/amd64 and linux/arm64, tagged X.Y.Z, X.Y and
latest. Run it by hand ("Run workflow", with a version) for a release
that is already on PyPI. The image shows under the repository's Packages.
After the first push, set the package's visibility to public once, in the
package's settings on GitHub. New packages start private.
Until KARNI_PUBLISHING is set, every tag push is a dry run: steps 1–5 and
9 run, the artifacts are there to download, and nothing reaches a registry.
That is the rehearsal for the first release
(launch registrations, steps 16–18).
A failure before step 6 publishes nothing. Fix it, delete the tag, and tag again. A failure after step 6 needs a new patch version, because PyPI never accepts the same version twice.
One-time repository setup¶
- PyPI: trusted publishing, no stored token. For each Python package in the table, while it does not exist yet, add a pending publisher under your PyPI account: Your account → Publishing → Add a new pending publisher → GitHub, with these values (the PyPI project name changes per project):
| Field | Value |
|---|---|
| PyPI Project Name | karni, karni-cli, karni-payments, karni-approvals, karni-impersonation, karni-site, karni-charts, karni-reports, karni-ai, karni-storage, karni-commerce, karni-game (one publisher each) |
| Owner | cbsshekhawat18-lab |
| Repository name | karni |
| Workflow name | release.yml |
| Environment name | pypi |
The first successful upload turns each pending publisher into a normal one.
A pending publisher only reserves the name until someone else registers
it, so publish soon after adding them. The workflow uploads one project at
a time, core first, with skip-existing: a missing publisher stops the
job before the next project, and a re-run after adding it is safe.
- PyPI with a token instead: a PYPI_API_TOKEN repository secret, when
set, is used in place of trusted publishing (attestations are then off).
.github/workflows/pypi-from-release.yml ("Run workflow" with a tag)
uploads an existing GitHub release's Python files to PyPI the same way, for
a release whose PyPI step never ran or failed part-way.
- npm: for each npm package in the table, add a trusted publisher: this
repository, workflow release.yml, environment npm. The @karni scope
must exist and belong to the maintainers.
- npm with a token instead: an NPM_TOKEN repository secret (an npm
automation token, or a granular token that may publish the @karni
packages), when set, is used in place of trusted publishing. Provenance
still comes from the job's OIDC token. Store it without pasting it
anywhere else: gh secret set NPM_TOKEN and paste at the prompt.
- KARNI_PUBLISHING (Settings → Secrets and variables → Actions →
Variables): the registries that are set up, pypi, npm, pypi,npm, or
true for both. Unset, every run is a dry run. A registry is switched on
only once its publishers exist, so PyPI can go live before npm.
- GitHub environments pypi and npm: add required reviewers, so a
publish waits for a human.
- Private vulnerability reporting: enable it under Settings → Security
(Security points reporters there).
- Repository profile (Settings → General, or gh repo edit): the
description, the website (https://cbsshekhawat18-lab.github.io/karni/)
and the 17 topics chosen in findability research. Under
Social preview, upload assets/brand/social-1280x640.png (1280×640).
gh repo edit cbsshekhawat18-lab/karni \
--description "Build full-stack Django + React apps from your models. Karni gives you the REST API, admin, role-based permissions, React screens and tests, kept in an upgradable package instead of a Django React boilerplate you copy. AI coding agents write only the domain code." \
--homepage https://cbsshekhawat18-lab.github.io/karni/
# the 17 topics: docs/seo-research.md
- GitHub Pages: source GitHub Actions (the docs workflow deploys the
site). Turn on Dependabot and code scanning alerts (
.github/dependabot.ymlandsecurity.ymlare in the repository).