Skip to content

Add <PACKAGE>.__version__ functionality #27

@lawrenceabird

Description

@lawrenceabird

Add functionality to retrieve the "version" for the installed package.

Add this to the PACKAGE-level __init__.py

import importlib.metadata

try:
    __version__ = importlib.metadata.version("PACKAGE")
except importlib.metadata.PackageNotFoundError:
    __version__ = "0.0.0"

This pulls the version number from the pyproject.toml, so it's consistent with that used for a given release. If it's read from source (e.g. in development state), it falls back to "0.0.0"

Metadata

Metadata

Assignees

Labels

datapoolDefault label for ACCESS Cryosphere Data Pool Issues

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions