pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.31k stars 1.14k forks source link

wrong-import-order fails on one system, passes in other #8845

Open astrojuanlu opened 1 year ago

astrojuanlu commented 1 year ago

Bug description

In one system pylint is perfectly fine, but in another it's complaining about import order.

Configuration

Configuration is identical in both systems:

[tool.pylint]
[tool.pylint.master]
ignore = "CVS"
ignore-patterns = "kedro/templates/*"
load-plugins = [
    "pylint.extensions.docparams",
    "pylint.extensions.no_self_use"
]
extension-pkg-whitelist = "cv2"
unsafe-load-any-extension = false
[tool.pylint.messages_control]
disable = [
    "ungrouped-imports",
    "duplicate-code"
]
enable = ["useless-suppression"]
[tool.pylint.refactoring]
max-nested-blocks = 5
[tool.pylint.format]
indent-after-paren=4
indent-string="    "
[tool.pylint.miscellaneous]
notes = [
    "FIXME",
    "XXX"
]
[tool.pylint.design]
min-public-methods = 1
$ sha256sum /home/circleci/project/pyproject.toml
e948e6e86a78d5dd94d55162be92c1d53ed8c65459594da76c63c66514cdc43c  /home/circleci/project/pyproject.toml
$ sha256sum /workspace/kedro/pyproject.toml
e948e6e86a78d5dd94d55162be92c1d53ed8c65459594da76c63c66514cdc43c  /workspace/kedro/pyproject.toml

Command used

pylint -v kedro/framework/cli/micropkg.py

Pylint output

$ pylint --version
pylint 2.17.4
astroid 2.15.6
Python 3.8.16 (default, Jun 12 2023, 18:09:05) 
[GCC 11.2.0]
$ pylint -v kedro/framework/cli/micropkg.py
Using config file /home/circleci/project/pyproject.toml
************* Module kedro.framework.cli.micropkg
kedro/framework/cli/micropkg.py:15:0: C0411: third party import "from packaging.requirements import InvalidRequirement, Requirement" should be placed before "from build.util import project_wheel_metadata" (wrong-import-order)
kedro/framework/cli/micropkg.py:16:0: C0411: third party import "from packaging.utils import canonicalize_name" should be placed before "from build.util import project_wheel_metadata" (wrong-import-order)
kedro/framework/cli/micropkg.py:17:0: C0411: third party import "from rope.base.project import Project" should be placed before "from build.util import project_wheel_metadata" (wrong-import-order)
kedro/framework/cli/micropkg.py:18:0: C0411: third party import "from rope.contrib import generate" should be placed before "from build.util import project_wheel_metadata" (wrong-import-order)
kedro/framework/cli/micropkg.py:19:0: C0411: third party import "from rope.refactor.move import MoveModule" should be placed before "from build.util import project_wheel_metadata" (wrong-import-order)
kedro/framework/cli/micropkg.py:20:0: C0411: third party import "from rope.refactor.rename import Rename" should be placed before "from build.util import project_wheel_metadata" (wrong-import-order)
kedro/framework/cli/micropkg.py:21:0: C0411: third party import "from setuptools.discovery import FlatLayoutPackageFinder" should be placed before "from build.util import project_wheel_metadata" (wrong-import-order)

------------------------------------------------------------------
Your code has been rated at 9.80/10 (previous run: 9.80/10, +0.00)

Expected behavior

$ pylint -v kedro/framework/cli/micropkg.py
Using config file /workspace/kedro/pyproject.toml

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

Pylint version

$ pylint --version
pylint 2.17.4
astroid 2.15.6
Python 3.8.15 (default, Jun 28 2023, 13:31:36) 
[GCC 11.3.0]

OS / Environment

Ubuntu 22.04 in both cases

Additional dependencies

"Bad" machine:

``` absl-py==1.4.0 adlfs==2023.4.0 aiohttp==3.8.4 aiosignal==1.3.1 antlr4-python3-runtime==4.9.3 anyconfig==0.10.1 anyio==3.7.1 appdirs==1.4.4 argcomplete==3.0.8 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 astroid==2.15.6 asttokens==2.2.1 astunparse==1.6.3 async-timeout==4.0.2 attrs==23.1.0 aws-xray-sdk==0.95 azure-core==1.28.0 azure-datalake-store==0.0.53 azure-identity==1.13.0 azure-storage-blob==12.17.0 Babel==2.12.1 backcall==0.2.0 bandit==1.7.5 beautifulsoup4==4.12.2 behave==1.2.6 binaryornot==0.4.4 biopython==1.81 black==22.12.0 blacken-docs==1.9.2 bleach==6.0.0 blosc2==2.0.0 bokeh==3.1.1 boto==2.49.0 boto3==1.28.2 botocore==1.31.2 build==0.10.0 cachetools==5.3.1 certifi==2023.5.7 cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.2.0 click==8.1.3 click-plugins==1.1.1 cligj==0.7.2 cloudpickle==2.2.1 comm==0.1.3 compress-pickle==2.1.0 contourpy==1.1.0 cookiecutter==2.2.3 coverage==7.2.7 cryptography==41.0.2 cycler==0.11.0 Cython==0.29.36 dask==2021.12.0 db-dtypes==1.1.1 debugpy==1.6.7 decorator==5.1.1 defusedxml==0.7.1 delta-spark==1.2.1 dill==0.3.6 distlib @ file:///croot/distlib_1673477531104/work distributed==2021.12.0 docker==6.1.3 docopt==0.6.2 dynaconf==3.1.12 ecdsa==0.18.0 et-xmlfile==1.1.0 exceptiongroup==1.1.2 execnet==2.0.2 executing==1.2.0 fastjsonschema==2.17.1 filelock @ file:///croot/filelock_1672387128942/work Fiona==1.9.4.post1 flatbuffers==23.5.26 frozenlist==1.3.3 fs==2.4.16 fsspec==2023.1.0 future==0.18.3 gast==0.4.0 gcsfs==2023.1.0 geopandas==0.13.2 gitdb==4.0.10 gitdb2==4.0.2 GitPython==3.0.6 google-api-core==2.11.1 google-auth==2.22.0 google-auth-oauthlib==1.0.0 google-cloud-bigquery==3.11.3 google-cloud-bigquery-storage==2.22.0 google-cloud-core==2.3.3 google-cloud-storage==2.10.0 google-crc32c==1.5.0 google-pasta==0.2.0 google-resumable-media==2.5.0 googleapis-common-protos==1.59.1 greenlet==2.0.2 grimp==2.5 grpcio==1.56.0 grpcio-status==1.56.0 h5py==3.9.0 hdfs==2.7.0 holoviews==1.13.5 identify==2.5.24 idna==3.4 import-linter==1.8.0 importlib-metadata==6.8.0 importlib-resources==6.0.0 iniconfig==2.0.0 ipykernel==6.24.0 ipython==8.12.2 ipython-genutils==0.2.0 ipywidgets==8.0.7 isodate==0.6.1 isort==5.12.0 jedi==0.18.2 Jinja2==3.0.3 jmespath==0.10.0 joblib==1.3.1 json5==0.9.14 jsondiff==1.1.1 jsonpickle==3.0.1 jsonschema==4.18.1 jsonschema-specifications==2023.6.1 jupyter==1.0.0 jupyter-console==6.6.3 jupyter-server==1.24.0 jupyter_client==8.3.0 jupyter_core==5.3.1 jupyterlab==3.5.3 jupyterlab-pygments==0.2.2 jupyterlab-widgets==3.0.8 jupyterlab_server==2.15.2 kedro @ file:///home/circleci/project keras==2.13.1 kiwisolver==1.4.4 lazy-object-proxy==1.9.0 libclang==16.0.0 linkify-it-py==2.0.2 locket==1.0.0 lxml==4.9.3 lz4==4.3.2 Markdown==3.4.3 markdown-it-py==3.0.0 MarkupSafe==2.1.3 matplotlib==3.3.4 matplotlib-inline==0.1.6 mccabe==0.7.0 mdit-py-plugins==0.4.0 mdurl==0.1.2 memory-profiler==0.61.0 mistune==3.0.1 mkl-fft==1.3.6 mkl-random @ file:///work/mkl/mkl_random_1682950433854/work mkl-service==2.4.0 mock==5.1.0 more-itertools==9.1.0 moto==1.3.7 msal==1.22.0 msal-extensions==1.0.0 msgpack==1.0.5 multidict==6.0.4 mypy-extensions==1.0.0 nbclassic==1.0.0 nbclient==0.8.0 nbconvert==7.6.0 nbformat==5.9.1 nest-asyncio==1.5.6 networkx==2.8.8 nodeenv==1.8.0 notebook==6.5.4 notebook_shim==0.2.3 numexpr @ file:///croot/numexpr_1683221822650/work numpy==1.22.4 oauthlib==3.2.2 omegaconf==2.3.0 opencv-python==4.5.5.64 openpyxl==3.1.2 opt-einsum==3.3.0 packaging==23.1 pandas==1.5.3 pandas-gbq==0.17.9 pandocfilters==1.5.0 panel==1.2.0 param==1.13.0 parse==1.19.1 parse-type==0.6.2 parso==0.8.3 partd==1.4.0 pathspec==0.11.1 pbr==5.11.1 pexpect==4.8.0 pickleshare==0.7.5 Pillow==9.5.0 pip-tools==6.14.0 pipx==1.2.0 pkgutil_resolve_name==1.3.10 platformdirs @ file:///opt/conda/conda-bld/platformdirs_1662711380096/work plotly==5.15.0 pluggy==1.2.0 portalocker==2.7.0 pre-commit==2.21.0 prometheus-client==0.17.1 prompt-toolkit==3.0.39 proto-plus==1.22.3 protobuf==4.23.4 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 py==1.11.0 py-cpuinfo @ file:///home/conda/feedstock_root/build_artifacts/py-cpuinfo_1666774466606/work py4j==0.10.9.5 pyaml==23.7.0 pyarrow==9.0.0 pyasn1==0.5.0 pyasn1-modules==0.3.0 pycparser==2.21 pycryptodome==3.18.0 pydata-google-auth==1.8.1 Pygments==2.15.1 PyJWT==2.7.0 pylint==2.17.4 pyparsing==3.1.0 pyproj==3.5.0 pyproject_hooks==1.0.0 pyspark==3.2.4 pytest==7.4.0 pytest-cov==3.0.0 pytest-forked==1.6.0 pytest-mock==1.13.0 pytest-xdist==2.2.1 python-dateutil==2.8.2 python-jose==2.0.2 python-slugify==8.0.1 pytoolconfig==1.2.5 pytz==2023.3 pyviz-comms==2.3.2 PyYAML==6.0 pyzmq==25.1.0 qtconsole==5.4.3 QtPy==2.3.1 redis==4.6.0 referencing==0.29.1 requests==2.31.0 requests-mock==1.11.0 requests-oauthlib==1.3.1 responses==0.23.1 rich==13.4.2 rope==1.9.0 rpds-py==0.8.10 rsa==4.9 s3fs==0.4.2 s3transfer==0.6.1 scikit-learn==1.0.2 scipy==1.7.3 Send2Trash==1.8.2 shapely==2.0.1 six==1.16.0 smmap==5.0.0 sniffio==1.3.0 sortedcontainers==2.4.0 soupsieve==2.4.1 SQLAlchemy==1.4.49 stack-data==0.6.2 stevedore==5.1.0 tables @ file:///croot/pytables_1685123207389/work tblib==2.0.0 tenacity==8.2.2 tensorboard==2.13.0 tensorboard-data-server==0.7.1 tensorflow==2.13.0 tensorflow-estimator==2.13.0 tensorflow-io-gcs-filesystem==0.32.0 termcolor==2.3.0 terminado==0.17.1 text-unidecode==1.3 threadpoolctl==3.1.0 tinycss2==1.2.1 toml==0.10.2 tomli==2.0.1 tomlkit==0.11.8 toolz==0.12.0 toposort==1.10 tornado==6.3.2 tqdm==4.65.0 traitlets==5.9.0 triad==0.9.1 truffleHog==2.2.1 truffleHogRegexes==0.0.7 types-PyYAML==6.0.12.10 typing_extensions==4.5.0 uc-micro-py==1.0.2 urllib3==1.26.16 userpath==1.8.0 virtualenv @ file:///croot/virtualenv_1674752100526/work wcwidth==0.2.6 webencodings==0.5.1 websocket-client==1.6.1 Werkzeug==2.3.6 widgetsnbextension==4.0.8 wrapt==1.15.0 XlsxWriter==1.4.5 xmltodict==0.13.0 xyzservices==2023.5.0 yarl==1.9.2 zict==3.0.0 zipp==3.16.0 ```

"Good" machine:

``` absl-py==1.4.0 adlfs==2023.4.0 aiohttp==3.8.4 aiosignal==1.3.1 antlr4-python3-runtime==4.9.3 anyconfig==0.10.1 anyio==3.7.1 appdirs==1.4.4 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 astroid==2.15.6 asttokens==2.2.1 astunparse==1.6.3 async-timeout==4.0.2 attrs==23.1.0 aws-xray-sdk==0.95 azure-core==1.28.0 azure-datalake-store==0.0.53 azure-identity==1.13.0 azure-storage-blob==12.17.0 Babel==2.12.1 backcall==0.2.0 bandit==1.7.5 beautifulsoup4==4.12.2 behave==1.2.6 binaryornot==0.4.4 biopython==1.81 black==22.12.0 blacken-docs==1.9.2 bleach==6.0.0 blosc2==2.0.0 bokeh==3.1.1 boto==2.49.0 boto3==1.28.2 botocore==1.31.2 build==0.10.0 cachetools==5.3.1 certifi==2023.5.7 cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.2.0 click==8.1.4 click-plugins==1.1.1 cligj==0.7.2 cloudpickle==2.2.1 comm==0.1.3 compress-pickle==2.1.0 contourpy==1.1.0 cookiecutter==2.2.3 coverage==7.2.7 cryptography==41.0.2 cycler==0.11.0 Cython==0.29.36 dask==2021.12.0 db-dtypes==1.1.1 debugpy==1.6.7 decorator==5.1.1 defusedxml==0.7.1 delta-spark==1.2.1 dill==0.3.6 distlib==0.3.6 distributed==2021.12.0 docker==6.1.3 docopt==0.6.2 dynaconf==3.1.12 ecdsa==0.18.0 et-xmlfile==1.1.0 exceptiongroup==1.1.2 execnet==2.0.2 executing==1.2.0 fastjsonschema==2.17.1 filelock==3.12.2 Fiona==1.9.4.post1 flatbuffers==23.5.26 frozenlist==1.3.3 fs==2.4.16 fsspec==2023.1.0 future==0.18.3 gast==0.4.0 gcsfs==2023.1.0 geopandas==0.13.2 gitdb==4.0.10 gitdb2==4.0.2 GitPython==3.0.6 google-api-core==2.11.1 google-auth==2.22.0 google-auth-oauthlib==1.0.0 google-cloud-bigquery==3.11.3 google-cloud-bigquery-storage==2.22.0 google-cloud-core==2.3.3 google-cloud-storage==2.10.0 google-crc32c==1.5.0 google-pasta==0.2.0 google-resumable-media==2.5.0 googleapis-common-protos==1.59.1 greenlet==2.0.2 grimp==2.5 grpcio==1.56.0 grpcio-status==1.56.0 h5py==3.9.0 hdfs==2.7.0 holoviews==1.13.5 identify==2.5.24 idna==3.4 import-linter==1.8.0 importlib-metadata==6.8.0 importlib-resources==6.0.0 iniconfig==2.0.0 ipykernel==6.24.0 ipython==8.12.2 ipython-genutils==0.2.0 ipywidgets==8.0.7 isodate==0.6.1 isort==5.12.0 jedi==0.18.2 Jinja2==3.0.3 jmespath==0.10.0 joblib==1.3.1 json5==0.9.14 jsondiff==1.1.1 jsonpickle==3.0.1 jsonschema==4.18.1 jsonschema-specifications==2023.6.1 jupyter==1.0.0 jupyter-console==6.6.3 jupyter-server==1.24.0 jupyter_client==8.3.0 jupyter_core==5.3.1 jupyterlab==3.5.3 jupyterlab-pygments==0.2.2 jupyterlab-widgets==3.0.8 jupyterlab_server==2.15.2 -e git+https://github.com/kedro-org/kedro.git@dd04cb0503fdcff2076274f9ecfb61df88a7a808#egg=kedro keras==2.13.1 kiwisolver==1.4.4 lazy-object-proxy==1.9.0 libclang==16.0.0 linkify-it-py==2.0.2 locket==1.0.0 lxml==4.9.3 lz4==4.3.2 Markdown==3.4.3 markdown-it-py==3.0.0 MarkupSafe==2.1.3 matplotlib==3.3.4 matplotlib-inline==0.1.6 mccabe==0.7.0 mdit-py-plugins==0.4.0 mdurl==0.1.2 memory-profiler==0.61.0 mistune==3.0.1 mock==5.1.0 more-itertools==9.1.0 moto==1.3.7 msal==1.22.0 msal-extensions==1.0.0 msgpack==1.0.5 multidict==6.0.4 mypy-extensions==1.0.0 nbclassic==1.0.0 nbclient==0.8.0 nbconvert==7.6.0 nbformat==5.9.1 nest-asyncio==1.5.6 networkx==2.8.8 nodeenv==1.8.0 notebook==6.5.4 notebook_shim==0.2.3 numexpr==2.8.4 numpy==1.22.4 oauthlib==3.2.2 omegaconf==2.3.0 opencv-python==4.5.5.64 openpyxl==3.1.2 opt-einsum==3.3.0 packaging==23.1 pandas==1.5.3 pandas-gbq==0.17.9 pandocfilters==1.5.0 panel==1.2.0 param==1.13.0 parse==1.19.1 parse-type==0.6.2 parso==0.8.3 partd==1.4.0 pathspec==0.11.1 pbr==5.11.1 pexpect==4.8.0 pickleshare==0.7.5 Pillow==9.5.0 pip-tools==6.14.0 pkgutil_resolve_name==1.3.10 platformdirs==3.8.1 plotly==5.15.0 pluggy==1.2.0 portalocker==2.7.0 pre-commit==2.21.0 prometheus-client==0.17.1 prompt-toolkit==3.0.39 proto-plus==1.22.3 protobuf==4.23.4 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 py==1.11.0 py-cpuinfo==9.0.0 py4j==0.10.9.5 pyaml==23.7.0 pyarrow==9.0.0 pyasn1==0.5.0 pyasn1-modules==0.3.0 pycparser==2.21 pycryptodome==3.18.0 pydata-google-auth==1.8.1 Pygments==2.15.1 PyJWT==2.7.0 pylint==2.17.4 pyparsing==3.1.0 pyproj==3.5.0 pyproject_hooks==1.0.0 pyspark==3.2.4 pytest==7.4.0 pytest-cov==3.0.0 pytest-forked==1.6.0 pytest-mock==1.13.0 pytest-xdist==2.2.1 python-dateutil==2.8.2 python-jose==2.0.2 python-slugify==8.0.1 pytoolconfig==1.2.5 pytz==2023.3 pyviz-comms==2.3.2 PyYAML==6.0 pyzmq==25.1.0 qtconsole==5.4.3 QtPy==2.3.1 redis==4.6.0 referencing==0.29.1 requests==2.31.0 requests-mock==1.11.0 requests-oauthlib==1.3.1 responses==0.23.1 rich==13.4.2 rope==1.9.0 rpds-py==0.8.10 rsa==4.9 s3fs==0.4.2 s3transfer==0.6.1 scikit-learn==1.0.2 scipy==1.7.3 Send2Trash==1.8.2 shapely==2.0.1 six==1.16.0 smmap==5.0.0 sniffio==1.3.0 sortedcontainers==2.4.0 soupsieve==2.4.1 SQLAlchemy==1.4.49 stack-data==0.6.2 stevedore==5.1.0 tables==3.8.0 tblib==2.0.0 tenacity==8.2.2 tensorboard==2.13.0 tensorboard-data-server==0.7.1 tensorflow==2.13.0 tensorflow-estimator==2.13.0 tensorflow-io-gcs-filesystem==0.32.0 termcolor==2.3.0 terminado==0.17.1 text-unidecode==1.3 threadpoolctl==3.1.0 tinycss2==1.2.1 toml==0.10.2 tomli==2.0.1 tomlkit==0.11.8 toolz==0.12.0 toposort==1.10 tornado==6.3.2 tqdm==4.65.0 traitlets==5.9.0 triad==0.9.1 truffleHog==2.2.1 truffleHogRegexes==0.0.7 types-PyYAML==6.0.12.10 typing_extensions==4.5.0 uc-micro-py==1.0.2 urllib3==1.26.16 virtualenv==20.23.1 wcwidth==0.2.6 webencodings==0.5.1 websocket-client==1.6.1 Werkzeug==2.3.6 widgetsnbextension==4.0.8 wrapt==1.15.0 XlsxWriter==1.4.5 xmltodict==0.13.0 xyzservices==2023.5.0 yarl==1.9.2 zict==3.0.0 zipp==3.16.0 ```
jacobtylerwalls commented 1 year ago

Thanks. Can you also provide $PATH? That's usually the source of discrepancies like this.

astrojuanlu commented 1 year ago

I don't understand how the $PATH might affect here but there you go:

"Bad" machine:

(kedro_builder) circleci@ba9ad917c955:~/project$ which pylint
/home/circleci/miniconda/envs/kedro_builder/bin/pylint
(kedro_builder) circleci@ba9ad917c955:~/project$ pylint --version
pylint 2.17.4
astroid 2.15.6
Python 3.8.16 (default, Jun 12 2023, 18:09:05) 
[GCC 11.2.0]
(kedro_builder) circleci@ba9ad917c955:~/project$ echo $PATH
/home/circleci/miniconda/envs/kedro_builder/bin:/home/circleci/miniconda/condabin:/home/circleci/.local/bin:/home/circleci/bin:/home/circleci/.pyenv/shims:/home/circleci/.pyenv/bin:/home/circleci/.poetry/bin:/home/circleci/bin:/home/circleci/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

"Good" machine:

gitpod /workspace/kedro (dev/fix-requirements-take-2) $ which pylint
/home/gitpod/.pyenv/shims/pylint
gitpod /workspace/kedro (dev/fix-requirements-take-2) $ pylint --version
pylint 2.17.4
astroid 2.15.6
Python 3.8.15 (default, Jun 28 2023, 13:31:36) 
[GCC 11.3.0]
gitpod /workspace/kedro (dev/fix-requirements-take-2) $ echo $PATH
/home/gitpod/.sdkman/candidates/maven/current/bin:/home/gitpod/.sdkman/candidates/java/current/bin:/home/gitpod/.sdkman/candidates/gradle/current/bin:/workspace/.cargo/bin:/home/gitpod/.rvm/gems/ruby-3.2.1/bin:/home/gitpod/.rvm/gems/ruby-3.2.1@global/bin:/home/gitpod/.rvm/rubies/ruby-3.2.1/bin:/home/gitpod/.pyenv/shims:/workspace/go/bin:/home/gitpod/.nix-profile/bin:/ide/bin/remote-cli:/home/gitpod/go/bin:/home/gitpod/go-packages/bin:/home/gitpod/.nvm/versions/node/v18.16.0/bin:/home/gitpod/.yarn/bin:/home/gitpod/.pnpm:/home/gitpod/.pyenv/bin:/home/gitpod/.rvm/bin:/home/gitpod/.cargo/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin/:/home/gitpod/.local/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/gitpod/.nvm/versions/node/v18.16.0/bin
astrojuanlu commented 1 year ago

Bad machine = CircleCI job https://app.circleci.com/pipelines/github/kedro-org/kedro/24429/workflows/0abf7a3a-ee7a-43a1-a8e8-4211e0e58447/jobs/282191

Good machine = Any other machine, tested on both my local macOS and a Gitpod instance https://github.com/kedro-org/kedro/tree/dev/fix-requirements-take-2

jacobtylerwalls commented 1 year ago

I don't understand how the $PATH might affect here

wrong-import-order depends on the determination isort makes about whether a package is first-party or third-party. The value of $PATH can affect that determination depending on how things are packaged and also the current working directory. Whether that violates the principle of least surprise is a whole other thing, but it's the status quo at the moment.

Thanks for the additional details.

astrojuanlu commented 1 year ago

wrong-import-order depends on the determination isort makes about whether a package is first-party or third-party.

So, pylint uses isort under the hood?

That's interesting, because we're running pylint as part of a larger linting action using pre-commit, and in both cases isort runs ahead of pylint and deems the files correct.

jacobtylerwalls commented 1 year ago

Pylint might be doing additional patching of sys.path, see #5226.

jacobtylerwalls commented 1 year ago

Will keep this open for investigation. A fast workaround would be to add 'build' to known third party packages (on mobile, don't have the exact wording of the config option name).