Skip to content

fix: publish to PyPI as tetrak, with the right version and install name - #5

Merged
stephen-masters merged 3 commits into
mainfrom
ci/publish-to-pypi
Oct 4, 2026
Merged

stephen-masters merged 3 commits into
mainfrom
ci/publish-to-pypi

Conversation

@stephen-masters

Copy link
Copy Markdown
Contributor

Summary

  • Publish to PyPI. release.yml gains build and publish jobs, copied from the satellite packages. They build the sdist and wheel from the release tag, run twine check --strict and smoke-test the wheel, then upload through a Trusted Publisher in the pypi environment. No token is stored.
  • Fix __version__. It was a hard-coded 0.2.2 that nothing updated, so the 5.14.0 wheel reported the wrong version. It now comes from the _version.py that hatch-vcs generates, and the smoke test fails the release if it disagrees with the tag.
  • Use the real install name. Install docs, the README (which becomes the PyPI page) and the missing-extra error messages all said pip install tetrak-ocr. The distribution is tetrak, and we don't own tetrak-ocr on PyPI. The tetrak-ocr command name is unchanged.

The fix: commit cuts 5.14.1 on merge, and that is the first version published.

Before merging

Register a pending Trusted Publisher on PyPI (https://pypi.org/manage/account/publishing/):
project tetrak, owner scattercode, repository tetrak, workflow release.yml, environment pypi. The pypi environment already exists on this repo.

Test plan

  • A simulated 5.14.1 build passes twine check --strict; the wheel installs, imports, reports 5.14.1, and tetrak-ocr --help works
  • sdist contains only src/, licences and README — no corpus images
  • ruff, site lint, pytest (the only failures are three macOS Vision tests that fail the same way on main)

🤖 Generated with Claude Code

stephen-masters and others added 2 commits October 4, 2026 09:55
Build the sdist and wheel from the release tag, check the metadata,
smoke-test the wheel (including that __version__ matches the tag) and
upload through a Trusted Publisher in the pypi environment, as the
Armenian satellite packages already do. The SBOMs now name the
distribution tetrak rather than tetrak-ocr.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
__version__ was a literal 0.2.2 that nothing updated, so the 5.14.0
wheel misreported itself; it now comes from the hatch-vcs _version.py.

Every install instruction and missing-extra error said
`pip install tetrak-ocr`, but the distribution is tetrak. That name is
not ours on PyPI, so following the error message would have installed
nothing, or someone else's package. The command stays tetrak-ocr.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 4, 2026 08:57
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Deploying tetrak with  Cloudflare Pages  Cloudflare Pages

Latest commit: 69fd34e
Status: ✅  Deploy successful!
Preview URL: https://de3215ad.tetrak.pages.dev
Branch Preview URL: https://ci-publish-to-pypi.tetrak.pages.dev

View logs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Stale distribution-name documentation remains, and the build job unnecessarily inherits repository write access.

Review effort: Balanced
Findings: 1 Medium severity · 3 Low severity

Open (4)
What changed in this PR

Publishes the tetrak distribution to PyPI, derives runtime versions from release tags, and corrects installation guidance.

Changes:

  • Adds tagged package build, validation, smoke testing, and trusted publishing.
  • Replaces the hard-coded package version with hatch-vcs output.
  • Updates install names and SBOM metadata from tetrak-ocr to tetrak.
File Description
.github/​workflows/​release.yml Builds, validates, and publishes release artifacts.
CLAUDE.md Documents the PyPI release process.
README.md Updates installation commands.
pyproject.toml Clarifies distribution naming references.
site/​content/​_index.md Updates the homepage install command.
site/​content/​articles/​2026/​09/​2026-09-01-shipping-the-armenian-recogniser.md Updates the Armenian extra command.
site/​content/​install.md Updates package and extras installation guidance.
site/​content/​reference/​engines.md Updates backend installation commands.
src/​tetrak_ocr/​__init__.py Exposes the hatch-vcs-generated version.
src/​tetrak_ocr/​backends/​armenian.py Corrects the Armenian install name.
src/​tetrak_ocr/​backends/​paddle_vl.py Corrects Paddle-VL installation guidance.
src/​tetrak_ocr/​backends/​vision.py Corrects Vision installation guidance.
src/​tetrak_ocr/​errors.py Corrects missing-extra remediation.
src/​tetrak_ocr/​imaging.py Corrects PDF dependency remediation.
tests/​ocr/​test_cli.py Updates CLI error expectations.
tests/​ocr/​test_registry.py Updates registry error expectations.
tests/​test_annotate_sbom.py Updates SBOM target tests.
tests/​test_install_targets.py Updates install-target documentation.
tools/​annotate_sbom.py Renames SBOM target examples.
tools/​install_targets.py Renames generated SBOM target notes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +184 to +187
build:
needs: release
if: needs.release.outputs.released == 'true'
runs-on: ubuntu-latest

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 69fd34e.

Comment thread README.md
Comment on lines +20 to +22
pip install tetrak # core: Tesseract, images and PDFs
pip install 'tetrak[qa]' # enables auto-local — the recommended default
pip install 'tetrak[all]' # everything, several gigabytes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 69fd34e.

Comment thread pyproject.toml Resolved
Comment thread tools/install_targets.py

A consumer installs one of several different things -- `tetrak-ocr`,
`tetrak-ocr[easyocr]`, `tetrak-ocr[all]` -- and each pulls a different
`tetrak[easyocr]`, `tetrak[all]` -- and each pulls a different

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 69fd34e.

Address review: the README banner still said the package was
tetrak-ocr, the pyproject rename comment had been rewritten to name the
wrong package, and install_targets.py mixed both names. The build job
now runs with contents: read rather than inheriting write.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@stephen-masters
stephen-masters merged commit e00bfdc into main Oct 4, 2026
8 checks passed
@stephen-masters
stephen-masters deleted the ci/publish-to-pypi branch October 8, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants