Skip to content

Conversation

@George-Ogden
Copy link
Contributor

Pin mypy version and fix errors
Now, the CI will fail when the types are incorrect

@George-Ogden George-Ogden marked this pull request as ready for review November 28, 2025 12:24
@Byron Byron requested a review from Copilot November 29, 2025 09:46
Copilot finished reviewing on behalf of Byron November 29, 2025 09:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR pins mypy to version 1.18.2 and addresses type checking errors to enable strict type checking in CI. The changes remove continue-on-error: true from the mypy CI step and restrict mypy execution to Python 3.9+, ensuring that type errors will now cause CI failures.

  • Pins mypy version and restricts it to Python 3.9+ environments
  • Adds specific type ignore comments with error codes for legitimate type checking edge cases
  • Fixes type annotations and removes unnecessary casts
  • Prevents pytest from treating test utility classes as test classes

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test-requirements.txt Pins mypy==1.18.2 for Python 3.9+ to prevent new type errors from future mypy releases
pyproject.toml Removes python_version constraint allowing mypy to use the running Python version
.github/workflows/pythonpackage.yml Restricts mypy checks to Python 3.9+ and removes continue-on-error to fail CI on type errors
test/test_submodule.py Adds __test__ = False to prevent pytest treating TestRootProgress as a test class and adds noqa for assertRaises
test/test_remote.py Adds return type annotation and __test__ = False to TestRemoteProgress
test/lib/helper.py Removes unnecessary B001 noqa code from bare except statements
test/deprecation/test_types.py Removes type ignore comment now that Lit_commit_ish is properly defined
git/types.py Guards Lit_commit_ish type alias with TYPE_CHECKING for proper deprecation handling
git/util.py Adds type ignores for IterableList, fixes isinstance check logic, and improves error messages
git/repo/fun.py Removes unnecessary cast from ref.commit
git/repo/base.py Simplifies config reader comprehension and adds type ignores for progress argument
git/refs/tag.py Moves type ignore comments to property decorator line for better clarity
git/refs/symbolic.py Replaces explicit type annotation with cast for instance variable
git/refs/log.py Adds type ignore for RefLogEntry tuple construction
git/refs/head.py Removes duplicate commit type annotation and adds type ignore for delete override
git/objects/submodule/base.py Adds RemoteReference cast for tracking_branch() result and imports RemoteReference
git/objects/commit.py Adds str() cast for message in regex to handle bytes type
git/index/typ.py Adds type ignore comments for IndexEntry tuple construction
git/diff.py Adds type annotation for change_type class variable with noqa comment
git/config.py Updates format string to f-string, removes unnecessary cast and comment, and uses cp._SectionName type
Comments suppressed due to low confidence (1)

git/util.py:1210

  • This method raises ValueError - should raise a LookupError (KeyError or IndexError) instead.
    This method raises AttributeError - should raise a LookupError (KeyError or IndexError) instead.
    def __getitem__(self, index: Union[SupportsIndex, int, slice, str]) -> T_IterableObj:  # type: ignore[override]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Thanks a lot for making this happen!

Apologies for unleashing AI as well, but I think it can be helpful given that I don't really know python anymore, and am quite clueless 😅.

Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Thanks a lot, let's do it then!

@Byron Byron merged commit 0fcf291 into gitpython-developers:main Nov 29, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants