Skip to content
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

Merged
merged 5 commits into from
Aug 17, 2024
Merged

Assorted MyPy improvments #1663

merged 5 commits into from
Aug 17, 2024

Conversation

DimitriPapadopoulos
Copy link
Contributor

No description provided.

@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as draft August 4, 2024 08:05
	Unused "type: ignore" comment  [unused-ignore]
Must not have show_error_codes. It is now the default.

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]
Copy link
Contributor Author

@DimitriPapadopoulos DimitriPapadopoulos Aug 7, 2024

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 require environment to be a dict[str, str]:
    def dependencies_in_sync(
    requirements: list[Requirement], sys_path: list[str] | None = None, environment: dict[str, str] | None = None
  • packaging.markers.default_environment returns an Environment which is a TypedDict

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]?

backend/src/hatchling/version/core.py Outdated Show resolved Hide resolved
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.
Copy link
Collaborator

@ofek ofek left a comment

Choose a reason for hiding this comment

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

Thank you!

@ofek ofek merged commit 551c26e into pypa:master Aug 17, 2024
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants