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

pylama: Import statements are in the wrong order #465

Closed
dmfigol opened this issue Jan 13, 2020 · 1 comment · Fixed by #466
Closed

pylama: Import statements are in the wrong order #465

dmfigol opened this issue Jan 13, 2020 · 1 comment · Fixed by #466

Comments

@dmfigol
Copy link
Collaborator

dmfigol commented Jan 13, 2020

Symptoms:

# ran in venv
-> % pylama nornir
nornir/__init__.py:3:0: Import statements are in the wrong order. 'from nornir.init_nornir import InitNornir' should be before 'import pkg_resources' and in a different group. [import_order]
nornir/init_nornir.py:3:0: Import statements are in the wrong order. 'from nornir.init_nornir import InitNornir' should be before 'import pkg_resources' and in a different group. [import_order]
nornir/core/configuration.py:3:0: Import statements are in the wrong order. 'from nornir.init_nornir import InitNornir' should be before 'import pkg_resources' and in a different group. [import_order]
nornir/core/task.py:3:0: Import statements are in the wrong order. 'from nornir.init_nornir import InitNornir' should be before 'import pkg_resources' and in a different group. [import_order]
nornir/core/connections.py:3:0: Import statements are in the wrong order. 'from nornir.init_nornir import InitNornir' should be before 'import pkg_resources' and in a different group. [import_order]
nornir/core/__init__.py:3:0: Import statements are in the wrong order. 'from nornir.init_nornir import InitNornir' should be before 'import pkg_resources' and in a different group. [import_order]

the same happens if you do poetry run pylama, make tests or make pylama.
According to @carlmontanari, for some reason it does not happen in CI.
I tried different combinations of flake8-import-order config, including:

[pylama]
application-import-names = nornir
[pylama:import_order]
application-import-names = nornir

and some others with no success.
This seems to be working fine in flake8:

# E501 is line length 79
-> % flake8 nornir --ignore=E501
nornir/core/__init__.py:14:5: F401 'nornir.core.inventory.Host' imported but unused

I am giving up trying to solve this and will submit PR which disables the linter with # noqa on the offending line.

@carlmontanari
Copy link
Contributor

x2

Running pylama from a fresh py38 venv or make pylama I get same outcome as Dmitry.

But recent (past weekend) CI built w/ no issue. I didn't look into it any further. Just tacking this on for more detail!

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 a pull request may close this issue.

2 participants