Skip to content

Should one use this library or the one from Python's standard library? #130

@jaraco

Description

@jaraco

In GitLab by @sinoroc on Sep 30, 2020, 10:00

This is not an issue report, it is a question. Hopefully it is acceptable to ask it here, otherwise please redirect me to the appropriate venue...

In order to avoid the try-import-except-import dance, I am considering simply using this library for all Python versions that my project supports (Python 3.5 to 3.8, potentially 3.9), instead of importlib.metadata from the standard library where available. Is that an acceptable thing to do, any drawback one should be aware of?

On one side, one can read:

Users of Python 3.8 and beyond are encouraged to use the standard library module. When imported on Python 3.8 and later, importlib_metadata replaces the DistributionFinder behavior from the stdlib, but leaves the API in tact.

-- https://importlib-metadata.readthedocs.io/en/latest/

On the other:

This functionality is provisional and may deviate from the usual version semantics of the standard library.

-- https://docs.python.org/3/library/importlib.metadata.html

This is a bit confusing. What does that mean? What are more concretely the pros and cons of using one or the other?

Is there a way to know which version of importlib-metadata is in which version of Python (if that makes sense)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions