Add __version__ identifier

- `lalib.__version__` is dynamically assigned
- the format is "x.y.z[.dev0|aN|bN|rcN|.postM]"
  where x, y, z, M, and N are non-negative integers
  + x, y, and z model the "major", "minor", and "patch"
    parts of semantic versioning
    (See: https://semver.org/#semantic-versioning-200)
  + M is a single digit and N either 1 or 2
  => This complies with (a strict subset of) PEP440
- add unit tests for the `__version__` identifier
This commit is contained in:
Alexander Hess 2024-09-10 01:45:47 +02:00
commit 4100a7f3f5
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
6 changed files with 647 additions and 3 deletions

View file

@ -1 +1,19 @@
"""A Python library to study linear algebra."""
from importlib import metadata
try:
pkg_info = metadata.metadata(__name__)
except metadata.PackageNotFoundError:
__pkg_name__ = "unknown"
__version__ = "unknown"
else:
__pkg_name__ = pkg_info["name"]
__version__ = pkg_info["version"]
del pkg_info
del metadata