Repository navigation
5.0.0 fails with flake8 #406
Copy link
Copy link
Closed
nils-braun/b2luigi
#176Description
The new import_meta_data 5.0.0 fails with hacking flake8 extension:
12:58:37 hacking-py37 cannot reuse: no previous config /src/.tox/hacking-py37/.tox-config1
12:58:37 hacking-py37 create: /src/.tox/hacking-py37
12:58:37 [302] /src/.tox$ /usr/bin/python3 -m virtualenv --no-download --python /usr/bin/python3 hacking-py37 >hacking-py37/log/hacking-py37-0.log
12:58:37 hacking-py37 installdeps: .[hacking]
12:58:37 [309] /src$ /src/.tox/hacking-py37/bin/python -m pip install '.[hacking]' >.tox/hacking-py37/log/hacking-py37-1.log
12:58:42 hacking-py37 develop-inst: /src
12:58:42 write config to /src/.tox/hacking-py37/.tox-config1 as 'a333bea1ff24374b5ce3a229b583f709ed538d6822235f40ac210c70df65a22b /usr/bin/python3\n3.21.4 0 1 0\n00000000000000000000000000000000 .[hacking]'
12:58:42 [321] /src$ /src/.tox/hacking-py37/bin/python -m pip install --exists-action w -e . >.tox/hacking-py37/log/hacking-py37-2.log
12:58:44 [332] /src$ /src/.tox/hacking-py37/bin/python -m pip freeze >.tox/hacking-py37/log/hacking-py37-3.log
12:58:44 hacking-py37 installed: certifi==2022.9.24,charset-normalizer==2.1.1,flake8==3.8.4,hacking==4.1.0,idna==3.4,importlib-metadata==5.0.0,mccabe==0.6.1,pycodestyle==2.6.0,pyflakes==2.2.0,# Editable Git install with no remote (pywikibot==8.0.0.dev0),-e /src,requests==2.28.1,typing_extensions==4.3.0,urllib3==1.26.12,zipp==3.8.1
12:58:44 hacking-py37 run-test-pre: PYTHONHASHSEED='2157981050'
12:58:44 hacking-py37 run-test: commands[0] | flake8 --version
12:58:44 [335] /src$ /src/.tox/hacking-py37/bin/flake8 --version
12:58:44 Traceback (most recent call last):
12:58:44 File "/src/.tox/hacking-py37/bin/flake8", line 8, in <module>
12:58:44 sys.exit(main())
12:58:44 File "/src/.tox/hacking-py37/lib/python3.7/site-packages/flake8/main/cli.py", line 22, in main
12:58:44 app.run(argv)
12:58:44 File "/src/.tox/hacking-py37/lib/python3.7/site-packages/flake8/main/application.py", line 363, in run
12:58:44 self._run(argv)
12:58:44 File "/src/.tox/hacking-py37/lib/python3.7/site-packages/flake8/main/application.py", line 350, in _run
12:58:44 self.initialize(argv)
12:58:44 File "/src/.tox/hacking-py37/lib/python3.7/site-packages/flake8/main/application.py", line 330, in initialize
12:58:44 self.find_plugins(config_finder)
12:58:44 File "/src/.tox/hacking-py37/lib/python3.7/site-packages/flake8/main/application.py", line 153, in find_plugins
12:58:44 self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
12:58:44 File "/src/.tox/hacking-py37/lib/python3.7/site-packages/flake8/plugins/manager.py", line 357, in __init__
12:58:44 self.namespace, local_plugins=local_plugins
12:58:44 File "/src/.tox/hacking-py37/lib/python3.7/site-packages/flake8/plugins/manager.py", line 238, in __init__
12:58:44 self._load_entrypoint_plugins()
12:58:44 File "/src/.tox/hacking-py37/lib/python3.7/site-packages/flake8/plugins/manager.py", line 254, in _load_entrypoint_plugins
12:58:44 eps = importlib_metadata.entry_points().get(self.namespace, ())
12:58:44 AttributeError: 'EntryPoints' object has no attribute 'get'
12:58:44 ERROR: InvocationError for command /src/.tox/hacking-py37/bin/flake8 --version (exited with code 1)
It works with the previous release 4.13.0:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
jaraco commentedon Oct 2, 2022
It's a known issue that flake8 relies on the deprecated interfaces removed in importlib_metadata 5. I've attempted to engage with the maintainers of that project, but they refuse to engage and dismiss my proposals without suggesting alternatives. Flake8 does declare a dependency on
importlib_metadata<4.3, so the fact that an incompatible version of importlib_metadata is being installed is probably an issue with the environment setup.I do see that I can replicate the issue with
pip install hacking(via pip-run):Even though flake8 pins importlib_metadata on Python 3.7, pip installs importlib_metadata 5.
Interestingly, if I install only
flake8~=4.0.1(the sole dependency of hacking) using the same command, the declared version of importlib_metadata is pulled:I guess there may be an issue with how pip resolves dependencies of dependencies.
Oh, I see a difference. When installing
hackingfrom a wheel, it gets 4.1.0, which depends on flake8 3.8.x and flake8 3.8.x doesn't pin importlib_metadata.jaraco commentedon Oct 2, 2022
There's nothing that can be done here from the perspective of importlib_metadata. The deprecation has been in place since Feb 2021 and other projects have been able to adapt to the transition. These issues were anticipated and socialized and this project has worked actively with affected projects to provide multiple avenues to navigate the transition. I'm still willing to help flake8 support the preferred interfaces. What's not going to happen is to undo the deprecation or restore support for these deprecated interfaces indefinitely (or for many years).
As a user of flake8, your best option is probably to preemptively install
importlib_metadata<5until flake8 can adapt.[-]import_meta_data 5.0.0 fails with hacking flake8 extension[/-][+]5.0.0 fails with flake8[/+]build(deps): flake8: AttributeError 'EntryPoints' object has no attri…
tony commentedon Oct 2, 2022
@jaraco @xqt I filed an issue on the flake8 side here: PyCQA/flake8#1701
Workaround is as @jaraco says above, pin
importlib_metadatato<5for now.build(deps): Pin importlib_metadata < 5 until our dependencies are fi…
Pin importlib-metadata as flake8 metadata is wrong (#2447)
Added import to solve an issue with the environment
Pin importlib_metadata to < v5
Readthedocs environment updates
HARMONY-1204: Fix python3.7 flake8 dependency issue
Pin importlib-metadata under 5.0.0 for Python 3.7
Pin importlib-metadata under 5.0.0 for Python 3.7
Pin importlib-metadata under 5.0.0 for Python 3.7
20 remaining items
Rebuild poetry lock file w/ internal repo secondary
Rebuild poetry lock file w/ internal repo secondary
Pin `importlib-metadata` < 5 for Python 3.7.
Remove enchanted spellchecker and pin `importlib_metadata` to version 5
CI: Try to fix importlib issue with flake8.
pin import lib to <5
sync fork (#3)
Update flake8 version and fix issues (#162)
Update flake8 version and fix issues (#162)
bump flake version toworkaround importlib issue python/importlib_meta…
separate job for 3.6 to ubuntu 20 instead of latest due to lacking im…
Allow all spark version > 3.1.1 and < 4.0.
ci: HACK: Pin flake8 python to 3.11
ci: Test Python 3.12 and 3.13 (#178)
Sync sqlparse package fork (#12)