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

Update pypi.py #1559

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions piptools/repositories/pypi.py
Expand Up @@ -31,7 +31,7 @@
from pip._internal.req import InstallRequirement, RequirementSet
from pip._internal.req.req_tracker import get_requirement_tracker
from pip._internal.utils.hashes import FAVORITE_HASH
from pip._internal.utils.logging import indent_log, setup_logging
from pip._internal.utils.logging import RichPipStreamHandler, indent_log, setup_logging
from pip._internal.utils.misc import normalize_path
from pip._internal.utils.temp_dir import TempDirectory, global_tempdir_manager
from pip._internal.utils.urls import path_to_url, url_to_path
Expand Down Expand Up @@ -452,7 +452,10 @@ def _setup_logging(self) -> None:
logger = logging.getLogger()
for handler in logger.handlers:
if handler.name == "console": # pragma: no branch
assert isinstance(handler, logging.StreamHandler)
try:
assert isinstance(handler, logging.StreamHandler)
except Exception:
assert isinstance(handler, RichPipStreamHandler)
Comment on lines +455 to +458
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try:
assert isinstance(handler, logging.StreamHandler)
except Exception:
assert isinstance(handler, RichPipStreamHandler)
assert isinstance(handler, (logging.StreamHandler, RichPipStreamHandler))

handler.stream = log.stream
break
else: # pragma: no cover
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -33,7 +33,7 @@ install_requires =
# direct dependencies
click >= 7
pep517
pip >= 21.2
pip >= 22.0.2
# indirect dependencies
setuptools # typically needed when pip-tools invokes setup.py
wheel # pip plugin needed by pip-tools
Expand Down