Skip to content

Phase 7b-1: PyPI packaging + release workflow (no publish yet) - #49

Merged
samuelrojas-dev merged 4 commits into
mainfrom
claude/sleepy-noether-3oc5nl
Oct 2, 2026
Merged

samuelrojas-dev merged 4 commits into
mainfrom
claude/sleepy-noether-3oc5nl

Conversation

@samuelrojas-dev

Copy link
Copy Markdown
Owner

What

First half of the PyPI release (Phase 7b): make the package publish-ready and wire the release
automation — without publishing anything. The actual first publish (7b-2) needs the trusted
publishers configured on your PyPI/TestPyPI accounts, which only you can do; I'll ping you then.

Packaging

  • Single-source version. The version is now dynamic, read from __version__ in
    src/dowbench/__init__.py via [tool.hatch.version], removing the duplicate static value in
    pyproject.toml. Bumped 0.0.1 → 0.1.0 for the first public release (classifier stays Alpha).
  • sdist file set declared ([tool.hatch.build.targets.sdist]), and project.urls gains
    Homepage + Changelog for a better PyPI page.

Release automation

  • .github/workflows/release.yml — builds sdist+wheel, runs twine check and a tag↔version
    consistency check, then publishes via Trusted Publishing (OIDC), no stored token:
    • manual workflow_dispatch → TestPyPI (the dry run, environment: testpypi);
    • vX.Y.Z tag push → PyPI (environment: pypi).
    • Publish jobs request id-token: write at the job level; the workflow's default token stays
      contents: read.
  • docs/RELEASING.md — the one-time trusted-publisher setup (maintainer, 7b-2), the TestPyPI
    dry run, and how to cut a release.

Guard test

  • tests/test_packaging.py — asserts importlib.metadata.version("dowbench") == dowbench.__version__,
    the console script is registered, and the provider/defense/tool_loader entry-point groups ship
    their built-ins. Catches broken build wiring with no publish.

Verified locally (the package-data risk from the estimate)

Built with python -m build, then in a clean venv outside the repo:

  • the wheel ships py.typed, attacks/data/seed.yaml, metering/pricing.yaml, the console script
    and all four entry-point groups;
  • dowbench list attacks, dowbench scan <tools.json>, and dowbench estimate <config> all run
    from outside the repo (bundled data loads), reporting version 0.1.0;
  • twine check dist/* → PASSED for both sdist and wheel.

Not in this PR (per your decisions)

  • No publish — no account/token touched; that's 7b-2 (I'll ping you to configure the trusted publishers).
  • No PyPI badge / no pip install dowbench in the README yet — a badge would 404 before the
    first publish (CLAUDE.md: no invented badges), so it lands with 7b-2.
  • The dowbench-scan Action keeps installing from git — migrating it to PyPI is a separate PR
    after the first stable publish.
  • The git clone + pip install -e . flow is unchanged (editable install still reports 0.1.0).

Kind

  • feature (packaging / CI)
  • test

Checklist

  • Small, focused change; Conventional Commits (4 commits).
  • ADR: n/a (release mechanics; no design decision changed).
  • No invented numbers / no badge before a real publish.
  • No real provider call, no secrets — Trusted Publishing stores no token.
  • Expected-behavior changes: none for users; version reported is now 0.1.0.

Verification

ruff check . && ruff format --check .      # All checks passed!
mypy src tests examples scripts            # Success: no issues found in 74 source files
python -m pytest --cov=dowbench            # 325 passed (test_packaging: 3)
python scripts/verify_cassettes.py         # all 2 published cassette(s) verified
python -m build && twine check dist/*      # both PASSED; clean-venv install runs the CLI

🤖 Generated with Claude Code

https://claude.ai/code/session_014wCFhM2gxQCfJYcm4Zu6z4


Generated by Claude Code

claude added 4 commits October 2, 2026 01:42
Prepare PyPI packaging (Phase 7b). The version is now dynamic, read from
__version__ in src/dowbench/__init__.py via [tool.hatch.version], removing the
duplicate static version; bumped 0.0.1 -> 0.1.0 for the first public release.
Adds a [tool.hatch.build.targets.sdist] file set and Homepage/Changelog to
project.urls. Verified: wheel ships py.typed, attacks/data/seed.yaml,
metering/pricing.yaml and all entry points; a clean-venv install runs
list/scan/estimate from outside the repo; twine check passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wCFhM2gxQCfJYcm4Zu6z4
A release workflow builds the sdist+wheel, runs twine check and a tag/version
consistency check, and publishes via PyPI Trusted Publishing (OIDC, no stored
token): TestPyPI on manual dispatch (the dry run), PyPI on a vX.Y.Z tag. Publish
jobs request id-token at job level; the default token stays read-only.
docs/RELEASING.md documents the one-time trusted-publisher setup (maintainer, in
7b-2), the dry run, and cutting a release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wCFhM2gxQCfJYcm4Zu6z4
Asserts importlib.metadata version('dowbench') == dowbench.__version__, the
console script is registered, and the provider/defense/tool_loader entry-point
groups ship their built-ins. Catches a broken build wiring without publishing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wCFhM2gxQCfJYcm4Zu6z4
@samuelrojas-dev
samuelrojas-dev merged commit c0fbb47 into main Oct 2, 2026
7 checks passed
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