Skip to content

Commit 853b9fd

Browse files
authored
Merge branch 'main' into improve-baggage
2 parents c761d72 + 7acbfb4 commit 853b9fd

39 files changed

+700
-93
lines changed

.github/workflows/misc_0.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ jobs:
8888
- name: Run tests
8989
run: tox -e mypyinstalled
9090

91-
pyright:
92-
name: pyright
91+
typecheck:
92+
name: typecheck
9393
runs-on: ubuntu-latest
9494
steps:
9595
- name: Checkout repo @ SHA - ${{ github.sha }}
@@ -104,7 +104,7 @@ jobs:
104104
run: pip install tox
105105

106106
- name: Run tests
107-
run: tox -e pyright
107+
run: tox -e typecheck
108108

109109
docs:
110110
name: docs

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- semantic-conventions: Bump to 1.31.0
11+
([#4471](https://github.com/open-telemetry/opentelemetry-python/pull/4471))
1012
- Add type annotations to context's attach & detach
1113
([#4346](https://github.com/open-telemetry/opentelemetry-python/pull/4346))
1214
- Fix OTLP encoders missing instrumentation scope schema url and attributes

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ You can run `tox` with the following arguments:
6060
- `tox -e lint-some-package` to run lint checks on `some-package`
6161
- `tox -e generate-workflows` to run creation of new CI workflows if tox environments have been updated
6262
- `tox -e ruff` to run ruff linter and formatter checks against the entire codebase
63+
- `tox -e typecheck` to run pyright against entire code base.
64+
- `tox -e public-symbols-check` to run public_symbols_checker.py.
65+
- `tox -e docker-tests-{otlpexporter,opencensus}` to run tests in both or either one location.
66+
- `tox -e tracecontext` to run integration tests for tracecontext.
6367
- `tox -e precommit` to run all `pre-commit` actions
6468

6569
`ruff check` and `ruff format` are executed when `tox -e ruff` is run. We strongly recommend you to configure [pre-commit](https://pre-commit.com/) locally to run `ruff` automatically before each commit by installing it as git hooks. You just need to [install pre-commit](https://pre-commit.com/#install) in your environment:

dev-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pylint==3.2.1
22
httpretty==1.1.4
3+
pyright==1.1.396
34
mypy==1.9.0
45
sphinx==7.1.2
56
sphinx-rtd-theme==2.0.0rc4

mypy-requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ def create_gauge( # type: ignore # pylint: disable=no-self-use
447447
name: str,
448448
unit: str = "",
449449
description: str = "",
450-
) -> Gauge:
450+
) -> Gauge: # pyright: ignore[reportReturnType]
451451
"""Creates a ``Gauge`` instrument
452452
453453
Args:

opentelemetry-api/src/opentelemetry/util/_decorator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ def __enter__(self) -> R:
6262
except StopIteration:
6363
raise RuntimeError("generator didn't yield") from None
6464

65-
def __call__(self, func: V) -> V:
65+
def __call__(self, func: V) -> V: # pyright: ignore [reportIncompatibleMethodOverride]
6666
if asyncio.iscoroutinefunction(func):
6767

6868
@functools.wraps(func) # type: ignore
69-
async def async_wrapper(*args: Pargs, **kwargs: Pkwargs) -> R:
69+
async def async_wrapper(*args: Pargs, **kwargs: Pkwargs) -> R: # pyright: ignore [reportInvalidTypeVarUse]
7070
with self._recreate_cm(): # type: ignore
7171
return await func(*args, **kwargs) # type: ignore
7272

@@ -78,8 +78,8 @@ def _agnosticcontextmanager(
7878
func: "Callable[P, Iterator[R]]",
7979
) -> "Callable[P, _AgnosticContextManager[R]]":
8080
@functools.wraps(func)
81-
def helper(*args: Pargs, **kwargs: Pkwargs) -> _AgnosticContextManager[R]:
82-
return _AgnosticContextManager(func, args, kwargs)
81+
def helper(*args: Pargs, **kwargs: Pkwargs) -> _AgnosticContextManager[R]: # pyright: ignore [reportInvalidTypeVarUse]
82+
return _AgnosticContextManager(func, args, kwargs) # pyright: ignore [reportArgumentType]
8383

8484
# Ignoring the type to keep the original signature of the function
8585
return helper # type: ignore[return-value]

opentelemetry-api/tests/trace/test_globals.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,10 @@ class TestUseSpanException(Exception):
155155
raise TestUseSpanException("test error")
156156

157157
self.assertEqual(
158-
test_span.recorded_status.status_code, StatusCode.ERROR
158+
test_span.recorded_status.status_code, # type: ignore[reportAttributeAccessIssue]
159+
StatusCode.ERROR,
159160
)
160161
self.assertEqual(
161-
test_span.recorded_status.description,
162+
test_span.recorded_status.description, # type: ignore[reportAttributeAccessIssue]
162163
"TestUseSpanException: test error",
163164
)

opentelemetry-api/tests/util/test_once.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def test_once_single_thread(self):
2424
self.assertEqual(once_func.call_count, 0)
2525

2626
# first call should run
27-
called = once.do_once(once_func)
27+
called = once.do_once(once_func) # type: ignore[reportArgumentType]
2828
self.assertTrue(called)
2929
self.assertEqual(once_func.call_count, 1)
3030

3131
# subsequent calls do nothing
32-
called = once.do_once(once_func)
32+
called = once.do_once(once_func) # type: ignore[reportArgumentType]
3333
self.assertFalse(called)
3434
self.assertEqual(once_func.call_count, 1)
3535

@@ -38,7 +38,7 @@ def test_once_many_threads(self):
3838
once = Once()
3939

4040
def run_concurrently() -> bool:
41-
return once.do_once(once_func)
41+
return once.do_once(once_func) # type: ignore[reportArgumentType]
4242

4343
results = self.run_with_many_threads(run_concurrently, num_threads=100)
4444

opentelemetry-sdk/tests/metrics/test_backward_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
and PeriodicExportingMetricReader concrete class. Those may freely be modified in a
2323
backward-compatible way for *callers*.
2424
25-
Ideally, we could use mypy for this as well, but SDK is not type checked atm.
25+
Ideally, we could use pyright for this as well, but SDK is not type checked atm.
2626
"""
2727

2828
from typing import Iterable, Sequence

0 commit comments

Comments
 (0)