Skip to content

False positive no-name-in-module(E0611) in module nh3 #8756

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

Closed
jasperfirecai2 opened this issue Jun 9, 2023 · 12 comments
Closed

False positive no-name-in-module(E0611) in module nh3 #8756

jasperfirecai2 opened this issue Jun 9, 2023 · 12 comments
Labels
Duplicate 🐫 Duplicate of an already existing issue

Comments

@jasperfirecai2
Copy link

jasperfirecai2 commented Jun 9, 2023

Bug description

image
Intellisense can resolve this module import but pylint claims this not to not exist. nh3 has no pylint-plugin as it shouldn't need one. issue on their repo

Configuration

No response

Command used

pylint.exe --reports=n --output-format=json --rcfile=.pylintrc --from-stdin [...]/a.py

via pylint vscode plugin
OR

python -m pylint --rcfile=.pylintrc $(git ls-files '*.py')

Pylint output

************* Module a
a.py:19:0: E0611: No name 'clean' in module 'nh3' (no-name-in-module)

Expected behavior

There should be no linter warning here since the module resolves in both intellisense and code.

Pylint version

Legacy version because vscode plugin used to be broken

pylint 2.13.4
astroid 2.11.7
Python 3.9.1

Also applies to newer version

pylint 2.17.4
astroid 2.15.5
Python 3.9.1

OS / Environment

Windows 10 Enterprise 64-bit
vscode builtin terminal

Additional dependencies

for specific issue:
nh3==0.2.13

within project:
pylint-django==2.5.3
pylint-plugin-utils==0.8.2

@jasperfirecai2 jasperfirecai2 added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jun 9, 2023
@mbyrnepr2
Copy link
Member

Thanks @jasperfirecai2. I think this is the same situation as #6281.
nh3 is Rust but it does have a pyi file which we could potentially start checking.

@jasperfirecai2
Copy link
Author

nh3 is a wrapper for ammonia, which is written in rust aye

@mbyrnepr2 mbyrnepr2 added Needs decision 🔒 Needs a decision before implemention or rejection Needs specification 🔐 Accepted as a potential improvement, and needs to specify edge cases, message names, etc. and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 9, 2023
@Pierre-Sassoulas Pierre-Sassoulas added this to the 4.0.0 milestone Sep 25, 2023
@Zedifuu
Copy link

Zedifuu commented Feb 2, 2024

We are also experiencing this in our project, We have put in temporary exclusions for now and will monitor this thread for any changes. https://gitlab.com/crafty-controller/crafty-4/-/commit/ef691eda5c37ae0267cfd99d7d4c48f75d37d984

@Pierre-Sassoulas
Copy link
Member

It seems like it's a duplicate of #4987 (pyi support), and should be fixed. Are you using pylint 3 or more, and are you providing the pyi to pylint ? (Disclaimer: I'm not using pyi myself so I don't know for sure if it works, but it should).

@Pierre-Sassoulas Pierre-Sassoulas added Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning and removed Needs decision 🔒 Needs a decision before implemention or rejection Needs specification 🔐 Accepted as a potential improvement, and needs to specify edge cases, message names, etc. labels Feb 2, 2024
@Zedifuu
Copy link

Zedifuu commented Feb 2, 2024

Hi there,

Thank you for the rapid response, It's appreciated.
I'm not sure what you mean by pyi, All we've done is a standard install of nh3, use it in our application and then proceed to get the pylint findings, no extra pylint configuration has been applied for nh3.

nh3 0.2.14
Python 3.12.1
pip 23.2.1
pylint 3.0.3
astroid 3.0.2
pylint-gitlab 2.0.0

@Pierre-Sassoulas
Copy link
Member

nh3 is Rust but it does have a pyi file which we could potentially start checking.

pylint will need this pyi file to understand the rust code that it can't analyses. (Until recently it couldn't analyses the pyi file either). Or an inference tip that we call brain and that is more internal that that and that we call astroid brain, basically it would mean a pylint plugin for nh3.

@Zedifuu
Copy link

Zedifuu commented Feb 2, 2024

Oh that's super interesting I also love the naming of asteroid brain 🤩🧠
image

OK so I had a root around the nh3 package contents for the pyi file and did indeed find something promising. However how would I would direct pylint to this file to use it ? Is there configuration in the pylintrc?

Apologies if I am referencing something that has already been asked if there is documentation please direct me 😅

@Pierre-Sassoulas
Copy link
Member

I would make sure that the pyi is accessible by pylint (with the proper namespace like in nh3/__init__.py). I think what you have should work it seems it's in your virtual env or local install..

@Zedifuu
Copy link

Zedifuu commented Feb 2, 2024

Indeed the installation is pretty standard and set up in a virtual environment so I'm kind of stumped in why pylint isn't able to parse nh3 properly, And just checking there definitely isn't any place in the configuration to direct pylint with paths to these kind of files?

@jacobtylerwalls
Copy link
Member

@Pierre-Sassoulas I think for .pyi support we also need #9097, fixed in #9241, waiting on astroid 3.1.

@jacobtylerwalls jacobtylerwalls closed this as not planned Won't fix, can't repro, duplicate, stale Feb 4, 2024
@jacobtylerwalls jacobtylerwalls added Duplicate 🐫 Duplicate of an already existing issue and removed Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning labels Feb 4, 2024
@jacobtylerwalls jacobtylerwalls removed this from the 4.0.0 milestone Feb 4, 2024
@Zedifuu
Copy link

Zedifuu commented Feb 4, 2024

Ahh gocha thank you both for the updates <3

@Pierre-Sassoulas
Copy link
Member

I'm going to try to release astroid 3.1.0 asap then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

5 participants