influxdata / influxdata/influxdb-client-python

Public symbols not properly exported with `py.typed` present — triggers Pylance/Pyright errors

オープン
#694 コメント 0 件 リアクション 6 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
793
フォーク
186
平均マージ
3時間 2分
マージ済み PR(30日)
1

説明

Hi team,

Thanks for maintaining this package — it's a great tool for working with InfluxDB.

I'm opening this issue to report a problem that affects type checkers and IDEs (like Pyright, Pylance, and mypy) due to the presence of the `py.typed` file in the `influxdb-client-python` package.

Since the package declares itself as typed (via `py.typed`, per [[PEP 561](https://peps.python.org/pep-0561/)](https://peps.python.org/pep-0561/)), tools like **Pyright** and **Pylance** apply stricter rules around public API exposure. Specifically, **public symbols must be explicitly exported** using either:

* a `__all__` list in `__init__.py`, or
* `.pyi` stub files.

Currently, this is not the case for the main client class. When importing `InfluxDBClient` from the top-level module as documented:

```python
from influxdb_client import InfluxDBClient
```

Pylance (and Pyright) raises the following error:

```
"InfluxDBClient" is not exported from module "influxdb_client"
Import from "influxdb_client.client.influxdb_client" instead
Pylance: reportPrivateImportUsage
```

This is confusing to users and suggests that the public API is not properly defined.

### Suggested solutions

To resolve this and ensure compatibility with type checkers, here are a few possible approaches:

1. **Add `__all__` to `influxdb_client/__init__.py`** to explicitly define the intended public interface.
2. **Provide proper `.pyi` stub files** that describe the public API.
3. If full typing support is not maintained, **consider removing the `py.typed` file** to avoid stricter validation.

Improving this would help developers relying on static analysis and IDE support, and reduce confusion about which imports are officially supported.

Thanks again for your work and for considering this issue!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず influxdb_client/__init__.py とパッケージの py.typed マーカーを調べ、次に Pyright または Pylance でドキュメントに記載された `from influxdb_client import InfluxDBClient` のインポートを再現します。意図された公開エクスポートを特定し、トップレベルのインポートで報告されたプライベートインポートの診断が発生しなくなったことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。