-
Notifications
You must be signed in to change notification settings - Fork 17
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: compatibility with mypy 0.900 #232
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alexander-held
changed the title
chore: compatibility with mypy 0.900
fix: compatibility with mypy 0.900
Jun 9, 2021
Codecov Report
@@ Coverage Diff @@
## master #232 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 1727 1727
Branches 268 268
=========================================
Hits 1727 1727
Continue to review full report at Codecov.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the release of
mypy
0.900, third party type stubs need to be separately installed. This affectsPyYAML
andtabulate
in the case ofcabinetry
. The newmypy
version also revealed a small typing issue in the CLI that is fixed here.pyhf
0.6.1 capsclick
to version below 8.0, which meanstypes-click
would temporarily be required until the release ofpyhf
0.6.2 when runningmypy
outside of pre-commit.The solution adopted here for compatibility with
mypy
0.900+ is instead to movemypy
to only run viapre-commit
. It is still possible to run it directly manually by installingclick
8.0+ (manual installation will no longer be required inpyhf
0.6.2, where the cap will be removed).mypy
runs in pre-commit withpython-version
set to both 3.7 and 3.8, following this example. The environment includesclick
8.0 alongside the requiredtypes-*
packages.click>=8
is incompatible withtypeguard
("object has no attribute '__code__'"), fixed intypeguard
version 2.12.1. However,typeguard
versions beyond 2.10.0 are incompatible withNamedTuple
in Python 3.7 (see #199). At the moment thepyhf
pin toclick~=7
restricts that from becoming an issue, but the nextpyhf
release will make this issue evident. It is therefore fixed here already: thetypeguard
pin is removed, andtypeguard
is used in CI only for Python 3.8+.List of changes:
mypy
now runs via pre-commit, and the corresponding action in CItypeguard
pin removed, now runs in CI only for Python 3.8+mypy
config to usepyproject.toml
instead ofsetup.cfg
, allowing for simplerignore_missing_imports
configuration, example: style: simpler mypy toml config hist#230pyupgrade
modification for list comprehension