gforcada/flake8-isort

Not working with isort 5

Closed this issue · 1 comments

If you update isort to the latest version, which is required to use --profile, this plugin breaks:

Traceback (most recent call last):
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\plugins\manager.py", line 157, in load_plugin
    self._load()
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\plugins\manager.py", line 134, in _load
    self._plugin = self.entry_point.load()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.240.0_x64__qbz5n2kfra8p0\lib\importlib\metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.240.0_x64__qbz5n2kfra8p0\lib\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 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8_isort.py", line 3, in <module>
    from isort import SortImports
ImportError: cannot import name 'SortImports' from 'isort' (C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\isort\__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.240.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.240.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\__main__.py", line 4, in <module>
    cli.main()
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\main\cli.py", line 22, in main
    app.run(argv)
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\main\application.py", line 363, in run
    self._run(argv)
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\main\application.py", line 350, in _run
    self.initialize(argv)
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\main\application.py", line 330, in initialize
    self.find_plugins(config_finder)
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\main\application.py", line 159, in find_plugins
    self.check_plugins.load_plugins()
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\plugins\manager.py", line 415, in load_plugins
    plugins = list(self.manager.map(load_plugin))
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\plugins\manager.py", line 302, in map
    yield func(self.plugins[name], *args, **kwargs)
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\plugins\manager.py", line 413, in load_plugin
    return plugin.load_plugin()
  File "C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flake8\plugins\manager.py", line 164, in load_plugin
    raise failed_to_load
flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "I00" due to cannot import name 'SortImports' from 'isort' (C:\Users\Kende\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\isort\__init__.py).

When you downgrade it again it works.

Strage... there is this comment in an isort issue mentioning support, but it still seems to be broken :(

A broken example pipeline would be that of django-oauth-toolkit.

Edit: Nevermind me! I see now that build is using flake8-isort==3.0.0 for some reason.