From 2c9730b11a2a6878a2c815b5aada69f4524d0670 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Wed, 24 Aug 2022 13:37:26 +0200 Subject: [PATCH] Add mypy doc (#1611) --- .../en/docs/instrumentation/python/mypy.md | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 content/en/docs/instrumentation/python/mypy.md diff --git a/content/en/docs/instrumentation/python/mypy.md b/content/en/docs/instrumentation/python/mypy.md new file mode 100644 index 000000000000..e8a98ad0bc15 --- /dev/null +++ b/content/en/docs/instrumentation/python/mypy.md @@ -0,0 +1,33 @@ +--- +title: Using mypy +--- + +If you're using [mypy](http://mypy-lang.org/), you'll need to turn on [namespace +packages](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-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: + +```toml +[tool.mypy] +namespace_packages = true +``` + +Or, use a command-line switch: + +```shell +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: + +```toml +[mypy-opentelemetry.sdk.*] +implicit_reexport = True +```