Skip to content

Missing type exports for vendored py #10435

@The-Compiler

Description

@The-Compiler

I want to report a side effect of this change when using mypy. py used to be typed, while apparently the vendored library is not. Downstream developers that define pytest hooks may now see mypy errors like:

nbvalx/pytest_hooks_notebooks.py:32: error: Skipping analyzing "py": module is
installed, but missing library stubs or py.typed marker  [import]
    import py
    ^
nbvalx/pytest_hooks_notebooks.py:32: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
nbvalx/pytest_hooks_notebooks.py:412: error: Argument 2 to "collect_file"
becomes "Any" due to an unfollowed import  [no-any-unimported]
    def collect_file(file_path: pathlib.Path, path: py.path.local, parent:...
    ^

I'll leave it to you to decide if it is worth it to add back that support (downstream developers can easily add a couple of ignores, especially knowing that py.path is being deprecated anyway), but I want to report this here for future reference because at the beginning I couldn't wrap my head around what had happened (latest py release was one year ago, and surely I had ran my CI last week without errors) and it took me a while to figure out what was going on.

Cheers,
Francesco

Originally posted by @francesco-ballarin in #10396 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: typingtype-annotation issuetype: deprecationfeature that will be removed in the future

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions