Repository navigation
Fix/pkg resources deprecation ci - #282
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builds on #281 (keeping its commit and author unchanged) to replace the deprecated
pkg_resourceswithimportlib.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 onmaster,import blimpynow fails withModuleNotFoundErrorin any fresh environment.Changes
blimpy/__init__.pyreads__version__throughimportlib.metadata, falling back toimportlib_metadataon Python < 3.8.importlib_metadata; python_version < "3.8"inrequirements.txt. The fallback above imports it, but it was never listed.tests/test_version.pychecks that__version__matches the installed metadata, and that importing blimpy in a fresh interpreter doesn't touchpkg_resources.mastertoo):setup.py testwas removed in setuptools 72. Usepip install .andpython3 -m pytestinstead, and move from the end-of-lifeubuntu:20.04toubuntu:22.04.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 onubuntu-latest), and addfail-fast: false. Bumpactions/checkout@v4,actions/setup-python@v5andcodecov/codecov-action@v4.setup_requires=['pytest-runner'],tests_requireandtest_suite(which pointed to a nonexistent package).[aliases] testblock and thedescription-filekey fromsetup.cfg; setuptools flags that key as an overdue deprecation.pytest-runnerfromrequirements_test.txt.README.mdandMAINTENANCE.mdnow usepip install ..VERSION-HISTORY.mdentry.Testing
Run locally on macOS with Python 3.9 and setuptools 82.0.1:
python -W default -c "import blimpy"prints nopkg_resourceswarning, and__version__is2.1.5.tests/test_version.pyfails againstmaster's__init__.py(ModuleNotFoundError: pkg_resources) and passes on this branch.tests/test_ephemeris.pywith "This method requires pySLALIB". They happen becausepyslalibneeds gfortran, which this machine doesn't have. CI and Docker install gfortran throughdependencies.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.ymlandpush_docker.ymlstill use old actions andsetup.py sdist bdist_wheel. They need secrets, so they couldn't be checked here.tests/test_fil2h5.pyandtests/test_h52fil.pyleave a ~64 MB file namedtestin the working directory.except:around the submodule imports inblimpy/__init__.pyhides real import errors.Closes #281 if merged in its place.
🤖 Generated with Claude Code