Using mypy

If you’re using mypy, you’ll need to turn on namespace packages, otherwise mypy won’t be able to run correctly.

To turn on namespace packages, do one of the following:

Add the following to your project configuration file:

[tool.mypy]
namespace_packages = true

Or, use a command-line switch:

mypy --namespace-packages

Using the strict option

If you’re using the strict option with mypy, and you’re using the OpenTelemetry Python SDK (instead of just the API), you’ll need to also set the following in your project configuration file:

[mypy-opentelemetry.sdk.*]
implicit_reexport = True
Last modified October 28, 2022: Add Python API ref to sidebar (#1934) (e477e0a)