Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg_resources: Expose the type of imports and re-exports #4242

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,32 @@
# no write support, probably under GAE
WRITE_SUPPORT = False

from pkg_resources.extern.jaraco.text import (
yield_lines,
drop_comment,
join_continuation,
)
from pkg_resources.extern.packaging import markers as _packaging_markers
from pkg_resources.extern.packaging import requirements as _packaging_requirements
from pkg_resources.extern.packaging import utils as _packaging_utils
from pkg_resources.extern.packaging import version as _packaging_version
from pkg_resources.extern.platformdirs import user_cache_dir as _user_cache_dir

if TYPE_CHECKING:
from _typeshed import StrPath

# Replicates the imports below in a way that can be understood by type-checkers
from jaraco.text import (
yield_lines,
drop_comment,
join_continuation,
)
from packaging import markers as _packaging_markers
from packaging import requirements as _packaging_requirements
from packaging import utils as _packaging_utils
from packaging import version as _packaging_version
from platformdirs import user_cache_dir as _user_cache_dir
else:
from pkg_resources.extern.jaraco.text import (
yield_lines,
drop_comment,
join_continuation,
)
from pkg_resources.extern.packaging import markers as _packaging_markers
from pkg_resources.extern.packaging import requirements as _packaging_requirements
from pkg_resources.extern.packaging import utils as _packaging_utils
from pkg_resources.extern.packaging import version as _packaging_version
from pkg_resources.extern.platformdirs import user_cache_dir as _user_cache_dir

warnings.warn(
"pkg_resources is deprecated as an API. "
"See https://setuptools.pypa.io/en/latest/pkg_resources.html",
Expand Down
Loading