Skip to content

Package not re-exporting symbols in package __init__.py #1547

Closed
@tjohanssonn

Description

@tjohanssonn

Describe the bug

python-can is not re-exporting symbols correctly. This causes Pylance to not provide Intellisense when using e.g. Bus class, and also warns about usage of private import:

"Bus" is not exported from module "can" Pylance[reportPrivateImportUsage]

Link to webpage: reportPrivateImportUsage

To Reproduce

  1. Editor: Visual Studio Code
  2. Language server: Pylance
  3. Set configuration "python.analysis.typeCheckingMode": "basic"
  4. Minimum code example:
import can

bus = can.Bus(bustype='socketcan', channel='vcan0', bitrate=500000)

Expected behavior

Symbols imported in package/init.py should be publicly available, and not trigger a private import usage warning.

For more context on Pylance stance on this issue, see e.g. microsoft/pylance-release#2953 (comment)

Additional context

OS and version: Windows 10 22H2 OS build 19045.2728
Python version: 3.10.2
python-can version: 4.1.0
python-can interface/s (if applicable):

Screenshot of warning(s)

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions