-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
Assorted MyPy improvments #1663
Conversation
Unused "type: ignore" comment [unused-ignore]
Must not have show_error_codes. It is now the default.
239b84a
to
6f5af15
Compare
6f5af15
to
6b89efd
Compare
|
||
installed_distributions = DistributionCache(sys_path) | ||
return all(dependency_in_sync(requirement, environment, installed_distributions) for requirement in requirements) | ||
return all(dependency_in_sync(requirement, environment, installed_distributions) for requirement in requirements) # type: ignore[arg-type] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This a real issue:
dependencies_in_sync
/dependency_in_sync
requireenvironment
to be adict[str, str]
:
hatch/backend/src/hatchling/cli/dep/core.py
Lines 123 to 124 in 7c8dbbc
def dependencies_in_sync( requirements: list[Requirement], sys_path: list[str] | None = None, environment: dict[str, str] | None = None packaging.markers.default_environment
returns anEnvironment
which is aTypedDict
Not sure how to best handle this. Change dependencies_in_sync
/dependency_in_sync
to expect Environment
or TypedDict
? Cast the result from default_environment
to a dict[str, str]
?
This will force all skips to include the error code, which makes them more readable, and avoids skipping something unintended.
This catches mistakes in using a value as truthy if it cannot be falsey.
6b89efd
to
830c25c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
No description provided.