diff --git a/lower-constraints.txt b/lower-constraints.txt index a857357..2ced6ac 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -2,6 +2,7 @@ coverage===4.0 ddt===1.0.1 dulwich===0.15.0 elasticsearch===2.0.0 +importlib_metadata==1.7.0 jaeger-client==3.8.0 netaddr===0.7.18 openstackdocstheme==2.2.1 diff --git a/osprofiler/__init__.py b/osprofiler/__init__.py index 22bedd3..e9adf59 100644 --- a/osprofiler/__init__.py +++ b/osprofiler/__init__.py @@ -13,6 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. -import pkg_resources +try: + # For Python 3.8 and later + import importlib.metadata as importlib_metadata +except ImportError: + # For everyone else + import importlib_metadata -__version__ = pkg_resources.get_distribution("osprofiler").version +__version__ = importlib_metadata.version("osprofiler") diff --git a/requirements.txt b/requirements.txt index 2239282..7719bc4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ PrettyTable<0.8,>=0.7.2 # BSD requests>=2.14.2 # Apache-2.0 six>=1.10.0 # MIT WebOb>=1.7.1 # MIT +importlib_metadata>=1.7.0;python_version<'3.8' # Apache-2.0