Skip to content

Commit

Permalink
Use importlib metadata version since setuptools pkg_resources is
Browse files Browse the repository at this point in the history
deprecated.
  • Loading branch information
glados-verma committed Oct 30, 2024
1 parent 2064831 commit 1556ff0
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions openhtf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
"""The main OpenHTF entry point."""

import importlib.metadata
import signal
import typing

Expand All @@ -36,7 +37,6 @@
from openhtf.util import functions
from openhtf.util import logs
from openhtf.util import units
import pkg_resources

__all__ = ( # Expliclty export certain API components.
# Modules.
Expand Down Expand Up @@ -133,12 +133,9 @@


def get_version():
"""Returns the version string of the 'openhtf' package.
Note: the version number doesn't seem to get properly set when using ipython.
"""
"""Returns the version string of the 'openhtf' package."""
try:
return pkg_resources.get_distribution('openhtf')
return importlib.metadata.version('openhtf')
except pkg_resources.DistributionNotFound:
return 'Unknown - Perhaps openhtf was not installed via setup.py or pip.'

Expand Down

0 comments on commit 1556ff0

Please sign in to comment.