Skip to content

Commit

Permalink
use pkg_resources instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaojieqiu committed Apr 14, 2022
1 parent fb0c4a0 commit 0938cd2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 7 additions & 3 deletions dynamo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
"""Mapping Vector Field of Single Cells
"""

from .get_version import get_version
# from .get_version import get_version, get_dynamo_version
#
# __version__ = get_version(__file__)
# del get_version

__version__ = get_version(__file__)
del get_version
from .get_version import get_dynamo_version

__version__ = get_dynamo_version()

from . import pp
from . import est
Expand Down
10 changes: 9 additions & 1 deletion dynamo/get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,18 @@ def get_version(package: Union[Path, str]) -> str:
get_version_from_dirname(name, parent)
or get_version_from_git(parent)
or get_version_from_metadata(name, parent)
or "0.0.0"
or get_dynamo_version()
)


def get_dynamo_version():
import pkg_resources

_package_name = "dynamo-release"
_package = pkg_resources.working_set.by_key[_package_name]
return _package.version


def get_all_dependencies_version(display=True):
"""
Adapted from answer 2 in
Expand Down

0 comments on commit 0938cd2

Please sign in to comment.