Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

musicinmybrain
Copy link

Fixes #67.

See: https://packaging.pypa.io/en/stable/version.html

I used 14.1 as the minimum version since that’s when the packaging.version.parse API was introduced. I doubt there will be a need to use such an old version in practice.

@sanjayankur31
Copy link

Hi @wmayner : would it be possible to please include this fix and cut a new release? One can't run pytest at the latest HEAD for example:

pyemd(develop =)]$ pytest
============================================================================ test session starts ============================================================================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0 -- /home/asinha/.local/share/virtualenvs/pyemd/bin/python
cachedir: .pytest_cache
rootdir: /home/asinha/Documents/02_Code/01_others/pyemd
configfile: pytest.ini
collected 1 item / 2 errors

================================================================================== ERRORS ===================================================================================
____________________________________________________________________ ERROR collecting test/test_pyemd.py ____________________________________________________________________
ImportError while importing test module '/home/asinha/Documents/02_Code/01_others/pyemd/test/test_pyemd.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../.local/share/virtualenvs/pyemd/lib/python3.13/site-packages/_pytest/python.py:493: in importtestmodule
    mod = import_path(
../../../../.local/share/virtualenvs/pyemd/lib/python3.13/site-packages/_pytest/pathlib.py:587: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../.local/share/virtualenvs/pyemd/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:185: in exec_module
    exec(co, module.__dict__)
test/test_pyemd.py:9: in <module>
    from pyemd import emd, emd_samples, emd_with_flow
../../../../.local/share/virtualenvs/pyemd/lib64/python3.13/site-packages/pyemd/__init__.py:74: in <module>
    from .emd import emd, emd_with_flow, emd_samples
src/pyemd/emd.pyx:6: in init pyemd.emd
    from pkg_resources import parse_version
E   ModuleNotFoundError: No module named 'pkg_resources'
____________________________________________________________________ ERROR collecting test/test_pyemd.py ____________________________________________________________________
ImportError while importing test module '/home/asinha/Documents/02_Code/01_others/pyemd/test/test_pyemd.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../.local/share/virtualenvs/pyemd/lib/python3.13/site-packages/_pytest/python.py:493: in importtestmodule
    mod = import_path(
../../../../.local/share/virtualenvs/pyemd/lib/python3.13/site-packages/_pytest/pathlib.py:587: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../.local/share/virtualenvs/pyemd/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:185: in exec_module
    exec(co, module.__dict__)
test/test_pyemd.py:9: in <module>
    from pyemd import emd, emd_samples, emd_with_flow
../../../../.local/share/virtualenvs/pyemd/lib64/python3.13/site-packages/pyemd/__init__.py:74: in <module>
    from .emd import emd, emd_with_flow, emd_samples
src/pyemd/emd.pyx:6: in init pyemd.emd
    from pkg_resources import parse_version
E   ModuleNotFoundError: No module named 'pkg_resources'
========================================================================== short test summary info ==========================================================================
ERROR test/test_pyemd.py
ERROR test/test_pyemd.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 2 errors in 0.30s =============================================================================

@musicinmybrain
Copy link
Author

Revised based on @SpecLad’s suggestion in #69 (comment): rather than adding a dependency on packaging, we can use np.lib.NumpyVersion to compare NumPy versions.

@musicinmybrain musicinmybrain changed the title Switch from deprecated pkg_resources to packaging Stop using from deprecated pkg_resources Jun 16, 2025
Use NumPy’s own `np.lib.NumpyVersion` to test NumPy versions.

Fixes wmayner#67
@musicinmybrain musicinmybrain changed the title Stop using from deprecated pkg_resources Stop using deprecated pkg_resources Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeprecationWarning: pkg_resources is deprecated as an API
3 participants