Replies: 1 comment
-
|
You’re exactly right that this is almost always toolchain drift rather than “new” errors. 1. How to align your local environment with CIThe key rule for TheAlgorithms/Python is: CI is the source of truth. Your local setup should mirror CI, not the other way around. Use the repo-pinned versions (not global installs)Do not install Instead, do this: Then check what CI is using:
Best practice: match CI’s Python version exactly. If needed, recreate your venv with the correct Python. 2. Why you’re seeing mypy errors in untouched filesThis is expected behavior.
So your local run can legitimately surface pre-existing type issues. 3. Should you limit checks or fix unrelated errors?Recommended approach (and what maintainers prefer): For your contribution:
What not to do:
If you want to help further:
Maintainers are much more likely to accept it that way. TL;DR
If your local checks match You’re on the right track. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am preparing a small contribution, but I’m seeing mismatches between my local checks and what passes in CI. Locally,
pre-commit(ruff + mypy) fails with type‑checking errors in files I did not modify, while themainbranch appears clean. I suspect a tool‑version or environment drift between my machine and CI.Steps to Reproduce
Actual Result
Mypy reports errors in unrelated modules (e.g., incompatible types) even though the same files appear to pass CI on
main.Question
What is the correct way to align local tool versions (Python, ruff, mypy, pre‑commit hooks) with the versions used in CI so that local checks match CI behavior?
If type errors appear outside the files I changed, is it recommended to limit checks to staged files or open a separate PR to address repository‑wide issues?
Beta Was this translation helpful? Give feedback.
All reactions