diff --git a/.github/workflows/misc_0.yml b/.github/workflows/misc_0.yml index 7de8653a12b..fbb06fd4743 100644 --- a/.github/workflows/misc_0.yml +++ b/.github/workflows/misc_0.yml @@ -88,6 +88,24 @@ jobs: - name: Run tests run: tox -e mypyinstalled + pyright: + name: pyright + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e pyright + docs: name: docs runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 86739f645f3..9848078bbde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +- Removed superfluous py.typed markers and added them where they were missing + ([#4172](https://github.com/open-telemetry/opentelemetry-python/pull/4172)) - Include metric info in encoding exceptions ([#4154](https://github.com/open-telemetry/opentelemetry-python/pull/4154)) - sdk: Add support for log formatting diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/py.typed b/exporter/opentelemetry-exporter-otlp-proto-http/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/exporter/opentelemetry-exporter-otlp/py.typed b/exporter/opentelemetry-exporter-otlp/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/exporter/opentelemetry-exporter-prometheus/py.typed b/exporter/opentelemetry-exporter-prometheus/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/py.typed b/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/py.typed similarity index 100% rename from exporter/opentelemetry-exporter-jaeger-proto-grpc/py.typed rename to exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/py.typed diff --git a/exporter/opentelemetry-exporter-zipkin-json/py.typed b/exporter/opentelemetry-exporter-zipkin-json/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/exporter/opentelemetry-exporter-zipkin-proto-http/py.typed b/exporter/opentelemetry-exporter-zipkin-proto-http/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/exporter/opentelemetry-exporter-zipkin/py.typed b/exporter/opentelemetry-exporter-zipkin/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-api/py.typed b/opentelemetry-api/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/exporter/opentelemetry-exporter-jaeger-thrift/py.typed b/opentelemetry-api/src/opentelemetry/_events/py.typed similarity index 100% rename from exporter/opentelemetry-exporter-jaeger-thrift/py.typed rename to opentelemetry-api/src/opentelemetry/_events/py.typed diff --git a/opentelemetry-proto/py.typed b/opentelemetry-proto/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/exporter/opentelemetry-exporter-jaeger/py.typed b/opentelemetry-proto/src/opentelemetry/proto/py.typed similarity index 100% rename from exporter/opentelemetry-exporter-jaeger/py.typed rename to opentelemetry-proto/src/opentelemetry/proto/py.typed diff --git a/opentelemetry-sdk/py.typed b/opentelemetry-sdk/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/py.typed b/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/py.typed b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables/py.typed b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/error_handler/py.typed b/opentelemetry-sdk/src/opentelemetry/sdk/error_handler/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/exporter/opentelemetry-exporter-opencensus/py.typed b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exponential_histogram/__init__.py similarity index 100% rename from exporter/opentelemetry-exporter-opencensus/py.typed rename to opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exponential_histogram/__init__.py diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/py.typed b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/resources/py.typed b/opentelemetry-sdk/src/opentelemetry/sdk/resources/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/py.typed b/opentelemetry-sdk/src/opentelemetry/sdk/trace/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/util/py.typed b/opentelemetry-sdk/src/opentelemetry/sdk/util/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/version/py.typed b/opentelemetry-sdk/src/opentelemetry/sdk/version/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-semantic-conventions/py.typed b/opentelemetry-semantic-conventions/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/exporter/opentelemetry-exporter-otlp-proto-common/py.typed b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/__init__.py similarity index 100% rename from exporter/opentelemetry-exporter-otlp-proto-common/py.typed rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/__init__.py diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/py.typed b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/py.typed b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/py.typed similarity index 100% rename from exporter/opentelemetry-exporter-otlp-proto-grpc/py.typed rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/py.typed diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/py.typed b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/py.typed b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/py.typed deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/pyproject.toml b/pyproject.toml index 01ae2999afc..873076c802c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,3 +18,12 @@ exclude = ''' [tool.pytest.ini_options] addopts = "-rs -v" log_cli = true + +[tool.pyright] +typeCheckingMode = "off" +reportMissingTypeStubs = "error" +include = [ + "opentelemetry-api/src", + "opentelemetry-sdk/src", + "opentelemetry-semantic-conventions/src", +] diff --git a/pyright-requirements.txt b/pyright-requirements.txt new file mode 100644 index 00000000000..bc67a370c05 --- /dev/null +++ b/pyright-requirements.txt @@ -0,0 +1 @@ +pyright==1.1.381 diff --git a/tox.ini b/tox.ini index 23f5947c4bd..973158af1f1 100644 --- a/tox.ini +++ b/tox.ini @@ -105,6 +105,7 @@ envlist = spellcheck tracecontext mypy,mypyinstalled + pyright docs docker-tests-proto{3,4} public-symbols-check @@ -445,3 +446,18 @@ commands_pre = commands = sh -c "find {toxinidir} -name \*.sh | xargs shellcheck --severity=warning" + +[testenv:pyright] +basepython: python3 + +allowlist_externals = pyright + +commands_pre = + pip install -r {toxinidir}/pyright-requirements.txt \ + -e {toxinidir}/opentelemetry-api \ + -e {toxinidir}/opentelemetry-semantic-conventions \ + -e {toxinidir}/opentelemetry-sdk + +commands = + pyright --version + pyright