Skip to content

Commit

Permalink
sort out pkg_resources deprecation using importlib.metadata (requires…
Browse files Browse the repository at this point in the history
… Python 3.8) (#1194)
  • Loading branch information
slayoo authored Dec 5, 2023
1 parent 22943cc commit 91e44a5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests+artifacts+pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ jobs:
with:
python-version: 3.9
- run: |
pip install pdoc3
pip install -e .
pip install -e examples
pip install pdoc3 setuptools==58.1.0
pip install -e . setuptools==58.1.0
pip install -e examples setuptools==58.1.0
python -We -m pdoc --html PySDM examples/PySDM_examples
python -We .github/workflows/pdoc_index_workaround.py
- if: ${{ github.ref == 'refs/heads/main' && matrix.platform == 'ubuntu-latest' }}
Expand Down
6 changes: 3 additions & 3 deletions PySDM/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
[tests package](https://github.com/open-atmos/PySDM/tree/master/tests).
"""

from pkg_resources import DistributionNotFound, VersionConflict, get_distribution
from importlib.metadata import PackageNotFoundError, version

from . import environments, exporters, products
from .builder import Builder
from .formulae import Formulae
from .particulator import Particulator

try:
__version__ = get_distribution(__name__).version
except (DistributionNotFound, VersionConflict):
__version__ = version(__name__)
except PackageNotFoundError:
# package is not installed
pass
6 changes: 3 additions & 3 deletions examples/PySDM_examples/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
PySDM_examples package includes common Python modules used in PySDM smoke tests
and in example notebooks (but the package wheels do not include the notebooks)
"""
from pkg_resources import DistributionNotFound, VersionConflict, get_distribution
from importlib.metadata import PackageNotFoundError, version

try:
__version__ = get_distribution(__name__).version
except (DistributionNotFound, VersionConflict):
__version__ = version(__name__)
except PackageNotFoundError:
# package is not installed
pass
2 changes: 1 addition & 1 deletion examples/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_long_description():
setup_requires=["setuptools_scm"],
install_requires=[
"PySDM",
"PyMPDATA",
"PyMPDATA" + ">=1.0.15" if CI else "",
"open-atmos-jupyter-utils",
"pystrict",
"matplotlib" + "<3.8.0" if CI else "", # TODO #1142
Expand Down

0 comments on commit 91e44a5

Please sign in to comment.