Skip to content

Commit

Permalink
Fix the py.typed marker file usage (open-telemetry#4172)
Browse files Browse the repository at this point in the history
* Fix the py.typed marker file usage

As defined in PEP 561, the py.typed marker files for namespace packages
should be placed "in the submodules of the namespace". In commit
732ea8a, the markers were added to the subpackage roots, which serves no
purpose. This changeset addresses all marker-related issues in this
repository.

A summary of the changes:

- Removed the unnecessary py.typed markers from the subpackage roots.
- Added the missing marker to the prometheus exporter. Fixes open-telemetry#4113.
- Added the missing marker to opentelemetry._events.
- Removed the accidentally reintroduced jaeger exporters, which were
  originally removed in commit 1625b35.

* Add missing py.typed

* Add pyright and fix the reported issues

* Update the generated workflow

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
  • Loading branch information
4 people authored Sep 30, 2024
1 parent cafd7f2 commit fd169a7
Show file tree
Hide file tree
Showing 33 changed files with 46 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/misc_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file removed opentelemetry-api/py.typed
Empty file.
Empty file removed opentelemetry-proto/py.typed
Empty file.
Empty file removed opentelemetry-sdk/py.typed
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
1 change: 1 addition & 0 deletions pyright-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyright==1.1.381
16 changes: 16 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ envlist =
spellcheck
tracecontext
mypy,mypyinstalled
pyright
docs
docker-tests-proto{3,4}
public-symbols-check
Expand Down Expand Up @@ -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

0 comments on commit fd169a7

Please sign in to comment.