Skip to content

Fix/pkg resources deprecation ci - #282

Merged
akshaysuresh1 merged 8 commits into
masterfrom
fix/pkg-resources-deprecation-ci
Oct 29, 2026
Merged

akshaysuresh1 merged 8 commits into
masterfrom
fix/pkg-resources-deprecation-ci

Conversation

@akshaysuresh1

Copy link
Copy Markdown
Contributor

Summary

Builds on #281 (keeping its commit and author unchanged) to replace the deprecated pkg_resources with importlib.metadata. It also fixes CI so the change can be merged.

This is more urgent than a warning cleanup. setuptools 82 has removed pkg_resources, so on master, import blimpy now fails with ModuleNotFoundError in any fresh environment.

Changes

  • Replace deprecated pkg_resources with importlib.metadata #281 (cherry-picked): blimpy/__init__.py reads __version__ through importlib.metadata, falling back to importlib_metadata on Python < 3.8.
  • Missing dependency: declare importlib_metadata; python_version < "3.8" in requirements.txt. The fallback above imports it, but it was never listed.
  • Tests: new tests/test_version.py checks that __version__ matches the installed metadata, and that importing blimpy in a fresh interpreter doesn't touch pkg_resources.
  • Docker build (failing on master too): setup.py test was removed in setuptools 72. Use pip install . and python3 -m pytest instead, and move from the end-of-life ubuntu:20.04 to ubuntu:22.04.
  • Test matrix: the key was misspelled python-verison, so every "3.7/3.8/3.9" job actually ran the runner's default Python. Fix the key, test 3.8 to 3.12 (3.7 is no longer available on ubuntu-latest), and add fail-fast: false. Bump actions/checkout@v4, actions/setup-python@v5 and codecov/codecov-action@v4.
  • Packaging cleanup:
    • Remove setup_requires=['pytest-runner'], tests_require and test_suite (which pointed to a nonexistent package).
    • Remove the [aliases] test block and the description-file key from setup.cfg; setuptools flags that key as an overdue deprecation.
    • Remove pytest-runner from requirements_test.txt.
    • Add Python 3.8 to 3.12 classifiers.
  • Docs: install instructions in README.md and MAINTENANCE.md now use pip install ..
  • Release: bump the version to 2.1.5 and add a VERSION-HISTORY.md entry.

Testing

Run locally on macOS with Python 3.9 and setuptools 82.0.1:

  • python -W default -c "import blimpy" prints no pkg_resources warning, and __version__ is 2.1.5.
  • tests/test_version.py fails against master's __init__.py (ModuleNotFoundError: pkg_resources) and passes on this branch.
  • Full suite with the downloaded test data: 82 passed, 2 failed. Both failures are in tests/test_ephemeris.py with "This method requires pySLALIB". They happen because pyslalib needs gfortran, which this machine doesn't have. CI and Docker install gfortran through dependencies.txt.

The Docker image and the Python 3.8 to 3.12 matrix are checked by this PR's CI runs.

Follow-ups (not in this PR)

  • pythonpublish.yml and push_docker.yml still use old actions and setup.py sdist bdist_wheel. They need secrets, so they couldn't be checked here.
  • tests/test_fil2h5.py and tests/test_h52fil.py leave a ~64 MB file named test in the working directory.
  • The bare except: around the submodule imports in blimpy/__init__.py hides real import errors.

Closes #281 if merged in its place.

🤖 Generated with Claude Code

zachtheyek and others added 8 commits October 27, 2026 01:18
Fixes deprecation warning about pkg_resources being slated for removal.
Uses importlib.metadata (Python 3.8+) with fallback to importlib_metadata
for older Python versions to maintain backward compatibility.
The importlib.metadata change falls back to the importlib_metadata
backport on Python < 3.8, so declare it with an environment marker.

Add tests that __version__ comes from the installed metadata and that
importing blimpy no longer touches pkg_resources, which setuptools 82
removed outright.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setuptools 72 removed the `setup.py test` command, which broke the
Test Dockerfile workflow on master as well. Install with pip and run
pytest directly, and move off the end-of-life ubuntu:20.04 base image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setup_requires/pytest-runner, tests_require, test_suite and the
`[aliases] test` alias only served the removed `setup.py test`
command; test_suite also named a nonexistent package. Drop the
dash-separated `description-file` key, which setuptools flags as an
overdue deprecation and which duplicates long_description in setup.py.
List the Python versions now exercised in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The matrix key was misspelled `python-verison`, so every job silently
ran the runner's default Python instead of the listed version. Fix the
key and test 3.8-3.12; 3.7 is no longer available on ubuntu-latest.
Use the setup-python interpreter with pip instead of the deprecated
`setup.py install`, bump checkout/setup-python/codecov actions off
their deprecated Node runtimes, and point docs at `pip install .`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dsamp wrote its result with the heavy HDF5 writer, which ignores
wf.data and re-reads blobs from the original input file. The .h5
output therefore held the first n raw time samples rather than the
downsampled sums. It looped over the input file's blob count, so it
also wrote into empty slices past the end of the output; h5py <= 3.14
silently ignored that, h5py 3.16 raises TypeError, which failed
test_dsamp on Python 3.10+.

Write the in-memory result with the light writer, and assert in the
tests that the .h5 output equals the downsampled sums.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pyslalib has no wheel for Python 3.10, and its meson-python source
build failed with `meson executable "meson" not found` under Ubuntu
22.04's patched pip 22.0.2. Upgrade pip first, matching the Python
test workflow, where the same build succeeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@akshaysuresh1
akshaysuresh1 merged commit 4dd6414 into master Oct 29, 2026
12 checks passed
@akshaysuresh1
akshaysuresh1 deleted the fix/pkg-resources-deprecation-ci branch October 29, 2026 21:59
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.

2 participants