Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation uses reexports that are not included in __all__ #2197

Open
linde12 opened this issue Jan 17, 2025 · 1 comment
Open

Documentation uses reexports that are not included in __all__ #2197

linde12 opened this issue Jan 17, 2025 · 1 comment
Labels
agent-python community Issues opened by the community triage Issues awaiting triage

Comments

@linde12
Copy link

linde12 commented Jan 17, 2025

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
@github-actions github-actions bot added agent-python community Issues opened by the community triage Issues awaiting triage labels Jan 17, 2025
@xrmx
Copy link
Member

xrmx commented Jan 17, 2025

That's strange, __all__ specifies the stuff you can import with * not what is exported https://docs.python.org/3/tutorial/modules.html#importing-from-a-package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-python community Issues opened by the community triage Issues awaiting triage
Projects
None yet
Development

No branches or pull requests

2 participants