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'
Hmm. It shouldn't be needed for Python 3.8+? It's a backport.
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
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(+)
*** Bug 827358 has been marked as a duplicate of this bug. ***