Skip to content

Commit 94b9b27

Browse files
authored
Merge branch 'main' into bump-mypy
2 parents dd52013 + 29c293f commit 94b9b27

File tree

23 files changed

+53
-48
lines changed

23 files changed

+53
-48
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
([#3778](https://github.com/open-telemetry/opentelemetry-python/pull/3778))
2020
- Bump mypy to 1.9.0
2121
([#3795](https://github.com/open-telemetry/opentelemetry-python/pull/3795))
22+
- Fix license field in pyproject.toml files
23+
([#3803](https://github.com/open-telemetry/opentelemetry-python/pull/3803))
2224

2325
## Version 1.23.0/0.44b0 (2024-02-23)
2426

docs/examples/error_handler/error_handler_0/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "error-handler-0"
77
dynamic = ["version"]
88
description = "This is just an error handler example package"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

docs/examples/error_handler/error_handler_1/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "error-handler-1"
77
dynamic = ["version"]
88
description = "This is just an error handler example package"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

exporter/opentelemetry-exporter-opencensus/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-exporter-opencensus"
77
dynamic = ["version"]
88
description = "OpenCensus Exporter"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

exporter/opentelemetry-exporter-otlp-proto-common/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-exporter-otlp-proto-common"
77
dynamic = ["version"]
88
description = "OpenTelemetry Protobuf encoding"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-exporter-otlp-proto-grpc"
77
dynamic = ["version"]
88
description = "OpenTelemetry Collector Protobuf over gRPC Exporter"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-exporter-otlp-proto-http"
77
dynamic = ["version"]
88
description = "OpenTelemetry Collector Protobuf over HTTP Exporter"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

exporter/opentelemetry-exporter-otlp/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-exporter-otlp"
77
dynamic = ["version"]
88
description = "OpenTelemetry Collector Exporters"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

exporter/opentelemetry-exporter-prometheus/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-exporter-prometheus"
77
dynamic = ["version"]
88
description = "Prometheus Metric Exporter for OpenTelemetry"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

exporter/opentelemetry-exporter-zipkin-json/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-exporter-zipkin-json"
77
dynamic = ["version"]
88
description = "Zipkin Span JSON Exporter for OpenTelemetry"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

exporter/opentelemetry-exporter-zipkin-proto-http/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-exporter-zipkin-proto-http"
77
dynamic = ["version"]
88
description = "Zipkin Span Protobuf Exporter for OpenTelemetry"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

exporter/opentelemetry-exporter-zipkin/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-exporter-zipkin"
77
dynamic = ["version"]
88
description = "Zipkin Span Exporters for OpenTelemetry"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

opentelemetry-api/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66
name = "opentelemetry-api"
77
description = "OpenTelemetry Python API"
88
readme = "README.rst"
9-
license = "Apache-2.0"
9+
license = {text = "Apache-2.0"}
1010
requires-python = ">=3.8"
1111
authors = [
1212
{ name = "OpenTelemetry Authors", email = "[email protected]" },

opentelemetry-proto/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-proto"
77
dynamic = ["version"]
88
description = "OpenTelemetry Python Proto"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

opentelemetry-sdk/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-sdk"
77
dynamic = ["version"]
88
description = "OpenTelemetry Python SDK"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
Dict,
3131
Iterator,
3232
List,
33+
MutableMapping,
3334
Optional,
3435
Sequence,
3536
Tuple,
@@ -745,17 +746,17 @@ def __init__(
745746
parent: Optional[trace_api.SpanContext] = None,
746747
sampler: Optional[sampling.Sampler] = None,
747748
trace_config: None = None, # TODO
748-
resource: Resource = None,
749+
resource: Optional[Resource] = None,
749750
attributes: types.Attributes = None,
750-
events: Sequence[Event] = None,
751+
events: Optional[Sequence[Event]] = None,
751752
links: Sequence[trace_api.Link] = (),
752753
kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL,
753754
span_processor: SpanProcessor = SpanProcessor(),
754-
instrumentation_info: InstrumentationInfo = None,
755+
instrumentation_info: Optional[InstrumentationInfo] = None,
755756
record_exception: bool = True,
756757
set_status_on_exception: bool = True,
757758
limits=_UnsetLimits,
758-
instrumentation_scope: InstrumentationScope = None,
759+
instrumentation_scope: Optional[InstrumentationScope] = None,
759760
) -> None:
760761
if resource is None:
761762
resource = Resource.create({})
@@ -994,7 +995,7 @@ def record_exception(
994995
type(exception), value=exception, tb=exception.__traceback__
995996
)
996997
)
997-
_attributes = {
998+
_attributes: MutableMapping[str, types.AttributeValue] = {
998999
"exception.type": exception.__class__.__name__,
9991000
"exception.message": str(exception),
10001001
"exception.stacktrace": stacktrace,
@@ -1045,7 +1046,7 @@ def start_as_current_span(
10451046
context: Optional[context_api.Context] = None,
10461047
kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL,
10471048
attributes: types.Attributes = None,
1048-
links: Sequence[trace_api.Link] = (),
1049+
links: Optional[Sequence[trace_api.Link]] = (),
10491050
start_time: Optional[int] = None,
10501051
record_exception: bool = True,
10511052
set_status_on_exception: bool = True,
@@ -1075,7 +1076,7 @@ def start_span( # pylint: disable=too-many-locals
10751076
context: Optional[context_api.Context] = None,
10761077
kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL,
10771078
attributes: types.Attributes = None,
1078-
links: Sequence[trace_api.Link] = (),
1079+
links: Optional[Sequence[trace_api.Link]] = (),
10791080
start_time: Optional[int] = None,
10801081
record_exception: bool = True,
10811082
set_status_on_exception: bool = True,
@@ -1152,15 +1153,15 @@ class TracerProvider(trace_api.TracerProvider):
11521153

11531154
def __init__(
11541155
self,
1155-
sampler: sampling.Sampler = None,
1156-
resource: Resource = None,
1156+
sampler: Optional[sampling.Sampler] = None,
1157+
resource: Optional[Resource] = None,
11571158
shutdown_on_exit: bool = True,
11581159
active_span_processor: Union[
1159-
SynchronousMultiSpanProcessor, ConcurrentMultiSpanProcessor
1160+
SynchronousMultiSpanProcessor, ConcurrentMultiSpanProcessor, None
11601161
] = None,
1161-
id_generator: IdGenerator = None,
1162-
span_limits: SpanLimits = None,
1163-
):
1162+
id_generator: Optional[IdGenerator] = None,
1163+
span_limits: Optional[SpanLimits] = None,
1164+
) -> None:
11641165
self._active_span_processor = (
11651166
active_span_processor or SynchronousMultiSpanProcessor()
11661167
)

opentelemetry-sdk/src/opentelemetry/sdk/trace/sampling.py

+17-15
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def __init__(
184184
self,
185185
decision: Decision,
186186
attributes: "Attributes" = None,
187-
trace_state: "TraceState" = None,
187+
trace_state: Optional["TraceState"] = None,
188188
) -> None:
189189
self.decision = decision
190190
if attributes is None:
@@ -201,10 +201,10 @@ def should_sample(
201201
parent_context: Optional["Context"],
202202
trace_id: int,
203203
name: str,
204-
kind: SpanKind = None,
204+
kind: Optional[SpanKind] = None,
205205
attributes: Attributes = None,
206-
links: Sequence["Link"] = None,
207-
trace_state: "TraceState" = None,
206+
links: Optional[Sequence["Link"]] = None,
207+
trace_state: Optional["TraceState"] = None,
208208
) -> "SamplingResult":
209209
pass
210210

@@ -216,18 +216,18 @@ def get_description(self) -> str:
216216
class StaticSampler(Sampler):
217217
"""Sampler that always returns the same decision."""
218218

219-
def __init__(self, decision: "Decision"):
219+
def __init__(self, decision: "Decision") -> None:
220220
self._decision = decision
221221

222222
def should_sample(
223223
self,
224224
parent_context: Optional["Context"],
225225
trace_id: int,
226226
name: str,
227-
kind: SpanKind = None,
227+
kind: Optional[SpanKind] = None,
228228
attributes: Attributes = None,
229-
links: Sequence["Link"] = None,
230-
trace_state: "TraceState" = None,
229+
links: Optional[Sequence["Link"]] = None,
230+
trace_state: Optional["TraceState"] = None,
231231
) -> "SamplingResult":
232232
if self._decision is Decision.DROP:
233233
attributes = None
@@ -285,10 +285,10 @@ def should_sample(
285285
parent_context: Optional["Context"],
286286
trace_id: int,
287287
name: str,
288-
kind: SpanKind = None,
288+
kind: Optional[SpanKind] = None,
289289
attributes: Attributes = None,
290-
links: Sequence["Link"] = None,
291-
trace_state: "TraceState" = None,
290+
links: Optional[Sequence["Link"]] = None,
291+
trace_state: Optional["TraceState"] = None,
292292
) -> "SamplingResult":
293293
decision = Decision.DROP
294294
if trace_id & self.TRACE_ID_LIMIT < self.bound:
@@ -340,10 +340,10 @@ def should_sample(
340340
parent_context: Optional["Context"],
341341
trace_id: int,
342342
name: str,
343-
kind: SpanKind = None,
343+
kind: Optional[SpanKind] = None,
344344
attributes: Attributes = None,
345-
links: Sequence["Link"] = None,
346-
trace_state: "TraceState" = None,
345+
links: Optional[Sequence["Link"]] = None,
346+
trace_state: Optional["TraceState"] = None,
347347
) -> "SamplingResult":
348348
parent_span_context = get_current_span(
349349
parent_context
@@ -443,7 +443,9 @@ def _get_from_env_or_default() -> Sampler:
443443
return _KNOWN_SAMPLERS[trace_sampler]
444444

445445

446-
def _get_parent_trace_state(parent_context) -> Optional["TraceState"]:
446+
def _get_parent_trace_state(
447+
parent_context: Optional[Context],
448+
) -> Optional["TraceState"]:
447449
parent_span_context = get_current_span(parent_context).get_span_context()
448450
if parent_span_context is None or not parent_span_context.is_valid:
449451
return None

opentelemetry-semantic-conventions/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-semantic-conventions"
77
dynamic = ["version"]
88
description = "OpenTelemetry Semantic Conventions"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

propagator/opentelemetry-propagator-b3/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-propagator-b3"
77
dynamic = ["version"]
88
description = "OpenTelemetry B3 Propagator"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

propagator/opentelemetry-propagator-jaeger/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-propagator-jaeger"
77
dynamic = ["version"]
88
description = "OpenTelemetry Jaeger Propagator"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

shim/opentelemetry-opencensus-shim/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-opencensus-shim"
77
dynamic = ["version"]
88
description = "OpenCensus Shim for OpenTelemetry"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

shim/opentelemetry-opentracing-shim/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-opentracing-shim"
77
dynamic = ["version"]
88
description = "OpenTracing Shim for OpenTelemetry"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

tests/opentelemetry-test-utils/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "opentelemetry-test-utils"
77
dynamic = ["version"]
88
description = "Test utilities for OpenTelemetry unit tests"
99
readme = "README.rst"
10-
license = "Apache-2.0"
10+
license = {text = "Apache-2.0"}
1111
requires-python = ">=3.8"
1212
authors = [
1313
{ name = "OpenTelemetry Authors", email = "[email protected]" },

0 commit comments

Comments
 (0)