Skip to content

Commit

Permalink
avoid pkg_resources import if it can (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
isidentical authored Jul 22, 2021
1 parent 47c5ffa commit 925b616
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/flatten_dict/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import pkg_resources

from .flatten_dict import flatten, unflatten # noqa: F401


__all__ = ["flatten_dict", "reducer", "splitter"]
__version__ = pkg_resources.get_distribution("flatten-dict").version
__all__ = ["flatten", "unflatten", "splitter"]

try:
from importlib.metadata import distribution
except ImportError:
try:
from importlib_metadata import distribution
except ImportError:
from pkg_resources import get_distribution as distribution

__version__ = distribution("flatten-dict").version

0 comments on commit 925b616

Please sign in to comment.