Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 818742 - dev-python/black-21.9.beta0 misses dependency dev-python/typing-extensions and thus fails during runtime
Summary: dev-python/black-21.9.beta0 misses dependency dev-python/typing-extensions an...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
: 827358 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-10-17 20:04 UTC by nis.meinert
Modified: 2021-11-26 07:47 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nis.meinert 2021-10-17 20:04:03 UTC
The black coder formatter fails during runtime due to missing dependency dev-python/typing-extensions:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.9/black", line 33, in <module>
    sys.exit(load_entry_point('black==21.9b0', 'console_scripts', 'black')())
  File "/usr/lib/python-exec/python3.9/black", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/lib/python3.9/site-packages/black/__init__.py", line 48, in <module>
    from black.files import find_project_root, find_pyproject_toml, parse_pyproject_toml
  File "/usr/lib/python3.9/site-packages/black/files.py", line 26, in <module>
    from black.handle_ipynb_magics import jupyter_dependencies_are_installed
  File "/usr/lib/python3.9/site-packages/black/handle_ipynb_magics.py", line 15, in <module>
    from typing_extensions import TypeGuard
ModuleNotFoundError: No module named 'typing_extensions'
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-10-17 20:09:01 UTC
Hmm. It shouldn't be needed for Python 3.8+? It's a backport.
Comment 2 Niko Böckerman 2021-11-25 09:18:09 UTC
I also faced this bug after upgrading to black-21.9_beta0 and removing typing-extensions with --depclean.

I looked into the black sources related to this issue. In the Pipfile they require typing_extensions >= 3.10.0.0 on all python versions < 3.10. [1]

And the reason for that is that typing.TypeGuard in Python was introduced only in Python 3.10. That is also the symbol that is failing to load in the traceback by OP in this bug.

So it seems to me that black should depend on >=dev-python/typing-extensions-3.10.0.2 conditionally for python 3.8 and 3.9.

[1]: https://github.com/psf/black/blob/21.9b0/Pipfile#L52
[2]: https://docs.python.org/3/library/typing.html#typing.TypeGuard
Comment 3 Larry the Git Cow gentoo-dev 2021-11-25 22:37:34 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f99af2199b1b35db1454abb5d691a5e443a00d0

commit 3f99af2199b1b35db1454abb5d691a5e443a00d0
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-11-25 22:34:59 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-11-25 22:37:25 +0000

    dev-python/black: add missing typing_extensions dependency for < py3.10
    
    Closes: https://bugs.gentoo.org/818742
    Thanks-to: Niko Böckerman <niko.bockerman@protonmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../black/{black-21.10_beta0.ebuild => black-21.10_beta0-r1.ebuild}    | 3 +++
 .../black/{black-21.11_beta0.ebuild => black-21.11_beta0-r1.ebuild}    | 3 +++
 .../black/{black-21.9_beta0.ebuild => black-21.9_beta0-r1.ebuild}      | 3 +++
 3 files changed, 9 insertions(+)
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-11-26 07:47:38 UTC
*** Bug 827358 has been marked as a duplicate of this bug. ***