pyfilesystem2
pyfilesystem2 copied to clipboard
drop the final remaining use of the deprecated pkg_resources module
Declaring a namespace package has gone through a few revisions. pkg_resources has a version that is heavily deprecated. pkgutil provides a python2/python3 compatible version that is also compatible with native python3 namespaces.
https://packaging.python.org/en/latest/guides/packaging-namespace-packages/
pkg_resources is very very deprecated and importing or using it results in deprecation warnings. It's time to move off of it entirely.
Fixes: https://github.com/PyFilesystem/pyfilesystem2/issues/577
Depends on: https://github.com/PyFilesystem/pyfilesystem2/pull/589
Given the deprecation warning suggests pkg_resources will be removed november this year, are we able to renew the push for this again? :)
lib/python3.12/site-packages/fs/__init__.py:4: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resour
ces.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.
I haven't given up on this PR by the way -- I am not aware of any issues with it though, so I'm just waiting for someone with commit access to review...
@willmcgugan Can this be reviewed and merged?
Depends on: #589
merged both branches in pkg-resources-part-1-and-2
edit: now this also includes #588
pkg_resources is still used in tests/test_opener.py
this makes the test fail with
NameError: name 'pkg_resources' is not defined
def test_repr(self):
# Check __repr__ works
for entry_point in pkg_resources.iter_entry_points("fs.opener"):
_opener = entry_point.load()
repr(_opener())
fixed in https://github.com/milahu/pyfilesystem2/commit/70dc40dae57bbdb579f42cff30cb993a674018a0
@milahu please see all my pending PRs, not just two of them. There is a third that fixes that in a very different way than the one you propose.
ok, so this pr depends on #588 and #589