-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Make importlib_metadata._meta.SimplePath
public
#494
Comments
importlib_metadata._meta.SimplePath
importlib_metadata._meta.SimplePath
public
🤔 actually, since |
I don't, I think it should be exposed.
That might be fine in your particular use-case, but if you want to annotate a public API that consumes |
Oh, I see it's already exposed; it's just not listed in |
Remove type ignore only needed for Python 3.7 or less, since we've dropped support for Python 3.7. Fix error on return type for stubbed out function, the error was: tests/utils.py:40: error: Return type "PathLike[str]" of "locate_file" incompatible with return type "Path" in supertype "Distribution" [override] This `SimplePath` isn't exported (but should be in the future[1]) but it's just a protocol implementing some bits of `pathlib.Path`[2] so drop that in instead. [1] python/importlib_metadata#494 [2] https://github.com/python/cpython/blob/69a4063ca516360b5eb96f5432ad9f9dfc32a72e/Lib/importlib/metadata/_meta.py#L47
Remove type ignore only needed for Python 3.7 or less, since we've dropped support for Python 3.7. Fix error on return type for stubbed out function, the error was: tests/utils.py:40: error: Return type "PathLike[str]" of "locate_file" incompatible with return type "Path" in supertype "Distribution" [override] This `SimplePath` isn't exported (but should be in the future[1]) but it's just a protocol implementing some bits of `pathlib.Path`[2] so drop that in instead. [1] python/importlib_metadata#494 [2] https://github.com/python/cpython/blob/69a4063ca516360b5eb96f5432ad9f9dfc32a72e/Lib/importlib/metadata/_meta.py#L47
I see this class is documented https://importlib-metadata.readthedocs.io/en/latest/api.html#importlib_metadata._meta.SimplePath but the fact it is under the
._meta
package, which looks private at a glance, makes me wonder: is is supported for me to access this, is its API as stable as any other part of the package? Additionally (if the answer is yes): could this class just be re-exported byimportlib_metadata
to avoid this need for access to._meta
?My use case is: I have a class that sub-classes
Distribution
and need to annotate the return value forlocate_file
which should be one of theseSimplePath
s, and asking here because this appears to be the origin of the class, with it being added upstream from here: python/cpython@667294dThe text was updated successfully, but these errors were encountered: