PyPI publish (W8.T08)¶
Status (2026-08-14): bnn-lab 1.0.0 is live on PyPI
(project ·
JSON · version 1.0.0, non-empty
urls). First OIDC upload:
Actions run 31825286443
(wheels.yml workflow_dispatch on main, publish=true). This repo does
not use long-lived PyPI API tokens. After the first upload, the pending
Trusted Publisher on pypi.org should show as active (refresh Publishing).
Why the distribution name is bnn-lab¶
The short name bnn is already taken on
PyPI (Adrian Bulat’s unrelated binary-networks package, 0.1.2). Publishing
under that name would fail or collide.
| Surface | Name |
|---|---|
| PyPI / pip | bnn-lab |
| Wheel / sdist filename | bnn_lab-… (PEP 503 / PEP 440 normalisation) |
| Import | import bnn (unchanged) |
| CLI | bnn console script (unchanged) |
pip install bnn-lab==1.0.0
That is a library install. bnn repro / bnn optimise / bnn recommend
need a clone + pip install -e ".[dev]" because they call repo scripts/.
See GUIDE_E2E. Git fallback:
pip install "bnn-lab @ git+https://github.com/KanakMalpani/Binary-Neural-Networks.git@v1.0.0"
Checklist¶
- [x]
pyproject.tomldistribution namebnn-lab, version synced withbnn/_version.py(1.0.0) - [x]
readme,license, classifiers (3.11–3.13),project.urls(incl. PyPI + publish runbook) - [x] Console script
bnn(import package remainsbnn) - [x]
constraints.txtfor reproducible installs - [x]
wheels.ymlbuild matrix + W8.T07 attestations on wheels and sdist - [x]
wheels.ymlpackage-checkdry-run job (artifacts present; no upload) - [x]
wheels.ymlpublish job gated onworkflow_dispatch+publish=true+environment: pypi - [x] GitHub Environment
pypicreated on the repo (Settings → Environments) - [x] PyPI.org Trusted Publisher for
bnn-lab/wheels.yml/ envpypi(pending → active after first upload) - [x] First production publish via Actions (
publish=trueonmain, run 31825286443) - [x] Post-upload:
pip install bnn-lab==1.0.0on a clean venv;import bnnworks. (bnn reprois clone +[dev], not a pip-only gate.)
How it shipped (history)¶
Trusted Publishing was not configured until 2026-08-14. Earlier probes:
- GitHub env
pypiexists onKanakMalpani/Binary-Neural-Networks. - PyPI project
bnn-labdid not exist (JSON API 404 as of 2026-08-13). - OIDC
publish=trueon tagv1.0.0failed withinvalid-publisher(run 31031733046, 2026-08-05): valid GitHub OIDC token, no matching pending publisher. - Retry on 2026-08-13:
- 31698000321
(
v1.0.0): never reached publish —windows-amd64cp313wheel test crashed (check_wheel_kernel.pyexit 3221225477 /0xC0000005). - 31700631120
(
lane/c-pypi-honesty,cp313-win_amd64skipped): matrix +package-checksuccess; publishinvalid-publisheragain. Win+3.13 is skipped (see Wheel matrix notes). - Maintainer added the pending publisher (
bnn-lab/wheels.yml/ envpypi). Dispatch onmain(not frozen tagv1.0.0) succeeded: 31825286443. - Do not add a PyPI API token secret or invent a token-based publish path.
wheels.ymlis OIDC-only (id-token: write,pypa/gh-action-pypi-publish).
Recurring releases (maintainer)¶
- Confirm GitHub Environment named
pypi(already created). Optional: add required reviewers on that environment for public-repo safety. - Bump version in
bnn/_version.py+pyproject.toml; tag when ready. - GitHub Actions → wheels → Run workflow:
- Use ref
main(skip forcp313-win_amd64is on main via PR #31) — not tagv1.0.0. The frozen tag still builds crashingcp313-win_amd64. - Set publish = true.
- After upload:
pip install bnn-lab==<version>on a clean venv; confirmimport bnn. Refresh pypi.org Publishing if the publisher still shows pending (first upload converts it to active).
The publish job uses OIDC (id-token: write); no long-lived API token in the repo.
Wheel matrix notes (Lane C dry-run)¶
cibuildwheel on macOS/Windows sets BNN_NO_OPENMP=1 so wheels ship
portable SIMD kernels without Homebrew libomp (delocate/macOS 26 bottle
mismatch) or MSVC vcomp*.dll ctypes load failures. Linux still links
libgomp when available. Thesis win remains packed XNOR–popcount, not thread
scaling. BNN_NO_OPENMP is the wheel-build kill switch in setup.py;
BNN_FORCE_OPENMP=1 (or compile_native --openmp) is the local macOS opt-in
when you knowingly want OpenMP despite the default-off policy.
Skipped targets:
| Pattern | Why |
|---|---|
*musllinux* |
PyTorch has no musl wheels — bnn-lab (hard-deps torch) cannot install |
cp313-macosx_x86_64 |
No torch wheel — do not publish unloadable artifacts |
cp313-win_amd64 |
numpy 1.26.x (numpy>=1.24,<2) + CPython 3.13.14: kernel smoke access-violates; do not ship an untested Win+3.13 wheel until numpy 2 is allowed |
Use manylinux / Win cp311–312 / macOS arm64 (and cp311–312 on Intel Mac).
hf optional extra includes safetensors for Lane B packed export.
1.0.0 files on PyPI: 13 wheels + sdist (14 files). Missing vs a full
3.11–3.13 × 5-platform matrix: cp313-win_amd64 and cp313-macosx_x86_64
(skipped as above).
Dry-run (Actions, preferred)¶
gh workflow run wheels.yml --ref main -f publish=false
gh run watch
Expect: matrix wheels + sdist + attestations + package-check success;
publish job skipped.
Local dry-run (no upload)¶
python -m pip install -U build twine
python -m build
twine check dist/*
Expect: bnn_lab-1.0.0 sdist + wheel, PASSED.
Historical note¶
twine check for the old distribution name bnn-0.3.0 passed on 2026-07-25;
the rename is required solely because of the PyPI name collision.
Interim install (Git / Release)¶
Prefer PyPI. Git remains valid:
pip install "bnn-lab @ git+https://github.com/KanakMalpani/Binary-Neural-Networks.git@v1.0.0"
Or editable:
pip install -e ".[dev]" -c constraints.txt
Attestations (W8.T07)¶
After a wheels run on this repo:
gh attestation verify path\to\bnn_lab-*.whl --repo KanakMalpani/Binary-Neural-Networks
gh attestation verify path\to\bnn_lab-*.tar.gz --repo KanakMalpani/Binary-Neural-Networks
See also SBOM.md.
Public-repo note¶
This repository is public. OpenSSF Scorecard’s public badge API and free
Code Scanning apply. Recurring bnn-lab uploads stay OIDC Trusted Publishing
only — no API-token path.