Skip to content

[ty] Remove the mypy_primer CI workflow#24016

Merged
sharkdp merged 1 commit intomainfrom
david/remove-mypy_primer
Mar 17, 2026
Merged

[ty] Remove the mypy_primer CI workflow#24016
sharkdp merged 1 commit intomainfrom
david/remove-mypy_primer

Conversation

@sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Mar 17, 2026

Summary

Remove the mypy_primer CI workflow and several files/scripts associated with it.

Test Plan

Successful CI run on this PR

@sharkdp sharkdp added ci Related to internal CI tooling ty Multi-file analysis & type inference labels Mar 17, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 17, 2026

Typing conformance results

No changes detected ✅

Current numbers
The 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.

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 17, 2026

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 17, 2026

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 17, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

- "scripts/mypy_primer.sh"
- "scripts/mypy_primer_selector.py"
- ".github/ty-ecosystem.toml"
- "crates/ty_python_semantic/resources/primer/**"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is new. seems reasonable to run the workflow if good/bad/flaky.txt change

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we rename the directory to crates/ty_python_semantic/resources/ecosystem/?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG

Comment on lines -73 to -124
# 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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`
Copy link
Contributor Author

@sharkdp sharkdp Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment above

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My agents run it regularly to (attempt to) reproduce ecosystem changes, though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sharkdp sharkdp force-pushed the david/remove-mypy_primer branch from 440a0c5 to e8d7c47 Compare March 17, 2026 14:08
@sharkdp sharkdp marked this pull request as ready for review March 17, 2026 14:14
@astral-sh-bot astral-sh-bot bot requested a review from BurntSushi March 17, 2026 14:14
@sharkdp sharkdp assigned AlexWaygood and unassigned BurntSushi Mar 17, 2026
- "scripts/mypy_primer.sh"
- "scripts/mypy_primer_selector.py"
- ".github/ty-ecosystem.toml"
- "crates/ty_python_semantic/resources/primer/**"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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...

@sharkdp sharkdp merged commit dc59ffa into main Mar 17, 2026
49 checks passed
@sharkdp sharkdp deleted the david/remove-mypy_primer branch March 17, 2026 14:49
sharkdp added a commit that referenced this pull request Mar 17, 2026
carljm added a commit that referenced this pull request Mar 17, 2026
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Related to internal CI tooling ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants