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

Avoid get on PackageMetadata in FastAPI template #163

Merged
merged 1 commit into from
May 2, 2022
Merged

Conversation

rra
Copy link
Member

@rra rra commented May 2, 2022

The current mypy plus typeshed plus the Python 3.10 core library
has a bug causing mypy to not think get is a valid method on the
return value of importlib.metadata.metadata because it returns a
Protocol that doesn't implement get. I've filed a issue in case
this is not intended (python/typeshed#7767),
but we know that any package created by this template will always
have Summary and Version metadata, so we can use them
unconditionally.

Previously, this may not have worked in situations where the
package was being used uninstalled, but since we now do everything
including local development servers from inside tox, and make init
also installs the package for running pytest directly, this should
no longer be an issue. setuptools_scm should always generate a
version, even if it's an unuseful one.

The current mypy plus typeshed plus the Python 3.10 core library
has a bug causing mypy to not think get is a valid method on the
return value of importlib.metadata.metadata because it returns a
Protocol that doesn't implement get.  I've filed a issue in case
this is not intended (python/typeshed#7767),
but we know that any package created by this template will always
have Summary and Version metadata, so we can use them
unconditionally.

Previously, this may not have worked in situations where the
package was being used uninstalled, but since we now do everything
including local development servers from inside tox, and make init
also installs the package for running pytest directly, this should
no longer be an issue.  setuptools_scm should always generate a
version, even if it's an unuseful one.
@rra rra requested a review from jonathansick May 2, 2022 18:23
@jonathansick
Copy link
Member

That's interesting. Thanks for filing the upstream ticket; but I agree that this is fine as a long-term solution too.

@rra rra merged commit 887b386 into main May 2, 2022
@rra rra deleted the u/rra/upgrades branch May 2, 2022 19:11
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.

2 participants