Skip to content

Decouple prkit toolkit from downstream projects - #4

Merged
sherryzyh merged 2 commits into
mainfrom
refactor/decouple-prkit-from-consumers
Jun 16, 2026
Merged

Decouple prkit toolkit from downstream projects#4
sherryzyh merged 2 commits into
mainfrom
refactor/decouple-prkit-from-consumers

Conversation

@sherryzyh

Copy link
Copy Markdown
Owner

Why

A toolkit should be independent: consumers depend on it, never the reverse. prkit was reaching outwardcore/project_env.py hardcoded the folder names of its downstream projects (uncertainty_quantification_physical_reasoning, uncertainty_quantification_via_physics_semantics) and even shipped their tests. This PR makes prkit know only itself.

This supersedes #3 (the canonical → uqps rename) — that rename is included here as the first commit, and the renamed locator is then removed entirely.

Changes

  • core/project_env.py — remove the cross-repo locators find_uqps_root / find_uq_root / find_repo_root and the PRKIT_UQPS_ROOT / PRKIT_UQ_ROOT env-var support. project_dotenv_paths now returns only the toolkit's own .env; load_project_dotenv / ensure_openai_api_key keep their signatures. Kept find_toolkit_root (self-location only).
  • Relocate project CLIs to the uq reposampling_backfill.py and fill_is_match_predicate_physpara.py operate on the uq project's experiment_results/, not the toolkit.
  • Delete consumer contenttests/uq/ (integration tests importing the uq package) and docs/PROJECT_SCRIPT_CONVENTIONS.md (documented the old monorepo "subprojects inside the toolkit" model).
  • Rewrote tests/prkit/core/test_project_env.py to assert toolkit-only .env loading + a negative test proving prkit ignores a sibling consumer's .env.

Consumer impact

Neither consumer breaks — both already define the locators locally in their own bridges and import only the kept symbols; the toolkit's own .env supplies API keys via find_toolkit_root. The uq repo's accommodating changes (and the relocated scripts) are in uncertainty_quantification_physical_reasoning#1. The uqps repo needs no change (verified compliant).

Verification

  • pytest tests → 1379 passed, 1 skipped; mypy src/prkit clean; pre-commit (ruff/black/mypy) green.
  • Purge guard grep over src/ tests/ docs/ pyproject.toml finds zero references to any consumer project or removed symbol.

🤖 Generated with Claude Code

sherryzyh and others added 2 commits June 15, 2026 23:17
Renames the project-locator helper and its env var
(PRKIT_CANONICAL_ROOT -> PRKIT_UQPS_ROOT), and repoints the hardcoded
sibling-directory lookups to uncertainty_quantification_via_physics_semantics
(the renamed canonical_answer_protocol project). Leaves unrelated
domain uses of 'canonical' (unit canonicalization, canonical_text,
the --canonical-sampling-root baseline flag) untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The toolkit must not know about its consumer projects. Remove the cross-repo locators (find_uqps_root/find_uq_root/find_repo_root) and the PRKIT_UQPS_ROOT/PRKIT_UQ_ROOT support from core/project_env.py; the .env loader now resolves only the toolkit's own root. Relocate the project-specific CLIs (sampling_backfill.py, fill_is_match_predicate_physpara.py) to the uq repo, and delete the consumer integration tests (tests/uq/) plus the project-script conventions doc that assumed a monorepo layout.

Consumers own cross-repo locating and .env loading via their own bridges; neither breaks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sherryzyh
sherryzyh merged commit 793897d into main Jun 16, 2026
3 checks passed
@sherryzyh
sherryzyh deleted the refactor/decouple-prkit-from-consumers branch June 16, 2026 04:25
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.

1 participant