Skip to content

Module 'distro' has no '__version__' member #265

Closed

Description

@AdnanHodzic

As it's case with most Python packages, if you run i.e:

print("psutil version:", psutil.__version__)

you'll end up getting package version, i.e: psutil: 5.7.2

However, if I do the same for distro package, i.e:

print("distro:", distro.__version__)

I'll immediately get Module 'distro' has no '__version__' member

Would it be possible to add this functionality in one of the future versions instead of having to resort to hacks/workarounds in order to print distro package version as part of a Python app.

Thanks!

Activity

  1. jdufresne commented on Jul 1, 2021

    @jdufresne
    Member

    The modern way to do this is with importlib.metadata.

    >>> from importlib.metadata import version
    >>> version('distro')
    '1.5.0'
    
  2. jdufresne commented on Jul 2, 2021

    @jdufresne
    Member

    Thanks for the report. Resolved in a3da4d4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions