Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ci: check types with mypy#1226

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 9 commits intogitpython-developers:mainfrommuggenhor:testing
Apr 23, 2021
Merged

ci: check types with mypy#1226

Byron merged 9 commits intogitpython-developers:mainfrommuggenhor:testing
Apr 23, 2021

Conversation

muggenhor
Copy link
Contributor

This is intended to (partially) address the CI concerns expressed in#1219 and#1223 and will result inpartial type checking of the type annotations by using mypy. Keep in mind though that mypy is performingbest-effort static analysis in adynamically typed language so it can only partially check for correctness.

Some other tool(s) will be needed to have more complete type checking at runtime. E.g.typeguard.

In order to get mypy running successfully this also makes a few (as little as possible) changes to the type annotations. The mypy setting to require annotations on everything is commented out because there's way too much functions lacking annotations right now.

Byron reacted with heart emoji
@muggenhormuggenhor changed the titleci: check types with mypy on CIci: check types with mypyApr 23, 2021
@Byron
Copy link
Member

Thanks a lot for taking this on! Your effort is much appreciated, and also much needed to get GitPython back on track.

It appears that thanks to never actually running the type checker, the previous commits to add types weren't validated and seemingly aren't working (or are only working with python 3.9).

I have no idea how much additional work it would be to get mypy to pass, but if it's a dead-end it would certainly be alright to give up on types altogether and revert the commits that added them.

It's all up to you.

@muggenhor
Copy link
ContributorAuthor

Combined with#1227 this should pass now.

Byron reacted with thumbs up emoji

Without the presence of 'test-requirements.txt' 'tox' is unusable.
This gives mypy all information that it needs to determine what thereturn type of a function call is *iff* it knows the argument's type.As a result it can now stop complaining about passing None to str.join()in exc.py.
By telling it where it's imported from in one case and telling it toignore it in another.
This will result in _partial_ type checking of the type annotations byusing mypy. Keep in mind though that mypy is performing _static_analysis in a _dynamic_ language so it can only partially check forcorrectness.Some other tool(s) will be needed to have more complete type checking atruntime. E.g. [typeguard].[typeguard]:https://pypi.org/project/typeguard/
@muggenhor
Copy link
ContributorAuthor

muggenhor commentedApr 23, 2021
edited
Loading

Rebased (to force test-rerun) after#1227 got merged.

Unfortunately it looks like the 3.9 build failed due to what looks like an intermittent failure. And I cannot retrigger a build without (another) force push....

Byron reacted with thumbs up emoji

@ByronByron merged commit4119a57 intogitpython-developers:mainApr 23, 2021
@Byron
Copy link
Member

Thanks a million!

muggenhor reacted with thumbs up emoji

@muggenhormuggenhor deleted the testing branchApril 23, 2021 13:39
@ByronByron mentioned this pull requestApr 23, 2021
3 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@muggenhor@Byron

[8]ページ先頭

©2009-2025 Movatter.jp