-
Notifications
You must be signed in to change notification settings - Fork 122
H-6664: Introduce Python monorepo infrastructure and formalize python repo-chores #9039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
indietyp
wants to merge
9
commits into
main
Choose a base branch
from
bm/h-6664-python-monorepo-infrastructure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4e0a01c
feat: initialize python monorepo structure
indietyp 4c7fb70
feat: initialize repo chores
indietyp 0b513ff
feat: add upper bound lint
indietyp ca03fcf
fix: remove fnmatch
indietyp 89b5d84
fix: make ty strict
indietyp f6c9169
fix: discourage class based tests
indietyp 0bba6e6
fix: added `.venv` to license ignore
indietyp 259fef9
fix: formaet
indietyp ebb40a5
fix: ruff complaints
indietyp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/usr/bin/env bash | ||
| #MISE description="Fix Python: sync lockfile, apply ruff autofixes and formatting" | ||
| set -euo pipefail | ||
|
|
||
| mise exec uv -- uv sync | ||
| mise exec uv -- uv run --frozen ruff check --fix . | ||
| mise exec uv -- uv run --frozen ruff format . |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/usr/bin/env bash | ||
| #MISE description="Lint Python: lock stability, workspace sync, ruff format + lint, ty type checks, tach architecture checks" | ||
| set -uo pipefail | ||
|
|
||
| FAILED=0 | ||
|
|
||
| run() { | ||
| echo "$ $*" | ||
| mise exec uv -- "$@" || FAILED=1 | ||
| } | ||
|
|
||
| # `--locked` doubles as the uv.lock stability check: it fails if the lockfile | ||
| # is out of sync with the workspace manifests. | ||
| run uv sync --locked | ||
| # Boundaries: explicit workspace membership, uniform requires-python, shared | ||
| # tool pins, and generated package.json turbo wiring. | ||
| run uv run --frozen repo-chores sync --check | ||
| # Dependency rules: fully bounded version ranges, registry-only sources. | ||
| run uv run --frozen repo-chores lint | ||
| run uv run --frozen ruff format --check . | ||
| run uv run --frozen ruff check . | ||
| run uv run --frozen ty check | ||
| run uv run --frozen tach check | ||
| run uv run --frozen tach check-external | ||
|
|
||
| exit "$FAILED" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/usr/bin/env bash | ||
| #MISE description="Synchronize Python workspace membership, version bounds, and generated package.json wiring" | ||
| set -euo pipefail | ||
|
|
||
| # Unfrozen on purpose: this is a fix task, so a stale uv.lock is expected | ||
| # input. `uv run` refreshes the lock and environment before running the tool. | ||
| mise exec uv -- uv run repo-chores sync | ||
| # Membership or dependency fixes change the workspace graph; refresh the lock | ||
| # and environment again so the result is immediately usable. | ||
| mise exec uv -- uv lock | ||
| mise exec uv -- uv sync |
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,16 @@ | ||
| { | ||
| "name": "@apps/petrinaut-opt", | ||
| "name": "@python/petrinaut-optimization", | ||
| "version": "0.0.0-private", | ||
| "private": true, | ||
| "description": "Scenario-parameter optimization for Petrinaut using Optuna", | ||
| "license": "(MIT OR Apache-2.0)", | ||
| "scripts": { | ||
| "codegen": "uv run python -m scripts.generate_openapi", | ||
| "fix:ruff": "uv run --frozen ruff check --fix . && uv run --frozen ruff format .", | ||
| "install:deps": "uv sync", | ||
| "lint:ruff": "uv run --frozen ruff check . && uv run --frozen ruff format --check .", | ||
| "start": "uv run uvicorn src.optimization_api:app", | ||
| "start:dev": "uv run uvicorn src.optimization_api:app --reload", | ||
| "test:unit": "uv run pytest && yarn codegen && git diff --exit-code -- openapi/openapi.json" | ||
| "test:unit": "uv run --frozen pytest tests" | ||
| } | ||
| } |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker build breaks after workspace move
High Severity
Raising
requires-pythonto>=3.14,<3.15and moving the lockfile to the repo-rootuv.lockleavesapps/petrinaut-opt/docker/Dockerfileinconsistent: it still uses Python 3.13, uv 0.11.18, andCOPYs the removed package-localuv.lock. Deploy builds that use this Dockerfile will fail at the dependency layer.Reviewed by Cursor Bugbot for commit ebb40a5. Configure here.