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

RichHandler Inheritance Issue #10871

Closed
1 task done
AndTheDaysGoBy opened this issue Feb 1, 2022 · 2 comments
Closed
1 task done

RichHandler Inheritance Issue #10871

AndTheDaysGoBy opened this issue Feb 1, 2022 · 2 comments
Labels
resolution: wrong project Should be reported elsewhere

Comments

@AndTheDaysGoBy
Copy link

Description

I was recently trying to use pip-tools to generate a requirements.txt. This failed, debugging yielded that the issue lied in

venv/lib/python3.8/site-packages/piptools/repositories/pypi.py", line 455, in _setup_logging
    assert isinstance(handler, logging.StreamHandler)

Apparently, the RichPipStreamHandler was no longer being recognized as a type StreamHandler.

In particular, this issue only arose from pip==22.0 onwards, this was not present in pip==21.3.1.

I'm using Python 3.8, for reference.

Expected behavior

For the RichStreamHandler to be see as an instance of type StreamHandler such that the assert succeeds.

pip version

22.0+

Python version

3.8

OS

Linux (Tried on CENTOS and Mint)

How to Reproduce

  1. Create a virtual environment.
  2. pip -U install pip==22.0 or 22+
  3. pip install pip-tools or anything that might use the RichStreamHandler
  4. For this case, pip-compile -r requirements.in where we have echo "connexion2 > requirements.in for example.
  5. It'll error on the assert is instance of.

Output

Traceback (most recent call last):
  File "venv/bin/pip-compile", line 8, in <module>
    sys.exit(cli())
  File "venv/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "venv/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "venv/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "venv/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "venv/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "venv/lib/python3.8/site-packages/piptools/scripts/compile.py", line 342, in cli
    repository = PyPIRepository(pip_args, cache_dir=cache_dir)
  File "venv/lib/python3.8/site-packages/piptools/repositories/pypi.py", line 106, in __init__
    self._setup_logging()
  File "venv/lib/python3.8/site-packages/piptools/repositories/pypi.py", line 455, in _setup_logging
    assert isinstance(handler, logging.StreamHandler)
AssertionError

Code of Conduct

@AndTheDaysGoBy AndTheDaysGoBy added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Feb 1, 2022
@pradyunsg
Copy link
Member

See jazzband/pip-tools#1558

@AndTheDaysGoBy
Copy link
Author

Ah, I see, thank you.

Bit surprised that the Rich Stream Handler isn't instance of Stream Handler, but I guess that's a "types" vs "classes" situation.

@pradyunsg pradyunsg added resolution: wrong project Should be reported elsewhere and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Feb 1, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolution: wrong project Should be reported elsewhere
Projects
None yet
Development

No branches or pull requests

2 participants