Skip to content

Found fix to Pylint not working. #267

@ZedOud

Description

@ZedOud

Feature Request 🚀

To get Pylint working, a minor change needs to made to the setting.json.

    "python.analysis.typeshedPaths": [
        "~/.micropico-stubs/included"
    ],
    "python.analysis.extraPaths": [
        "~/.micropico-stubs/included",
        "${userHome}/.micropico-stubs/included"
    ],
    "pylint.args": ["--prefer-stubs=true"]

It doesn't seem necessary to change ~ to ${userHome} for typeshedPaths for it to work, I only include it for comparison. This is the preferred method to reference the home directory in VSCode, and what the Pylint extension asks for. However, it seems Pylance does not obey this convention, so both references to the folder must be included.

Only extraPaths needs to be altered and the pylint.args parameter added. Pylint support for stubs was added as mentioned in the Micropython-stubs documentation, and adding the argument they suggest allows it to work with the setup your extension provides.

edit:

Ok, my bad, it seems like we are waiting on the Micropython-stubs project to reformat their stubs? If you look at the Pylance stubPath argument, you can see that it asks for:
"Specifies a path to a directory that contains custom type stubs. Each package's type stub file(s) are expected to be in its own subdirectory."

This mirrors the language in the Micropython-stubs documentation:
all modules must be stored in modulename/__init__.pyi format, which is not the current format (modulename.pyi).

I'll be closing this, as it's not a simple/easy fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions