Skip to content

pymysql error: "CLIENT" is not a known attribute of module ".constants" #14392

Closed as not planned
@mickvangelderen

Description

@mickvangelderen

Something isn't right about the pymysql typestubs.

Found out by updating pyright from 1.1.402 to 1.1.403 which comes with new typestubs, see microsoft/pyright#10690 (comment).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions