guilatrova / tryceratops

A linter to prevent exception handling antipatterns in Python (limited only for those who like dinosaurs).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2.3.0 and 2.3.1 fail to run without typing_extensions on >=3.10

FasterSpeeding opened this issue · comments

These two releases fail to run in python >=3.10 environments where typing_extensions hasn't been installed separately with an error like the following:

nox > Running flake8
Traceback (most recent call last):
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/flake8/plugins/finder.py", line 296, in _load_plugin
    obj = plugin.entry_point.load()
  File "/opt/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/importlib/metadata/__init__.py", line [17](https://github.com/FasterSpeeding/Reinhard/actions/runs/5043870059/jobs/9046207679?pr=261#step:7:18)1, in load
    module = import_module(match.group('module'))
  File "/opt/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/tryceratops/flake_plugin.py", line 6, in <module>
    from tryceratops.files.discovery import load_config
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/tryceratops/files/__init__.py", line 1, in <module>
    from .discovery import FileDiscovery, load_config
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/tryceratops/files/discovery.py", line 9, in <module>
    from tryceratops.types import ParsedFileType, PyprojectConfig
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/tryceratops/types.py", line 3, in <module>
    import typing_extensions as te
ModuleNotFoundError: No module named 'typing_extensions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/bin/pflake8", line 8, in <module>
    sys.exit(main())
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/flake8/main/cli.py", line [22](https://github.com/FasterSpeeding/Reinhard/actions/runs/5043870059/jobs/9046207679?pr=261#step:7:23), in main
    app.run(argv)
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/flake8/main/application.py", line 336, in run
    self._run(argv)
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/flake8/main/application.py", line 3[24](https://github.com/FasterSpeeding/Reinhard/actions/runs/5043870059/jobs/9046207679?pr=261#step:7:25), in _run
    self.initialize(argv)
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/flake8/main/application.py", line 302, in initialize
    self.find_plugins(
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/flake8/main/application.py", line 1[28](https://github.com/FasterSpeeding/Reinhard/actions/runs/5043870059/jobs/9046207679?pr=261#step:7:29), in find_plugins
    self.plugins = finder.load_plugins(raw, opts)
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/flake8/plugins/finder.py", line 370, in load_plugins
    return _classify_plugins(_import_plugins(plugins, opts), opts)
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/flake8/plugins/finder.py", line 312, in _import_plugins
    return [_load_plugin(p) for p in plugins]
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/flake8/plugins/finder.py", line 312, in <listcomp>
    return [_load_plugin(p) for p in plugins]
  File "/home/runner/work/Reinhard/Reinhard/.nox/flake8/lib/python3.10/site-packages/flake8/plugins/finder.py", line [29](https://github.com/FasterSpeeding/Reinhard/actions/runs/5043870059/jobs/9046207679?pr=261#step:7:30)8, in _load_plugin
    raise FailedToLoadPlugin(plugin.package, e)
flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "tryceratops" due to No module named 'typing_extensions'.

Seems like the dep constraint (which only includes typing_extensions for python = "<3.10") and the actual code at

import typing_extensions as te
(which expects typing_extensions to always be present) aren't matching up here.

Thanks for pointing it out. I believe the issue is fixed now.