pyright 1.1.403 started reporting "is not a known attribute of module"
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
Updated from `1.1.402` to `1.1.403` and started seeing `error: "CLIENT" is not a known attribute of module ".constants"`. In `pymysql`, the CLIENT constants are defined in `pymysql/constants/CLIENT.py`. I expect no error.
Reproduction repository: https://github.com/mickvangelderen/pyright-issue-10690
`main.py`
```
import pymysql.constants.CLIENT
def main():
print(f"MULTI_STATEMENTS: {pymysql.constants.CLIENT.MULTI_STATEMENTS}")
if __name__ == "__main__":
main()
```
`pyproject.toml`
```
[project]
name = "pyright-403-pymysql"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"pymysql>=1.1.1",
]
[dependency-groups]
dev = [
"pyright>=1.1.403",
]
```
`uv run pyright`
```
/home/mick/projects/pyright-403-pymysql/main.py
/home/mick/projects/pyright-403-pymysql/main.py:4:50 - error: "CLIENT" is not a known attribute of module ".constants" (reportAttributeAccessIssue)
1 error, 0 warnings, 0 informations
```
Contributor guide
Research direction
Start with the reproduction repository's main.py and pyproject.toml, then run uv run pyright with versions 1.1.402 and 1.1.403 to compare the diagnostics. Inspect how pymysql/constants/CLIENT.py is discovered through the pymysql.constants import; done means the CLIENT.MULTI_STATEMENTS access is accepted without an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100