Skip to content

Conversation

@zachtheyek
Copy link

Summary

This PR fixes the deprecation warning about pkg_resources being slated for removal as early as 2025-11-30.

Changes

  • Replaced pkg_resources.get_distribution() with importlib.metadata.version()
  • Added fallback to importlib_metadata for Python < 3.8 to maintain backward compatibility
  • Updated exception handling from DistributionNotFound to PackageNotFoundError

Benefits

  • Eliminates the deprecation warning
  • Uses the modern, recommended approach for package metadata
  • Maintains backward compatibility with older Python versions

Testing

  • Verified no deprecation warning appears on import
  • Version detection continues to work as expected

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.
@zachtheyek
Copy link
Author

Full warning:

/home/zachy/miniconda3/envs/seti-ml/lib/python3.10/site-packages/blimpy/__init__.py:21: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from pkg_resources import get_distribution, DistributionNotFound

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.

1 participant