Skip to content

feat(dist): consume campus-common from its own distribution - #987

Merged
nycomp merged 2 commits into
weeklyfrom
feat/carve-campus-common
Oct 28, 2026
Merged

nycomp merged 2 commits into
weeklyfrom
feat/carve-campus-common

Conversation

@nycomp

@nycomp nycomp commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Summary

campus.common moves to its own distribution: nyjc-computing/campus-common (v0.1.0, shipped first so this dep resolves). The monorepo declares it as a git dependency and ships no campus/common of its own. Consumer import syntax is unchanged — from campus.common import ... resolves through the shared PEP 420 namespace instead of the suite wheel.

Downstream repos are unaffected until they choose to relock; locks pin the old campus-suite commit (with campus/common baked in) until each repo updates. The downstream pass (sdk, classroom, admin, profile, nyxchange declare campus-common; cli picks it up transitively) follows this merge.

Changes

  • pyproject.toml: campus-common = {git = ".../campus-common.git", branch = "main"} alongside the existing campus-api-python pattern.
  • campus/common/** deleted (24 files, verbatim-carved into campus-common@995bc2c).
  • tests/unit/common split: 10 suites moved with the code; test_deploy / test_import_weight / test_openapi_spec stay (they test suite modules); test_url.py reduced to the codespace-deploy test (it exercises campus.deploy) — its url-utils coverage lives in campus-common.
  • tests/unit/test_package_boundaries.py: SHARED_ALLOWED drops the in-repo "common" entry (its directory is gone, so the rules would silently no-op). The remaining AST rules still govern what in-tree layers may import from campus.common. Constraints on common itself (stdlib+bcrypt only, no sibling imports, lazy flask per chore(common): campus.common still imports flask at import time via campus/common/utils/url.py #861) are enforced by campus-common's own boundary guard (tests/unit/test_boundaries.py).

Testing

  • Fresh worktree venv: poetry lock resolves campus-common 0.1.0; 724 unit tests + full contract suite green (the sqlite concurrency flake reproduces only under parallel-suite CPU contention; passes isolated)
  • Attribute-access asserts: campus.common resolves from the campus-common wheel (site-packages), suite modules resolve from the tree, both dists present (campus-common 0.1.0, campus-suite 0.1.16)
  • poetry build + namespace audit: suite wheel is an init-less portion with no campus/common
  • campus-common side: 150 tests, wheel smoke in a fresh venv, CI green on main

Refs #970 (phase 3, dist 1 of 5). Non-closing.

campus.common is carved to nyjc-computing/campus-common@main (v0.1.0):
the monorepo now declares it as a git dependency and ships no
campus/common of its own. Consumers see one unchanged import surface
(from campus.common import ...) - the namespace portion comes from the
installed dist instead of the suite wheel. Downstream repos relock to
pick this up; locks pin the old suite until they choose to update.

- tests/unit/common: 10 suites moved to campus-common; test_deploy /
  test_import_weight / test_openapi_spec stay (suite modules);
  test_url.py reduced to the codespace-deploy test (exercises
  campus.deploy); its url-utils coverage lives in campus-common.
- tests/unit/test_package_boundaries.py: SHARED_ALLOWED drops the
  in-repo 'common' entry (its dir is gone - the rules would silently
  no-op); constraints on common itself moved to campus-common's
  tests/unit/test_boundaries.py. The remaining rules still govern
  importing campus.common from the in-tree layers via AST.

Verified: unit + contract green in a fresh worktree venv (the sqlite
concurrency flake reproduces only under parallel-suite CPU contention
and passes isolated); campus.common resolves from the campus-common
wheel while suite modules resolve from the tree; wheel audit green.
Refs #970.
With campus/common gone from the tree, ruff's src-based first-party
detection classified campus.common third-party and flagged every mixed
import block as I001 (~30 files). known-first-party = ["campus"] pins
the whole namespace; also rename a loop variable left unused by the
moved common-specific rule (B007).
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