elastic / elastic/apm-agent-python

Documentation uses reexports that are not included in `__all__`

Đang mở
#2,197 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
agent-python community triage
Ngôn ngữ chính
Python
Star
431
Fork
239
Merge trung bình
5 ngày 10 giờ
Pull request đã merge (30 ngày)
7

Mô tả

**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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện ví dụ capture_span được ghi trong tài liệu bằng pyright, sau đó kiểm tra định nghĩa __all__ của elasticapm và so sánh nó với các decorator và hàm cấp cao nhất được ghi trong tài liệu. Hoàn tất khi các import được ghi trong tài liệu được export một cách rõ ràng và pyright không còn báo cáo việc sử dụng import private.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.