Decouple prkit toolkit from downstream projects - #4
Merged
Conversation
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>
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.
Why
A toolkit should be independent: consumers depend on it, never the reverse.
prkitwas reaching outward —core/project_env.pyhardcoded 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 → uqpsrename) — 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 locatorsfind_uqps_root/find_uq_root/find_repo_rootand thePRKIT_UQPS_ROOT/PRKIT_UQ_ROOTenv-var support.project_dotenv_pathsnow returns only the toolkit's own.env;load_project_dotenv/ensure_openai_api_keykeep their signatures. Keptfind_toolkit_root(self-location only).sampling_backfill.pyandfill_is_match_predicate_physpara.pyoperate on the uq project'sexperiment_results/, not the toolkit.tests/uq/(integration tests importing the uq package) anddocs/PROJECT_SCRIPT_CONVENTIONS.md(documented the old monorepo "subprojects inside the toolkit" model).tests/prkit/core/test_project_env.pyto assert toolkit-only.envloading + 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
.envsupplies API keys viafind_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/prkitclean; pre-commit (ruff/black/mypy) green.src/ tests/ docs/ pyproject.tomlfinds zero references to any consumer project or removed symbol.🤖 Generated with Claude Code