Skip to content

Pylint not detecting type stub modules #10284

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
jakeanq opened this issue Mar 18, 2025 · 1 comment
Closed

Pylint not detecting type stub modules #10284

jakeanq opened this issue Mar 18, 2025 · 1 comment
Labels
Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling

Comments

@jakeanq
Copy link

jakeanq commented Mar 18, 2025

Bug description

I'm trying to lint using type stubs from the types-usd package, which provides type stubs as pxr-stubs for the pxr USD module. I would at least like pylint to not complain about missing members.

Example code:

# pylint: disable=missing-docstring,missing-module-docstring
from pxr import Usd


def turtle(name: str) -> Usd.Stage:
    Usd.Stage.turtle()
    return Usd.Stage.Open(name)

Possibly related to #10017

Configuration

Command used

pylint --rcfile= test_usd.py

Adding --prefer-stubs y did not seem to make a difference.

Pylint output

************* Module test_usd
test_usd.py:2:0: E0401: Unable to import 'pxr' (import-error)

Note that if usd-core is installed (requires Python <3.13 currently), the error becomes:

************* Module test_usd
test_usd.py:5:25: E1101: Module 'pxr.Usd' has no 'Stage' member (no-member)
test_usd.py:6:4: E1101: Module 'pxr.Usd' has no 'Stage' member (no-member)
test_usd.py:7:11: E1101: Module 'pxr.Usd' has no 'Stage' member (no-member)

Expected behavior

Ideally a no-member error for Usd.Stage.turtle(), otherwise no errors would also be reasonable.

Note that pyright detects the stubs as expected:

.../pylint_usd/test_usd.py
  .../pylint_usd/test_usd.py:6:15 - error: Cannot access attribute "turtle" for class "type[Stage]"
    Attribute "turtle" is unknown (reportAttributeAccessIssue)
1 error, 0 warnings, 0 informations 

Pylint version

pylint 3.3.5
astroid 3.3.9
Python 3.13.1 (main, Dec  4 2024, 18:05:56) [GCC 14.2.1 20240910]

Also tried with Python 3.9.18

OS / Environment

Python 3.13.1 with Arch Linux
Python 3.9.18 with Rocky 9

Additional dependencies

astroid==3.3.9
dill==0.3.9
isort==6.0.1
mccabe==0.7.0
nodeenv==1.9.1
platformdirs==4.3.6
pylint==3.3.5
pyright==1.1.396
tomlkit==0.13.2
types-usd==24.5.2
typing_extensions==4.12.2
@jakeanq jakeanq added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 18, 2025
@Pierre-Sassoulas
Copy link
Member

Pylint does not use typing, I'm going to close as a duplicate of #4813

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling
Projects
None yet
Development

No branches or pull requests

2 participants