Your message dated Wed, 17 Jan 2024 10:58:34 -0500
with message-id
<cab4xwxwu2qyw1pt9sbjx3lsjolv6s0zep_wkgbubehof7lr...@mail.gmail.com>
and subject line Re: Bug#1059546: pylint generates false positive
'import-error' with local editable modules.
has caused the Debian Bug report #1059546,
regarding pylint generates false positive 'import-error' with local editable
modules.
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
1059546: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1059546
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: pylint
Version: 2.16.2-2
Severity: important
Tags: upstream
X-Debbugs-Cc: [email protected]
Dear Maintainer,
This *might* be https://github.com/pylint-dev/pylint/issues/8829 . However, I
am new to this bits of the Python eco-system, so not confident in my
assessment.
When trying to run pylint against a module that imports an _editable_ module
install, a false positive 'import-error' is given.
To reproduce, I used the following toy module:
$ find -type f -exec printf '\n%s\n' {} \; -exec cat {} \;
./pyproject.toml
[project]
name = 'ttt'
version = '0'
./ttt/__init__.py
./ttt/pylintbug.py
"""Docstring."""
def bug_func():
"""Bug."""
print('I am the bug_func')
And this module for testing:
$ cat t.py
"""Docstring."""
from ttt import pylintbug
pylintbug.bug_func()
With the module not installed, nothing works, as expected:
# nothing installed
$ pip list --user ; date
Wed Dec 27 07:31:09 PM PST 2023
$ python --version
Python 3.11.2
$ python t.py
Traceback (most recent call last):
File "/home/nexus/t.py", line 3, in <module>
from ttt import pylintbug
ModuleNotFoundError: No module named 'ttt'
$ pylint --rcfile /dev/null t.py
************* Module t
t.py:3:0: E0401: Unable to import 'ttt' (import-error)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
Install the module:
$ pip install --break-system-packages .
Defaulting to user installation because normal site-packages is not writeable
Processing /home/nexus/src/ttt
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: ttt
Building wheel for ttt (pyproject.toml) ... done
Created wheel for ttt: filename=ttt-0-py3-none-any.whl size=1225
sha256=051948400d275bad5c31d656ef0394f8a43232d00754ab826bbe18dcd67d1c60
Stored in directory:
/tmp/pip-ephem-wheel-cache-upb4wjrt/wheels/c3/93/be/4d7b95f07076bb565c6c69548aef2e2868a95b899b724660dd
Successfully built ttt
Installing collected packages: ttt
Successfully installed ttt-0
And everything works as expected:
$ pip list --user ; date
Package Version
------- -------
ttt 0
Wed Dec 27 07:32:56 PM PST 2023
$ python t.py
I am the bug_func
$ pylint --rcfile /dev/null t.py
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 0.00/10, +10.00)
Now, install the module and reinstall in _editable_ mode (-e):
$ pip uninstall --break-system-packages -y ttt
Found existing installation: ttt 0
Uninstalling ttt-0:
Successfully uninstalled ttt-0
$ pip install --break-system-packages -e .
Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/nexus/src/ttt
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: ttt
Building editable for ttt (pyproject.toml) ... done
Created wheel for ttt: filename=ttt-0-0.editable-py3-none-any.whl size=2313
sha256=20eacec25143d7c0f57fed066c7c57dbed566853edc944919e1029a65349822b
Stored in directory:
/tmp/pip-ephem-wheel-cache-2sxotfjx/wheels/c3/93/be/4d7b95f07076bb565c6c69548aef2e2868a95b899b724660dd
Successfully built ttt
Installing collected packages: ttt
Successfully installed ttt-0
Now, executing the 't.py' script works, but pylint fails with the false
positive:
$ pip list --user ; date
Package Version Editable project location
------- ------- -------------------------
ttt 0 /home/nexus/src/ttt
Wed Dec 27 07:35:24 PM PST 2023
$ python t.py
I am the bug_func
$ pylint --rcfile /dev/null t.py
************* Module t
t.py:3:0: E0401: Unable to import 'ttt' (import-error)
--------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 10.00/10, -10.00)
Reinstalling the module in regular mode and it works again:
$ pip list --user ; date
Package Version
------- -------
ttt 0
Wed Dec 27 07:38:27 PM PST 2023
$ python t.py
I am the bug_func
$ pylint --rcfile /dev/null t.py
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
-- System Information:
Debian Release: 12.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-16-amd64 (SMP w/6 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages pylint depends on:
ii python3 3.11.2-1+b1
ii python3-astroid 2.14.2-1
ii python3-dill 0.3.6-1
ii python3-isort 5.6.4-1
ii python3-logilab-common 1.9.8-1
ii python3-mccabe 0.7.0-1
ii python3-platformdirs 2.6.0-1
ii python3-setuptools 66.1.1-1
ii python3-tomli 2.0.1-2
ii python3-tomlkit 0.11.7-1
ii python3-typing-extensions 4.4.0-1
Versions of packages pylint recommends:
ii python3-tk 3.11.2-3
Versions of packages pylint suggests:
pn pylint-doc <none>
-- no debconf information
--- End Message ---
--- Begin Message ---
control: tags -1 +wontfix
feel free to reopen once you verified on pylint/3.0.1
On Wed, Jan 17, 2024 at 10:57 AM Mike Castle <[email protected]> wrote:
>
> Easily replicable setup environment attached.
--
Sandro "morph" Tosi
My website: http://sandrotosi.me/
Me at Debian: http://wiki.debian.org/SandroTosi
Twitter: https://twitter.com/sandrotosi
--- End Message ---