MDAnalysis / MDAnalysisData

Access to data for workshops and extended tests of MDAnalysis.
https://www.mdanalysis.org/MDAnalysisData
BSD 3-Clause "New" or "Revised" License
14 stars 5 forks source link

update deprecated use of pkg_resources #75

Closed orbeckst closed 10 months ago

orbeckst commented 10 months ago

We use pkg_resources:

DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    from pkg_resources import resource_string

Use importlib instead, along the line of

import importlib.resources as importlib_resources

__all__ = ["DX", "CCP4", "gOpenMol"]

DX = importlib_resources.files(__name__) / 'test.dx'

(from https://github.com/MDAnalysis/GridDataFormats/blob/master/gridData/tests/datafiles/__init__.py where this was recently fixed)

IAlibay commented 10 months ago

I'm surprised, I thought that would have failed with Python 3.12 O.O!

orbeckst commented 10 months ago

It just versioneer... need to update.

orbeckst commented 10 months ago

Well, I am wrong: MDAnalysisData/base.py:from pkg_resources import resource_string