amuse icon indicating copy to clipboard operation
amuse copied to clipboard

pkg_resources is deprecated

Open LourensVeen opened this issue 7 months ago • 1 comments

We seem to be using pkg_resources somewhere for something, and we've been getting warnings about it being deprecated for several years, but it seems like there's a deadline now:

../../../../../miniconda3/envs/test/lib/python3.12/site-packages/amuse/support/options.py:11 /Users/runner/miniconda3/envs/test/lib/python3.12/site-packages/amuse/support/options.py:11: 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. import pkg_resources

We're now using hatchling instead of setuptools, although I'm not sure if that's relevant. At any rate, we should investigate what this is used for, whether we need that still, and if so, what the new way of doing that is.

LourensVeen avatar Jun 10 '25 12:06 LourensVeen

As far as I can see, the only use of pkg_resources is in src/amuse/support/options.py and since it is accessed as:

try:
    import pkg_resources
except ImportError:
    pkg_resources = None

it looks like the code can already handle the case when pkg_resources is not available. If necessary, the replacement could be importlib.resources , see https://docs.python.org/3.11/library/importlib.resources.html

DavidJJansen avatar Oct 22 '25 15:10 DavidJJansen