Bug 2256378

Summary: pylint runs with user-installed packeges excluded
Product: [Fedora] Fedora Reporter: Vlado Potisk <reg.bugs>
Component: pylintAssignee: Gwyn Ciesla <gwync>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 39CC: gwync, orion, philip.wyett
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: pylint-3.0.3-3.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-01-18 01:45:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vlado Potisk 2024-01-01 17:18:50 UTC
/usr/bin/pylint starts with the line:

#! /usr/bin/python3 -sP

The -s option tells the Python not to add user site directory to sys.path. This obstructs checking of programs developed by the user. In my opinion the -s option should be removed.

Reproducible: Always

Steps to Reproduce:
1. select a python library/package name for testing,

   either na existing one from the output of:
       pip list --user

   or install from Pypi any arbitrary one not already present,
   preferrably small and without dependencies.
   I'm using a tiny utility "jsonstrip" just as an example:
       pip install --user jsonstrip

2. create a test.py file containing just the line "import jsonstrip",
   it is a correct python program albeit completely useless

3. verify that the program runs without errors:
      python test.py

4. run pylint test.py

5. (cleanup: remove test.py and uninstall jsonstrip)
Actual Results:  
pylint shows (among other lines):

   Unable to import 'jsonstrip' (import-error)

That is not true, see the step #3.

Expected Results:  
pylint should be able to import user-installed packages.

Comment 1 Gwyn Ciesla 2024-01-05 22:06:01 UTC
I see this, and I'm not sure what's adding that flag to the script.

Does testing with "python3 -m pylint test.py" work?

Comment 3 Gwyn Ciesla 2024-01-09 14:35:39 UTC
Ah ha, thank you! Update incoming.

Comment 4 Fedora Update System 2024-01-09 14:43:52 UTC
FEDORA-2024-19ce931ab4 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2024-19ce931ab4

Comment 5 Fedora Update System 2024-01-10 01:48:20 UTC
FEDORA-2024-19ce931ab4 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-19ce931ab4`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-19ce931ab4

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2024-01-18 01:45:36 UTC
FEDORA-2024-19ce931ab4 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.