elastic / elastic/apm-agent-python

Documentation uses reexports that are not included in `__all__`

未关闭
#2,197 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
agent-python community triage
主要语言
Python
星标
431
派生
239
平均合并
5 天 10 小时
30 天内合并 PR
7

描述

**Describe the bug**:
The documentation for this library references decorators like `@elasticapm.capture_span()` or functions (e.g. `elasticapm.instrument()`) however they are not included in the `__all__` variable. This causes type checkers (e.g. pyright/mypy) to complain because they expect explicit reexports via `__all__`. What's weird is that `__all__` is defined, but the intended reexports (at least from looking at the documentation) are not added.

This makes it extremely confusing for someone that is new elasticapm, and the code becomes littered with`# pyright: ignore` comments or imports from various subpackages.

**To Reproduce**

1. Install pyright
2. Follow documentation (e.g. use a capture_span like so https://www.elastic.co/guide/en/apm/agent/python/current/instrumenting-custom-code.html#instrumenting-custom-code-spans)
3. Verify that pyright will complain that `"capture_span" is not exported from module "elasticapm" (Pyright reportPrivateImportUsage)`

**Environment (please complete the following information)**
- Agent version: 6.23.0

贡献指南

打开贡献指南

调研方向

先使用 pyright 复现文档中的 capture_span 示例,然后检查 elasticapm 的 __all__ 定义,并将其与文档中的顶层装饰器和函数进行比较。当文档中的导入被显式导出,并且 pyright 不再报告对私有导入的使用时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。