ni / ni/nisystemlink-clients-python
Public API symbols not re-exported from package __init__.py files, causing reportPrivateImportUsage errors in Pylance/Pyright
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10
- Forks
- 32
- Avg merge
- 12h 42m
- Merged PRs (30d)
- 2
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect the init.py files in the affected nisystemlink.clients sub-packages, starting with systems, systems.models, and core, and compare their imports with the private modules named in the diagnostics. Check pyproject.toml's [tool.pyright] settings and verify that Pylance/Pyright no longer reports private-import warnings for the documented public imports across the affected packages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100