From ebb74ec435402fd1f3f00e160f639256bac9172e Mon Sep 17 00:00:00 2001 From: Matthew Avaylon Date: Wed, 6 Mar 2024 13:57:13 -0800 Subject: [PATCH] Update __init__.py --- src/pynwb/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index 5e29caede..607fe6a9e 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -391,8 +391,15 @@ def export(self, **kwargs): from hdmf.data_utils import DataChunkIterator # noqa: F401,E402 from hdmf.backends.hdf5 import H5DataIO # noqa: F401,E402 -from . import _version # noqa: F401,E402 -__version__ = _version.get_versions()['version'] +try: + # see https://effigies.gitlab.io/posts/python-packaging-2023/ + from ._version import __version__ +except ImportError: # pragma: no cover + # this is a relatively slower method for getting the version string + from importlib.metadata import version # noqa: E402 + + __version__ = version("pynwb") + del version from ._due import due, BibTeX # noqa: E402 due.cite(