[ty] Remove the mypy_primer CI workflow#24016
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 85.29%. The percentage of expected errors that received a diagnostic held steady at 78.13%. The number of fully passing files held steady at 64/132. |
Memory usage reportMemory usage unchanged ✅ |
|
|
| - "scripts/mypy_primer.sh" | ||
| - "scripts/mypy_primer_selector.py" | ||
| - ".github/ty-ecosystem.toml" | ||
| - "crates/ty_python_semantic/resources/primer/**" |
There was a problem hiding this comment.
this is new. seems reasonable to run the workflow if good/bad/flaky.txt change
There was a problem hiding this comment.
should we rename the directory to crates/ty_python_semantic/resources/ecosystem/?
There was a problem hiding this comment.
that's what I did first, but then I reverted to keep the diff smaller. I like the plan of getting rid of those files, so I'm not going to spend time on renaming the folder now.
| # Runs mypy twice against the same ty version to catch any non-deterministic behavior (ideally). | ||
| # The job is disabled for now because there are some non-deterministic diagnostics. | ||
| mypy_primer_same_revision: | ||
| name: Run mypy_primer on same revision | ||
| runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-32' || 'ubuntu-latest' }} | ||
| timeout-minutes: 20 | ||
| # TODO: Enable once we fixed the non-deterministic diagnostics | ||
| if: false && contains(github.event.pull_request.labels.*.name, 'mypy_primer') | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| path: ruff | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Install the latest version of uv | ||
| uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0 | ||
| with: | ||
| version: "0.10.10" | ||
|
|
||
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | ||
| with: | ||
| workspaces: "ruff" | ||
| shared-key: "mypy-primer" | ||
|
|
||
| - name: Install Rust toolchain | ||
| run: rustup show | ||
|
|
||
| - name: Run determinism check | ||
| env: | ||
| BASE_REVISION: ${{ github.event.pull_request.head.sha }} | ||
| PRIMER_SELECTOR: crates/ty_python_semantic/resources/primer/good.txt | ||
| CLICOLOR_FORCE: "1" | ||
| DIFF_FILE: mypy_primer_determinism.diff | ||
| run: | | ||
| cd ruff | ||
| scripts/mypy_primer.sh | ||
|
|
||
| - name: Check for non-determinism | ||
| run: | | ||
| # Remove ANSI color codes for checking | ||
| sed -e 's/\x1b\[[0-9;]*m//g' mypy_primer_determinism.diff > mypy_primer_determinism_clean.diff | ||
|
|
||
| # Check if there are any differences (non-determinism) | ||
| if [ -s mypy_primer_determinism_clean.diff ]; then | ||
| echo "ERROR: Non-deterministic output detected!" | ||
| echo "The following differences were found when running ty twice on the same commit:" | ||
| cat mypy_primer_determinism_clean.diff | ||
| exit 1 | ||
| else | ||
| echo "✓ Output is deterministic" | ||
| fi |
There was a problem hiding this comment.
@MichaReiser We were never able to activate this check. We now have flaky-detection in ecosystem-primer, which is a more robust way to check the same thing. It's sort-of a "soft" check compared to what you have here, but it should still allow us to catch regressions, I think.
| @@ -1,69 +0,0 @@ | |||
| # Running `mypy_primer` | |||
There was a problem hiding this comment.
This file was already slightly out of date, and I don't think there are a lot of use cases for running mypy_primer locally anymore, so it seems okay to remove this without replacement.
Let me know if you think otherwise, and I can write a new document that would show how to do those things with ecosystem-analyzer.
| ## Ecosystem CI (`ecosystem-analyzer`) | ||
|
|
||
| GitHub Actions will run your changes against a number of real-world projects from GitHub and | ||
| report on any linter or formatter differences. See [`crates/ty/docs/mypy_primer.md`](./docs/mypy_primer.md) |
There was a problem hiding this comment.
linter or formatter differences
🙃
| @@ -1,40 +0,0 @@ | |||
| #!/usr/bin/env python3 | |||
| """Check that the mypy-primer SHA in setup_primer_project.py matches mypy_primer.sh.""" | |||
There was a problem hiding this comment.
This script made sure that the mypy_primer workflow and setup_primer_project.py use the same Git sha for the mypy_primer dependency. Now that the workflow is gone, there is nothing to check against. Unfortunately, the mypy_primer pin that we use in ecosystem-analyzer is currently not fixed (astral-sh/ecosystem-analyzer#10), but once we have that, maybe there is a way to bring this script back. For now, I changed setup_primer_project.py to always use the latest version of mypy_primer, which seems fine in almost all cases.
| # dependencies = ["mypy-primer"] | ||
| # | ||
| # [tool.uv.sources] | ||
| # mypy-primer = { git = "https://github.com/hauntsaninja/mypy_primer", rev = "850d65d9da947ef9e02498b6f07598e7c8401641" } |
There was a problem hiding this comment.
While I agree we'd ideally just make sure we're always using the same pin as ecosystem-analyzer, it still feels not-great from a supply-chain security perspective not to use a pinned dependency here...
There was a problem hiding this comment.
we don't even run this script anywhere, and we're contributors + subscribed to updates on that repo, so I think this is a negligible risk.
There was a problem hiding this comment.
My agents run it regularly to (attempt to) reproduce ecosystem changes, though
440a0c5 to
e8d7c47
Compare
| - "scripts/mypy_primer.sh" | ||
| - "scripts/mypy_primer_selector.py" | ||
| - ".github/ty-ecosystem.toml" | ||
| - "crates/ty_python_semantic/resources/primer/**" |
There was a problem hiding this comment.
should we rename the directory to crates/ty_python_semantic/resources/ecosystem/?
| # dependencies = ["mypy-primer"] | ||
| # | ||
| # [tool.uv.sources] | ||
| # mypy-primer = { git = "https://github.com/hauntsaninja/mypy_primer", rev = "850d65d9da947ef9e02498b6f07598e7c8401641" } |
There was a problem hiding this comment.
While I agree we'd ideally just make sure we're always using the same pin as ecosystem-analyzer, it still feels not-great from a supply-chain security perspective not to use a pinned dependency here...
## Summary Pin mypy_primer (reference: #24016 (comment))
* main: [ty] Filter out unsatisfiable inference attempts during generic call narrowing (#24025) [ty] Avoid inferring intersection types for call arguments (#23933) [ty] Pin mypy_primer in `setup_primer_project.py` (#24020) [`pycodestyle`] Recognize `pyrefly:` as a pragma comment (`E501`) (#24019) Add company AI policy to contributing guide (#24021) [ty] Remove the mypy_primer CI workflow (#24016) Update prek dependencies (#23980) [ty] Smarter semantic token classification for attribute access on union type (#23841) [ty] ecosystem-analyzer: Inline diffs and panic messages (#24015) [ty] Improve `.toml` support in the ty playground (#23476) PEP 639 license information (#19661)
Summary
Remove the mypy_primer CI workflow and several files/scripts associated with it.
Test Plan
Successful CI run on this PR