Skip to content

feat: pypi publishing and automation#1

Merged
JPHutchins merged 5 commits into
mainfrom
pypi/publishing
May 26, 2026
Merged

feat: pypi publishing and automation#1
JPHutchins merged 5 commits into
mainfrom
pypi/publishing

Conversation

@JPHutchins

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings May 26, 2026 21:53
astral-sh/setup-uv only publishes exact tags in the v8 line; there's no
floating v8 tag (unlike v7.6, v7, etc.). v8 reference broke 'variants' and
'camas_check' on PR #1.

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.

Pull request overview

This PR introduces a PyPI-oriented packaging toolchain for Zephyr HCI firmware (manifest-driven), wires CI to derive its build matrix from the manifest, and bumps the Zephyr dependency to v4.4.0.

Changes:

  • Bump Zephyr revision in west.yml to v4.4.0 and add a pypi/firmware/manifest.toml as the single source of truth for firmware variants + SHA256s.
  • Add Python tooling under pypi/tools/ to build firmware variants, refresh manifest SHA256s, emit a GitHub Actions matrix, and render/build sibling + umbrella PyPI packages.
  • Update CI to generate the build matrix from the manifest, add a camas-based lint/mypy/pytest job, and add a tag-triggered PyPI publish flow.

Reviewed changes

Copilot reviewed 16 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
west.yml Updates Zephyr project revision to v4.4.0.
pypi/uv.lock Adds a uv lockfile for the PyPI tooling environment.
pypi/tools/update_manifest.py Adds a CLI to recompute and write SHA256s into the firmware manifest from built .hex artifacts.
pypi/tools/emit_ci_matrix.py Emits firmware/manifest.toml variants as a GitHub Actions matrix.
pypi/tools/build_fw_packages.py Renders and builds sibling + umbrella distributions from the manifest and verified artifacts.
pypi/tools/build_firmware.py Adds a CLI to build one manifest variant and collect it into canonical artifact naming.
pypi/tools/_templates.py Defines templates for generated sibling/umbrella package source files and metadata.
pypi/tools/_model.py Introduces immutable NamedTuple-based models for manifest/spec/results.
pypi/tests/test_build_fw_packages.py Adds unit/integration-style coverage for manifest parsing, SHA verification, and package building/install smoke tests.
pypi/tests/conftest.py Provides synthetic firmware artifacts + manifest fixtures for tests.
pypi/tasks.py Adds camas tasks for build/update/check/wheel workflows.
pypi/README.md Documents the purpose of the pypi/ tooling directory.
pypi/pyproject.toml Defines the PyPI tooling project and dev tooling configuration (ruff/mypy/pytest).
pypi/firmware/manifest.toml Adds the firmware variant manifest and expected SHA256s for Zephyr v4.4.0.
pypi/.pythonversion Pins the Python version for the pypi/ tool environment.
pypi/.gitignore Adds ignores for Python artifacts and dist/ under pypi/.
.gitignore Adjusts build output ignore patterns.
.github/workflows/ci.yaml Makes the build matrix data-driven from the manifest; adds camas check + tag publish jobs; updates permissions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pypi/tools/build_fw_packages.py
Comment thread pypi/tools/build_fw_packages.py
PR branch push triggered both push (no branch filter) and pull_request,
running the entire matrix twice. Restrict push to main + tags so feature
branch CI runs once via pull_request only.
Two PR review nits from Copilot:

- verify_sha() crashed with bare FileNotFoundError if a .hex was absent
  from --artifacts. Add MissingArtifact to the BuildResult sum type so
  main() can aggregate missing+mismatched failures and print a single
  clear diagnostic per variant before exiting 1.

- render_package()'s match was exhaustive but had no default arm, so a
  future BuildSpec variant could silently fall through. assert_never()
  makes the closed-set assumption load-bearing under mypy.

Adds tests for both new code paths (verify_sha returns MissingArtifact,
main aborts on missing artifacts) -- now 12 passing tests in the suite.

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.

Pull request overview

Copilot reviewed 16 out of 20 changed files in this pull request and generated 3 comments.

Comment thread pypi/tools/build_fw_packages.py
Comment thread pypi/tools/update_manifest.py Outdated
Comment thread pypi/tools/update_manifest.py
build_firmware and emit_ci_matrix already used Path(__file__)-relative
defaults; build_fw_packages and update_manifest used a cwd-relative
Path("firmware/manifest.toml") that only worked when invoked from pypi/.
Unify on the __file__-anchored absolute pattern so `python -m
tools.<script>` is reliable from any cwd.

Also fix update_manifest's docstring example, which still showed the
pre-reorg layout (--artifacts ./build-hexes from pypi/).
@JPHutchins
JPHutchins merged commit 102f50d into main May 26, 2026
13 checks passed
@JPHutchins
JPHutchins deleted the pypi/publishing branch May 26, 2026 22:19
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