Skip to content

Conversation

@mshafer-NI
Copy link
Collaborator

I found that we are broken at install time.

I would like a PR check to alert us to this on the lock PRs.

@github-actions
Copy link
Contributor

Thank you for contributing! 👋

@mshafer-NI mshafer-NI force-pushed the dev/add_install_smoke_test branch from d03dd4e to ffaeddd Compare December 9, 2025 20:06
@mshafer-NI mshafer-NI requested a review from irwand December 9, 2025 20:07
@mshafer-NI
Copy link
Collaborator Author

@irwand, I'm not sure why I never completed this PR...., but with the recent changes to the PR template, I've basically rewritten it.

@mshafer-NI mshafer-NI force-pushed the dev/add_install_smoke_test branch from 9c03b94 to a69e110 Compare December 9, 2025 20:13

[[package]]
name = "black"
version = "24.8.0"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does bring into question the value of doing this...,

I would think that we don't want needing to update formatting deps to block unrelated submissions...,
Thoughts, @bkeryan / @irwand ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with that, but if it's hard to get around, I'm not too attached to it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your GitHub workflows should lock or pin all dependencies.

If the goal was to test installing with pip, you could maintain a compiled requirements.txt, but Renovate would update it at the same time as poetry.lock, so I guess there is no point in doing this.

Copy link
Contributor

@bkeryan bkeryan Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that we are broken at install time.

Why was this?

Was ni-python-styleguide relying on dependencies that are only part of a Poetry dependency group? If so, you can do poetry install --only main or use a separate poetry project / requirements.txt that only depends on ni-python-styleguide (via relative file path within the repo, with PEP 517 installation).

Did an upstream dependency break ni-python-styleguide? Renovate PRs will tell you about this, but our current scheduling config delays it by 2-3 weeks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was after installing ni-python-styleguide in pipx to run against a loose script:

(I anticipated needing to do some pinning / upgrading to get it working..., but then it worked on this PR build....)

%repo%>ni-python-styleguide fix .
Traceback (most recent call last):
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\plugins\finder.py", line 291, in _load_plugin
    obj = plugin.entry_point.load()
  File "~\.pyenv\pyenv-win\versions\3.13.7\Lib\importlib\metadata\__init__.py", line 179, in load
    module = import_module(match.group('module'))
  File "~\.pyenv\pyenv-win\versions\3.13.7\Lib\importlib\__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8_import_order\flake8_linter.py", line 6, in <module>
    from flake8_import_order.checker import (
        DEFAULT_IMPORT_ORDER_STYLE, ImportOrderChecker,
    )
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8_import_order\checker.py", line 8, in <module>
    from flake8_import_order.styles import lookup_entry_point
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8_import_order\styles.py", line 3, in <module>
    from pkg_resources import iter_entry_points
  File "~\pipx\shared\Lib\site-packages\pkg_resources\__init__.py", line 2191, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~\.local\bin\ni-python-styleguide.exe\__main__.py", line 6, in <module>
    sys.exit(main())
             ~~~~^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\core.py", line 1485, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\core.py", line 1406, in main
    rv = self.invoke(ctx)
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\core.py", line 1873, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\core.py", line 1269, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\core.py", line 824, in invoke
    return callback(*args, **kwargs)
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\decorators.py", line 46, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\ni_python_styleguide\_cli.py", line 186, in fix
    _fix.fix(
    ~~~~~~~~^
        exclude=obj["EXCLUDE"],
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        aggressive=aggressive,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\ni_python_styleguide\_fix.py", line 120, in fix
    lint_errors_to_process = _acknowledge_existing_errors._utils.lint.get_errors_to_process(
        exclude,
    ...<3 lines>...
        excluded_errors=[],  # we fix black errors, so we don't need to filter it.
    )
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\ni_python_styleguide\_utils\lint.py", line 11, in get_errors_to_process
    _lint.get_lint_output(
    ~~~~~~~~~~~~~~~~~~~~~^
        format=None,
        ^^^^^^^^^^^^
    ...<4 lines>...
        file_or_dir=file_or_dir,
        ^^^^^^^^^^^^^^^^^^^^^^^^
    ).splitlines()
    ^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\ni_python_styleguide\_lint.py", line 39, in get_lint_output
    lint(qs_or_vs, exclude, app_import_names, format, extend_ignore, file_or_dir)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\ni_python_styleguide\_lint.py", line 27, in lint
    app.run(list(filter(bool, args)))
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\main\application.py", line 198, in run
    self._run(argv)
    ~~~~~~~~~^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\main\application.py", line 186, in _run
    self.initialize(argv)
    ~~~~~~~~~~~~~~~^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\main\application.py", line 165, in initialize
    self.plugins, self.options = parse_args(argv)
                                 ~~~~~~~~~~^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\options\parse_args.py", line 42, in parse_args
    plugins = finder.load_plugins(raw_plugins, plugin_opts)
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\plugins\finder.py", line 365, in load_plugins
    return _classify_plugins(_import_plugins(plugins, opts), opts)
                             ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\plugins\finder.py", line 307, in _import_plugins
    return [_load_plugin(p) for p in plugins]
            ~~~~~~~~~~~~^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\plugins\finder.py", line 293, in _load_plugin
    raise FailedToLoadPlugin(plugin.package, e)
flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "flake8-import-order" due to module 'pkgutil' has no attribute 'ImpImporter'.

%repo%>nps fix .
Traceback (most recent call last):
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\plugins\finder.py", line 291, in _load_plugin
    obj = plugin.entry_point.load()
  File "~\.pyenv\pyenv-win\versions\3.13.7\Lib\importlib\metadata\__init__.py", line 179, in load
    module = import_module(match.group('module'))
  File "~\.pyenv\pyenv-win\versions\3.13.7\Lib\importlib\__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8_import_order\flake8_linter.py", line 6, in <module>
    from flake8_import_order.checker import (
        DEFAULT_IMPORT_ORDER_STYLE, ImportOrderChecker,
    )
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8_import_order\checker.py", line 8, in <module>
    from flake8_import_order.styles import lookup_entry_point
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8_import_order\styles.py", line 3, in <module>
    from pkg_resources import iter_entry_points
  File "~\pipx\shared\Lib\site-packages\pkg_resources\__init__.py", line 2191, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~\.local\bin\nps.exe\__main__.py", line 6, in <module>
    sys.exit(main())
             ~~~~^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\core.py", line 1485, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\core.py", line 1406, in main
    rv = self.invoke(ctx)
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\core.py", line 1873, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\core.py", line 1269, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\core.py", line 824, in invoke
    return callback(*args, **kwargs)
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\click\decorators.py", line 46, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\ni_python_styleguide\_cli.py", line 186, in fix
    _fix.fix(
    ~~~~~~~~^
        exclude=obj["EXCLUDE"],
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        aggressive=aggressive,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\ni_python_styleguide\_fix.py", line 120, in fix
    lint_errors_to_process = _acknowledge_existing_errors._utils.lint.get_errors_to_process(
        exclude,
    ...<3 lines>...
        excluded_errors=[],  # we fix black errors, so we don't need to filter it.
    )
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\ni_python_styleguide\_utils\lint.py", line 11, in get_errors_to_process
    _lint.get_lint_output(
    ~~~~~~~~~~~~~~~~~~~~~^
        format=None,
        ^^^^^^^^^^^^
    ...<4 lines>...
        file_or_dir=file_or_dir,
        ^^^^^^^^^^^^^^^^^^^^^^^^
    ).splitlines()
    ^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\ni_python_styleguide\_lint.py", line 39, in get_lint_output
    lint(qs_or_vs, exclude, app_import_names, format, extend_ignore, file_or_dir)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\ni_python_styleguide\_lint.py", line 27, in lint
    app.run(list(filter(bool, args)))
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\main\application.py", line 198, in run
    self._run(argv)
    ~~~~~~~~~^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\main\application.py", line 186, in _run
    self.initialize(argv)
    ~~~~~~~~~~~~~~~^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\main\application.py", line 165, in initialize
    self.plugins, self.options = parse_args(argv)
                                 ~~~~~~~~~~^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\options\parse_args.py", line 42, in parse_args
    plugins = finder.load_plugins(raw_plugins, plugin_opts)
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\plugins\finder.py", line 365, in load_plugins
    return _classify_plugins(_import_plugins(plugins, opts), opts)
                             ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\plugins\finder.py", line 307, in _import_plugins
    return [_load_plugin(p) for p in plugins]
            ~~~~~~~~~~~~^^^
  File "~\pipx\venvs\ni-python-styleguide\Lib\site-packages\flake8\plugins\finder.py", line 293, in _load_plugin
    raise FailedToLoadPlugin(plugin.package, e)
flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "flake8-import-order" due to module 'pkgutil' has no attribute 'ImpImporter'.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking more about this. I think the correct way to handle this is to do a "ni-python-styleguide format" and then lint.

This allows us to be checking "we're compatible with released deps" while also checking that specifically the format and lint commands work, and format produces a valid output (even if formatting has changed)

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.

3 participants