Skip to content

Commit bc10594

Browse files
bendichterrlypre-commit-ci[bot]
authored
assign a filler to __version__ if it cannot be imported (#907)
Co-authored-by: Ryan Ly <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 19c56f6 commit bc10594

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/hdmf/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ def get_region_slicer(**kwargs):
3131
# see https://effigies.gitlab.io/posts/python-packaging-2023/
3232
from ._version import __version__
3333
except ImportError: # pragma: no cover
34-
pass
34+
# this is a relatively slower method for getting the version string
35+
from importlib.metadata import version # noqa: E402
36+
37+
__version__ = version("hdmf")
38+
del version
3539

3640

3741
from ._due import BibTeX, due # noqa: E402

0 commit comments

Comments
 (0)