diff --git a/src/icartt/__init__.py b/src/icartt/__init__.py index 9edd2591e65fe79d51f29f69fbe2a4863b121ac7..d94e8e256ee46a2e640f2ed4ef0d6f93cfc02a89 100644 --- a/src/icartt/__init__.py +++ b/src/icartt/__init__.py @@ -1,5 +1,20 @@ from .dataset import Dataset, StandardNormalComments, Variable, Formats, VariableType -# TODO: add __version__ ? -# TODO: add __all__ = ("names of exported classes etc.",) ? \ No newline at end of file +def get_version(): + try: + # Python >= 3.8 + from importlib import metadata + + return metadata.version("icartt") + except ImportError: + # Python <= 3.7 + import pkg_resources + + return pkg_resources.get_distribution("icartt").version + + +__version__ = get_version() + + +# TODO: add __all__ = ("names of exported classes etc.",) ?