Skip to content

pylance reportPrivateImportUsage #283

@zigai

Description

@zigai

When using VS Code, pylance (v2024.7.1, latest) frequently reports reportPrivateImportUsage errors when importing classes.
image

These errors can be fixed by defining a __all__ list in the module's __init__.py file, which explicitly declares the public names for the module.

Here's an example for the http_crawler module:

from .http_crawler import HttpCrawler
from .types import HttpCrawlingContext, HttpCrawlingResult

__all__ = ["HttpCrawler", "HttpCrawlingContext", "HttpCrawlingResult"]

Metadata

Metadata

Assignees

Labels

bugSomething isn't working.t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions