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

App Pylint Broken with 2.2.0 #5531

Closed
jdrew82 opened this issue Apr 3, 2024 · 1 comment · Fixed by #5532
Closed

App Pylint Broken with 2.2.0 #5531

jdrew82 opened this issue Apr 3, 2024 · 1 comment · Fixed by #5532
Assignees
Labels
emergent Unplanned work that is brought into a sprint after it's started. type: bug Something isn't working as expected

Comments

@jdrew82
Copy link
Contributor

jdrew82 commented Apr 3, 2024

Environment

  • Nautobot version (Docker tag too if applicable): 2.2.0
  • Python version: 3.10
  • Database platform, version: Postgres
  • Middleware(s):

Steps to Reproduce

  1. Build dev environment using any of the Nautobot Apps that include pylint.
  2. Build Nautobot using 2.2.0 and run tests.
  3. See pylint bomb trying to load due to missing setup().

Expected Behavior

Pylint runs tests without issue.

Observed Behavior

Got AttributeError thrown:

Running docker compose command "exec nautobot pylint --init-hook "import nautobot; nautobot.setup()" --rcfile pyproject.toml nautobot_golden_config"
Traceback (most recent call last):
  File "/usr/local/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
             ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pylint/__init__.py", line 34, in run_pylint
    PylintRun(argv or sys.argv[1:])
  File "/usr/local/lib/python3.11/site-packages/pylint/lint/run.py", line 136, in __init__
    args = _preprocess_options(self, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pylint/config/utils.py", line 256, in _preprocess_options
    cb(run, value)
  File "/usr/local/lib/python3.11/site-packages/pylint/config/utils.py", line 152, in _init_hook
    exec(value)  # pylint: disable=exec-used
    ^^^^^^^^^^^
  File "<string>", line 1, in <module>
AttributeError: module 'nautobot' has no attribute 'setup'
@jdrew82 jdrew82 added type: bug Something isn't working as expected triage This issue is new and has not been reviewed. labels Apr 3, 2024
@glennmatthews glennmatthews changed the title Pylint Broken with 2.2.0 App Pylint Broken with 2.2.0 Apr 3, 2024
@glennmatthews glennmatthews self-assigned this Apr 3, 2024
@glennmatthews glennmatthews added emergent Unplanned work that is brought into a sprint after it's started. and removed triage This issue is new and has not been reviewed. labels Apr 3, 2024
glennmatthews added a commit that referenced this issue Apr 8, 2024
* Fix #5531 - reintroduce nautobot.setup() function

* Re-add sentinel against repeated initialization

* Eliminate duplicate pylint call
@glennmatthews
Copy link
Contributor

Fix will be in 2.2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emergent Unplanned work that is brought into a sprint after it's started. type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants