Skip to content

Fix pkg_resources import on setuptools >=81 and modernize Python support#238

Merged
koldunovn merged 5 commits into
mainfrom
fix/setuptools81-pkg-resources
May 12, 2026
Merged

Fix pkg_resources import on setuptools >=81 and modernize Python support#238
koldunovn merged 5 commits into
mainfrom
fix/setuptools81-pkg-resources

Conversation

@pgierz
Copy link
Copy Markdown
Member

@pgierz pgierz commented May 12, 2026

Summary

  • Replaces pkg_resources (removed in setuptools 81) with stdlib importlib.resources.files in pyfesom2/ut.py. Resolves the ModuleNotFoundError: No module named 'pkg_resources' reported in ModuleNotFoundError: No module named 'pkg_resources' for python 3.12.13 and setuptools 82.0.1 #236 on Python 3.12 + setuptools 82.0.1.
  • Modernizes Python version support to 3.9-3.13: extends CI matrix, drops obsolete python<=3.9 / scipy<=1.9 / fsspec==2021.06.1 pins in the CI env file, renames ci/requirements-py37.yml -> ci/requirements.yml, and updates Dockerfile/README/docs/setup.py/tox.ini/CONTRIBUTING accordingly.

CI previously could not have caught #236 because the env file pinned python<=3.9 regardless of the matrix.python-version value, so all jobs effectively ran on Python 3.9 (where pkg_resources still ships).

Split into two commits so the bug fix can be cherry-picked independently of the modernization sweep.

Fixes #236

Test plan

  • CI green across 3.9-3.13 on ubuntu/macos/windows
  • python -c "import pyfesom2" succeeds with setuptools >=81
  • get_mask works for MOCBasins, NinoRegions, oceanBasins regions
  • Docker build works against renamed ci/requirements.yml

pgierz added 5 commits May 12, 2026 11:39
setuptools >=81 no longer ships pkg_resources, breaking import of
pyfesom2.ut on Python 3.12 + setuptools 82.0.1 envs. Switch to stdlib
importlib.resources.files for locating bundled geojson data.

Fixes #236
- CI matrix: 3.9, 3.10, 3.11, 3.12, 3.13 (was 3.8-3.10)
- Drop python<=3.9 and scipy<=1.9 pins from CI env so matrix value
  actually takes effect via micromamba create-args
- Drop fsspec==2021.06.1 pin
- Rename ci/requirements-py37.yml -> ci/requirements.yml and update
  all refs (Dockerfile, README, docs/installation.rst, workflows)
- setup.py classifiers, CONTRIBUTING.rst, tox.ini, ci/requirements_doc.yml
  updated to current Python versions

CI previously could not catch issues like #236 because the env file
pinned python<=3.9 regardless of the matrix value.
- read_csv(delim_whitespace=True) removed in pandas 2.2; use sep=r"\s+"
- date_range freq alias 'M' replaced by 'ME' (MonthEnd)

Surfaced by CI matrix extension to Python 3.11-3.13, which pulls in
pandas >=2.2.
Add pytest-github-actions-annotate-failures plugin so failing
assertions surface as inline annotations on PRs (Files Changed +
Checks tab) instead of buried in raw log output.
@koldunovn koldunovn merged commit 6767056 into main May 12, 2026
16 checks passed
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.

ModuleNotFoundError: No module named 'pkg_resources' for python 3.12.13 and setuptools 82.0.1

2 participants