From 1148c1e6821018fb412c663978978158fa6bd197 Mon Sep 17 00:00:00 2001 From: "Angeline G. Burrell" Date: Thu, 5 Oct 2023 10:49:15 -0400 Subject: [PATCH] BUG: fixed init metadata Fixed init metadata by: - moving all imports to top, and - robustly importing metadata submodule. --- pysatNASA/__init__.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pysatNASA/__init__.py b/pysatNASA/__init__.py index ea9f8ff2..2d3bc1c3 100644 --- a/pysatNASA/__init__.py +++ b/pysatNASA/__init__.py @@ -6,15 +6,12 @@ """ -import importlib -import importlib_metadata +try: + from importlib import metadata +except ImportError: + import importlib_metadata as metadata from pysatNASA import constellations # noqa F401 from pysatNASA import instruments # noqa F401 -# set version -try: - __version__ = importlib.metadata.version('pysatNASA') -except AttributeError: - # Python 3.6 requires a different version - __version__ = importlib_metadata.version('pysatNASA') +__version__ = metadata.version('pysatNASA')