Repository navigation
refactor(ns): convert campus to a PEP 420 namespace portion - #986
Merged
Merged
Conversation
Delete campus/__init__.py (pkgutil extend_path shim, zero code, zero attribute consumers) so `campus` is a native namespace package: every distribution contributing subpackages under campus/ ships an init-less portion and Python merges them across sys.path. Groundwork for the campus-common carve (#970 phase 3). - scripts/audit_wheel_namespace.py: post-build wheel audit that fails on any campus/__init__.py, missing subpackage inits, or empty portions - docs/PACKAGING.md: document the namespace rules and the audit command Verified: 872 unit + full contract suite green in a worktree venv; poetry build wheel passes the namespace audit. Refs #970.
backends/ shipped .py files with no __init__.py - an accidental nested namespace portion that only imported via PEP 420 fallback. Caught by the new scripts/audit_wheel_namespace.py on its first run; docstring-only init, no behavior change. Refs #970.
3 tasks
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.
Summary
Convert
campusfrom a pkgutil-style namespace package into a native PEP 420 namespace portion: deletecampus/__init__.py, which contained only thepkgutil.extend_pathshim and a docstring (no code, no__version__, no attribute consumers — verified by repo-wide grep). Every distribution that contributes subpackages undercampus/now ships an init-less portion, and Python merges them acrosssys.path.This is the namespace groundwork for the #970 phase-3 carve (
campus-commonand friends as separate distributions): consumer import syntax (from campus.model import ...,import campus.common,from campus import flask_campus) is unchanged — those are submodule imports, which resolve identically under PEP 420.Changes
campus/__init__.py— the onlypkgutilreference in the codebase; its stated purpose ("extend with campus-python") is stale since the SDK installs a separate top-levelcampus_pythonnamespace.scripts/audit_wheel_namespace.py— post-poetry buildaudit that fails the build if any wheel shipscampus/__init__.py, ships.pyfiles in a subpackage dir without__init__.py, or ships nothing undercampus/. The failure mode this guards against (one stale regular package silently shadowing all other dists' portions) is otherwise invisible until runtime.campus/yapper/backends/shipped.pyfiles with no__init__.py(accidental nested namespace portion; imported only via relative imports inside yapper). Now a regular package.Testing
poetry build+python scripts/audit_wheel_namespace.py→ wheel ships an init-lesscampus/portion with all subpackages intactruff checkgreen on all changed/new filesRefs #970 (phase-3 groundwork; non-closing).