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

Update pypi.py #1559

wants to merge 6 commits into from

Conversation

fsecada01
Copy link

Fixes AssertionError in Python>=V3.9.6 with Pip>=22.0.1 at Line 455

Addresses AssertionError with Pip V>=22.0.1 on Python V>=3.9.6.

Contributor checklist
  • Provided the tests for the changes.
  • Assure PR title is short, clear, and good to be included in the user-oriented changelog
Maintainer checklist
  • Assure one of these labels is present: backwards incompatible, feature, enhancement, deprecation, bug, dependency, docs or skip-changelog as they determine changelog listing.
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

fsecada01 and others added 2 commits January 30, 2022 16:33
Fixes AssertionError in Python>=V3.9.6 with Pip>=22.0.1 at Line 455
@iflare3g
Copy link

iflare3g commented Jan 31, 2022

@fsecada01 Hey, there's a typo on line 453
It should be handlers and not handles, shouldn't be ? A missing r

@rsalmaso
Copy link

It seems that with pip>=22 pip-tools removes dash normalization https://pip.pypa.io/en/stable/news/#id73 even if it was done in pip==21.2 🙄

else:
for handler in logger.handlers:
if isinstance(handler, logging.StreamHandler):
handler.stream = log.stream
Copy link
Contributor

Choose a reason for hiding this comment

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

while this is expected to suppress the error, this would lead to not assigning log.stream to the relevant handler anymore as it's now a different type

fsecada01 and others added 3 commits February 2, 2022 09:52
Re-inserted handler assertions; included RichPipStreamHandler from pip internal logging module.  

Fix idea taken from: jazzband#1558 (comment)
@fsecada01
Copy link
Author

Seems like this pull request resolves the issue more effectively and passes all tests: #1567

I'll wait until the request is approved and merged so this PR can be closed.

Comment on lines +455 to +458
try:
assert isinstance(handler, logging.StreamHandler)
except Exception:
assert isinstance(handler, RichPipStreamHandler)
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))

@fsecada01 fsecada01 deleted the patch-1 branch February 4, 2022 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants