Skip to content

Commit

Permalink
drop the final remaining use of the deprecated pkg_resources module
Browse files Browse the repository at this point in the history
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: #577
  • Loading branch information
eli-schwartz committed Sep 16, 2024
1 parent 8ed9dc4 commit 7365022
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Python filesystem abstraction layer.
"""

__import__("pkg_resources").declare_namespace(__name__) # type: ignore
__path__ = __import__("pkgutil").extend_path(__path__, __name__)

from . import path
from ._fscompat import fsdecode, fsencode
Expand Down
2 changes: 1 addition & 1 deletion fs/opener/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

# Declare fs.opener as a namespace package
__import__("pkg_resources").declare_namespace(__name__) # type: ignore
__path__ = __import__("pkgutil").extend_path(__path__, __name__)

# Import opener modules so that `registry.install` if called on each opener
from . import appfs, ftpfs, memoryfs, osfs, tarfs, tempfs, zipfs
Expand Down

0 comments on commit 7365022

Please sign in to comment.