Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/h5py/version.py: 17%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# This file is part of h5py, a Python interface to the HDF5 library.
2#
3# http://www.h5py.org
4#
5# Copyright 2008-2013 Andrew Collette and contributors
6#
7# License: Standard 3-clause BSD; see "license.txt" for full license terms
8# and contributor agreement.
10"""
11 Versioning module for h5py.
12"""
13from typing import Literal, NamedTuple
14from . import h5 as _h5
15import sys
16import numpy
18# All should be integers, except pre, as validating versions is more than is
19# needed for our use case
20class _H5PY_VERSION_CLS(NamedTuple):
21 major: int
22 minor: int
23 bugfix: int
24 pre: Literal["a", "b", "rc"] | None = None
25 post: int | None = None
26 dev: int | None = None
28 def __str__(self) -> str:
29 s = f"{self.major}.{self.minor}.{self.bugfix}"
30 if self.pre is not None:
31 s += self.pre
32 if self.post is not None:
33 s += f".post{self.post}"
34 if version_tuple.dev is not None:
35 s += f".dev{self.dev}"
36 return s
38hdf5_built_version_tuple = _h5.HDF5_VERSION_COMPILED_AGAINST
40# keep in sync with project.version (pyproject.toml)
41version_tuple = _H5PY_VERSION_CLS(major=3, minor=16, bugfix=0, dev=0)
42version = str(version_tuple)
44hdf5_version_tuple = _h5.get_libversion()
45hdf5_version = "%d.%d.%d" % hdf5_version_tuple
47api_version_tuple = (1,8)
48api_version = "%d.%d" % api_version_tuple
50info = """\
51Summary of the h5py configuration
52---------------------------------
54h5py %(h5py)s
55HDF5 %(hdf5)s
56Python %(python)s
57sys.platform %(platform)s
58sys.maxsize %(maxsize)s
59numpy %(numpy)s
60cython (built with) %(cython_version)s
61numpy (built against) %(numpy_build_version)s
62HDF5 (built against) %(hdf5_build_version)s
63""" % {
64 'h5py': version,
65 'hdf5': hdf5_version,
66 'python': sys.version,
67 'platform': sys.platform,
68 'maxsize': sys.maxsize,
69 'numpy': numpy.__version__,
70 'cython_version': _h5.CYTHON_VERSION_COMPILED_WITH,
71 'numpy_build_version': _h5.NUMPY_VERSION_COMPILED_AGAINST,
72 'hdf5_build_version': "%d.%d.%d" % hdf5_built_version_tuple,
73}