Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pbr is unexpectedly required during runtime #735

Closed
kulikjak opened this issue Sep 9, 2021 · 1 comment · Fixed by #1016
Closed

Pbr is unexpectedly required during runtime #735

kulikjak opened this issue Sep 9, 2021 · 1 comment · Fixed by #1016
Labels
bug Something isn't working

Comments

@kulikjak
Copy link

kulikjak commented Sep 9, 2021

Describe the bug

When running bandit without pbr installed, it breaks with:

Traceback (most recent call last):
  File "/usr/bin/bandit", line 6, in <module>
    from bandit.cli.main import main
  File "/usr/lib/python3.7/vendor-packages/bandit/__init__.py", line 17, in
<module>
    import pbr.version
ModuleNotFoundError: No module named 'pbr'

but pbr is not listed as runtime required so this is unexpected.

Reproduction steps

Run bandit without pbr installed.

Expected behavior

Bandit should either list pbr as a runtime dependency somewhere, or it should not use it in __init__.py.

Bandit version

1.7.0 (Default)

Python version

3.7

Additional context

This issue is avoided when installing with pip and pbr is brought in with stevedore. However, we have some python libraries repackaged and we don't list pbr as a stevedore runtime dependency (because it's not used anywhere in the code), and thus it is never brought in.

And while this works for anybody who installs it with pip (or doesn't change dependencies as we do), I think it should be listed as a runtime dependency in Bandit as well (because it should not depend on the fact that another fouth party library brings it in).

@kulikjak kulikjak added the bug Something isn't working label Sep 9, 2021
@sv-atoslav
Copy link

additional context

$ bandit --help
Traceback (most recent call last):
  File "/usr/local/bin/bandit", line 6, in <module>
    from bandit.cli.main import main
  File "/usr/local/lib/python3.9/dist-packages/bandit/__init__.py", line 17, in <module>
    import pbr.version
ModuleNotFoundError: No module named 'pbr'
$ pip install pbr
Requirement already satisfied: pbr in ./venv/lib/python3.9/site-packages (5.8.0)
$ pip show pbr
Name: pbr
Version: 5.8.0
Summary: Python Build Reasonableness
Home-page: https://docs.openstack.org/pbr/latest/
Author: OpenStack
Author-email: openstack-discuss@lists.openstack.org
License: UNKNOWN
Location: /home/sv7atoslav/PycharmProjects/whitebox-files-scanner/external_tools/venv/lib/python3.9/site-packages
Requires: 
Required-by: stevedore
$ bandit --help
Traceback (most recent call last):
  File "/usr/local/bin/bandit", line 6, in <module>
    from bandit.cli.main import main
  File "/usr/local/lib/python3.9/dist-packages/bandit/__init__.py", line 17, in <module>
    import pbr.version
ModuleNotFoundError: No module named 'pbr'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants