Skip to content

Conversation

@mshafer-NI
Copy link
Collaborator

(also update development poetry.lock)

Why:

Modules started failing to run ni-python-styleguide with

Traceback (most recent call last):
  File "~\pyenv-win\versions\3.7.9\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "~\pyenv-win\versions\3.7.9\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File ".venv\Scripts\ni-python-styleguide.exe\__main__.py", line 7, in <module>
  File ".venv\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File ".venv\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File ".venv\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File ".venv\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File ".venv\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File ".venv\lib\site-packages\click\decorators.py", line 38, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File ".venv\lib\site-packages\ni_python_styleguide\_cli.py", line 135, in lint
    file_or_dir=file_or_dir,
  File ".venv\lib\site-packages\ni_python_styleguide\_lint.py", line 26, in lint
    app.run(list(filter(bool, args)))
  File ".venv\lib\site-packages\flake8\main\application.py", line 363, in run
    self._run(argv)
  File ".venv\lib\site-packages\flake8\main\application.py", line 350, in _run
    self.initialize(argv)
  File ".venv\lib\site-packages\flake8\main\application.py", line 330, in initialize
    self.find_plugins(config_finder)
  File ".venv\lib\site-packages\flake8\main\application.py", line 153, in find_plugins
    self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
  File ".venv\lib\site-packages\flake8\plugins\manager.py", line 357, in __init__
    self.namespace, local_plugins=local_plugins
  File ".venv\lib\site-packages\flake8\plugins\manager.py", line 238, in __init__
    self._load_entrypoint_plugins()
  File ".venv\lib\site-packages\flake8\plugins\manager.py", line 254, in _load_entrypoint_plugins
    eps = importlib_metadata.entry_points().get(self.namespace, ())
AttributeError: 'EntryPoints' object has no attribute 'get'

It appears this is caused by a breaking change in the 5.0.0 release of importlib-metadata. (removing a deprecated entry point) [source - reference]

In our testing, this does not affect Python 3.8 or .9, so choosing to not pin it for those versions.

Testing:

Reproduced the error locally by installing latest ni-python-styleguide and attempting to lint.

Tested fix by using pip to install from local copy (after applying pin to pyproject.toml) and verified that ni-python-styleguide was now able to run on the project.

@github-actions
Copy link
Contributor

Thank you for contributing! 👋

@mshafer-NI mshafer-NI merged commit 14c63e6 into ni:main Oct 12, 2022
@mshafer-NI mshafer-NI deleted the pin_importlib_metadata_for_3_7_and_under branch October 12, 2022 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants