Package version: nisystemlink-clients 2.32.1
Description
Every public class and model in the nisystemlink.clients.* packages triggers a reportPrivateImportUsage diagnostic in Pylance/Pyright, even though the symbols are accessible at runtime. For example:
"QuerySystemsRequest" is not exported from module "nisystemlink.clients.systems.models"
Import from "nisystemlink.clients.systems.models._query_systems_request" instead
"SystemsClient" is not exported from module "nisystemlink.clients.systems"
Import from "nisystemlink.clients.systems._systems_client" instead
"HttpConfiguration" is not exported from module "nisystemlink.clients.core"
Import from "nisystemlink.clients.core._http_configuration" instead
This affects all sub-packages: assetmanagement, core, product, systems, work_item, etc.
Root cause
The __init__.py files in each sub-package import from private _module files but do not re-export the symbols explicitly. PEP 484 and the Pylance/Pyright type checkers require that symbols be either defined directly in __init__.py or explicitly re-exported (e.g. from ._systems_client import SystemsClient as SystemsClient, or via __all__). Without this, type checkers treat the symbols as private even though they are publicly accessible at runtime.
Expected behavior
from nisystemlink.clients.systems import SystemsClient # no warning
from nisystemlink.clients.systems.models import QuerySystemsRequest # no warning
Workaround
Add reportPrivateImportUsage = "none" to pyproject.toml under [tool.pyright], which suppresses the warning project-wide at the cost of losing legitimate private-import detection elsewhere.
Fix
In each sub-package __init__.py, use explicit re-export syntax for all public symbols:
# Before
from ._systems_client import SystemsClient
# After
from ._systems_client import SystemsClient as SystemsClient # re-exported
Or add an __all__ list. Either approach tells Pylance/Pyright that the symbol is intentionally public.
Package version:
nisystemlink-clients 2.32.1Description
Every public class and model in the
nisystemlink.clients.*packages triggers areportPrivateImportUsagediagnostic in Pylance/Pyright, even though the symbols are accessible at runtime. For example:This affects all sub-packages:
assetmanagement,core,product,systems,work_item, etc.Root cause
The
__init__.pyfiles in each sub-package import from private_modulefiles but do not re-export the symbols explicitly. PEP 484 and the Pylance/Pyright type checkers require that symbols be either defined directly in__init__.pyor explicitly re-exported (e.g.from ._systems_client import SystemsClient as SystemsClient, or via__all__). Without this, type checkers treat the symbols as private even though they are publicly accessible at runtime.Expected behavior
Workaround
Add
reportPrivateImportUsage = "none"topyproject.tomlunder[tool.pyright], which suppresses the warning project-wide at the cost of losing legitimate private-import detection elsewhere.Fix
In each sub-package
__init__.py, use explicit re-export syntax for all public symbols:Or add an
__all__list. Either approach tells Pylance/Pyright that the symbol is intentionally public.