Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
I
importlib_metadata
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 10
    • Issues 10
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 3
    • Merge Requests 3
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • python-devs
  • importlib_metadata
  • Issues
  • #130

Closed
Open
Opened Sep 30, 2020 by sinoroc@sinoroc

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

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

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: python-devs/importlib_metadata#130