fix: declare packaging as runtime dep + v0.10.3 (critical bugfix) - #46
Merged
Conversation
CRITICAL: every v0.10.x PyPI install (pipx / pip-venv) was broken
for the self-update feature. v0.10 Track A added
`from packaging.version import Version` to updater/version.py for
PEP 440 comparison, but `packaging` was never added to
[project] dependencies. PyPI installs got a minimal venv with no
transitive `packaging`, so any `sentinel update --check` or
`--apply` invocation raised ModuleNotFoundError and exited 1 —
the self-update feature was broken for the exact users it was
built for.
Masked during dev because editable installs (pip install -e .)
get `packaging` from setuptools/pip transitively.
Found in the field: a user migrating from editable to pipx
operational mode hit this on the first `sentinel update --check`.
Fixes:
- Declare `packaging>=21,<26` in [project] dependencies.
- Add tests/test_dependencies.py (3 tests) that fail-fast on this
shape of bug:
* packaging is importable
* updater.version module imports cleanly (catches future
submodule-layout breaks)
* declared deps in pyproject.toml include all the packages
production code imports unconditionally (3.11+ only — gated
on tomllib stdlib availability)
Bumps version 0.10.2 → 0.10.3 + CHANGELOG entry.
mypy clean (25 files), ruff clean, 904 → 907 pytest pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Critical bug
Every v0.10.x PyPI install (pipx / pip-venv) is broken for the self-update feature. v0.10 Track A added
from packaging.version import Versiontoupdater/version.pyfor PEP 440 comparison, butpackagingwas never added to[project] dependencies. PyPI installs got a minimal venv with no transitivepackaging— so anysentinel update --checkor--applyinvocation:→ exit 1. The self-update feature was broken for the exact users it was built for.
How this got past CI
Masked during dev because editable installs (
pip install -e .) getpackagingfrom setuptools/pip transitively. mypy and pytest both passed because both ran in dev environments. CI similarly used a dev-shaped venv. The bug only surfaces on a cleanpipx install sentinel-macvenv.How it was found
A user migrating from dev (editable) to operational (pipx) mode hit it on the first
sentinel update --checkafterpipx install.Fix
packaging>=21,<26in[project] dependencies(pyproject.toml).tests/test_dependencies.py(3 tests) — fail-fast guardrail for this shape of bug:test_packaging_is_importable— bare import (catches the immediate regression)test_updater_version_module_imports_clean— end-to-end import of the consumer module (catches futurefrom packaging.X import Ystyle breaks if upstream submodule layout changes)test_runtime_deps_match_pyproject— parsespyproject.tomland asserts the declared deps include all packages production code imports unconditionally. Hand-curated allowlist; new runtime imports must be added here AND topyproject.toml. Skipped on Python < 3.11 (notomllibstdlib there).Why this approach over a
clean-venvCI testA
python -m venv && pip install <wheel> && python -c "import sentinel_mac.commands.update"test in CI would catch this 100% reliably but adds ~30s per matrix entry. The lighter unit-test guardrail above catches the 95% case (someone forgets to update pyproject.toml when adding aimport X) at zero extra CI cost. A clean-venv smoke test is a v0.11 candidate.Verification
pipx run sentinel-mac@0.10.2 update --checkraises ModuleNotFoundError;pipx run sentinel-mac@0.10.3 update --checkworks.Pre-flight
pyproject.tomlversion 0.10.2 → 0.10.3sentinel_mac/__init__.py__version__0.10.2 → 0.10.3[Unreleased]→[0.10.3] - 2026-05-05with critical-bugfix bannerAfter merge
v0.10.3onmainpipx upgrade sentinel-mac(after publish) — fresh deps fetchedpipx inject sentinel-mac packagingTest plan
pipx run sentinel-mac@0.10.3 update --check회복 확인🤖 Generated with Claude Code