arize-phoenix 5.5.2__py3-none-any.whl → 5.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of arize-phoenix might be problematic. Click here for more details.

Files changed (172) hide show
  1. {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/METADATA +3 -6
  2. {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/RECORD +171 -171
  3. phoenix/config.py +8 -8
  4. phoenix/core/model.py +3 -3
  5. phoenix/core/model_schema.py +41 -50
  6. phoenix/core/model_schema_adapter.py +17 -16
  7. phoenix/datetime_utils.py +2 -2
  8. phoenix/db/bulk_inserter.py +10 -20
  9. phoenix/db/engines.py +2 -1
  10. phoenix/db/enums.py +2 -2
  11. phoenix/db/helpers.py +8 -7
  12. phoenix/db/insertion/dataset.py +9 -19
  13. phoenix/db/insertion/document_annotation.py +14 -13
  14. phoenix/db/insertion/helpers.py +6 -16
  15. phoenix/db/insertion/span_annotation.py +14 -13
  16. phoenix/db/insertion/trace_annotation.py +14 -13
  17. phoenix/db/insertion/types.py +19 -30
  18. phoenix/db/migrations/versions/3be8647b87d8_add_token_columns_to_spans_table.py +8 -8
  19. phoenix/db/models.py +28 -28
  20. phoenix/experiments/evaluators/base.py +2 -1
  21. phoenix/experiments/evaluators/code_evaluators.py +4 -5
  22. phoenix/experiments/evaluators/llm_evaluators.py +157 -4
  23. phoenix/experiments/evaluators/utils.py +3 -2
  24. phoenix/experiments/functions.py +10 -21
  25. phoenix/experiments/tracing.py +2 -1
  26. phoenix/experiments/types.py +20 -29
  27. phoenix/experiments/utils.py +2 -1
  28. phoenix/inferences/errors.py +6 -5
  29. phoenix/inferences/fixtures.py +6 -5
  30. phoenix/inferences/inferences.py +37 -37
  31. phoenix/inferences/schema.py +11 -10
  32. phoenix/inferences/validation.py +13 -14
  33. phoenix/logging/_formatter.py +3 -3
  34. phoenix/metrics/__init__.py +5 -4
  35. phoenix/metrics/binning.py +2 -1
  36. phoenix/metrics/metrics.py +2 -1
  37. phoenix/metrics/mixins.py +7 -6
  38. phoenix/metrics/retrieval_metrics.py +2 -1
  39. phoenix/metrics/timeseries.py +5 -4
  40. phoenix/metrics/wrappers.py +2 -2
  41. phoenix/pointcloud/clustering.py +3 -4
  42. phoenix/pointcloud/pointcloud.py +7 -5
  43. phoenix/pointcloud/umap_parameters.py +2 -1
  44. phoenix/server/api/dataloaders/annotation_summaries.py +12 -19
  45. phoenix/server/api/dataloaders/average_experiment_run_latency.py +2 -2
  46. phoenix/server/api/dataloaders/cache/two_tier_cache.py +3 -2
  47. phoenix/server/api/dataloaders/dataset_example_revisions.py +3 -8
  48. phoenix/server/api/dataloaders/dataset_example_spans.py +2 -5
  49. phoenix/server/api/dataloaders/document_evaluation_summaries.py +12 -18
  50. phoenix/server/api/dataloaders/document_evaluations.py +3 -7
  51. phoenix/server/api/dataloaders/document_retrieval_metrics.py +6 -13
  52. phoenix/server/api/dataloaders/experiment_annotation_summaries.py +4 -8
  53. phoenix/server/api/dataloaders/experiment_error_rates.py +2 -5
  54. phoenix/server/api/dataloaders/experiment_run_annotations.py +3 -7
  55. phoenix/server/api/dataloaders/experiment_run_counts.py +1 -5
  56. phoenix/server/api/dataloaders/experiment_sequence_number.py +2 -5
  57. phoenix/server/api/dataloaders/latency_ms_quantile.py +21 -30
  58. phoenix/server/api/dataloaders/min_start_or_max_end_times.py +7 -13
  59. phoenix/server/api/dataloaders/project_by_name.py +3 -3
  60. phoenix/server/api/dataloaders/record_counts.py +11 -18
  61. phoenix/server/api/dataloaders/span_annotations.py +3 -7
  62. phoenix/server/api/dataloaders/span_dataset_examples.py +3 -8
  63. phoenix/server/api/dataloaders/span_descendants.py +3 -7
  64. phoenix/server/api/dataloaders/span_projects.py +2 -2
  65. phoenix/server/api/dataloaders/token_counts.py +12 -19
  66. phoenix/server/api/dataloaders/trace_row_ids.py +3 -7
  67. phoenix/server/api/dataloaders/user_roles.py +3 -3
  68. phoenix/server/api/dataloaders/users.py +3 -3
  69. phoenix/server/api/helpers/__init__.py +4 -3
  70. phoenix/server/api/helpers/dataset_helpers.py +10 -9
  71. phoenix/server/api/input_types/AddExamplesToDatasetInput.py +2 -2
  72. phoenix/server/api/input_types/AddSpansToDatasetInput.py +2 -2
  73. phoenix/server/api/input_types/ChatCompletionMessageInput.py +13 -1
  74. phoenix/server/api/input_types/ClusterInput.py +2 -2
  75. phoenix/server/api/input_types/DeleteAnnotationsInput.py +1 -3
  76. phoenix/server/api/input_types/DeleteDatasetExamplesInput.py +2 -2
  77. phoenix/server/api/input_types/DeleteExperimentsInput.py +1 -3
  78. phoenix/server/api/input_types/DimensionFilter.py +4 -4
  79. phoenix/server/api/input_types/Granularity.py +1 -1
  80. phoenix/server/api/input_types/InvocationParameters.py +2 -2
  81. phoenix/server/api/input_types/PatchDatasetExamplesInput.py +2 -2
  82. phoenix/server/api/mutations/dataset_mutations.py +4 -4
  83. phoenix/server/api/mutations/experiment_mutations.py +1 -2
  84. phoenix/server/api/mutations/export_events_mutations.py +7 -7
  85. phoenix/server/api/mutations/span_annotations_mutations.py +4 -4
  86. phoenix/server/api/mutations/trace_annotations_mutations.py +4 -4
  87. phoenix/server/api/mutations/user_mutations.py +4 -4
  88. phoenix/server/api/openapi/schema.py +2 -2
  89. phoenix/server/api/queries.py +20 -20
  90. phoenix/server/api/routers/oauth2.py +4 -4
  91. phoenix/server/api/routers/v1/datasets.py +22 -36
  92. phoenix/server/api/routers/v1/evaluations.py +6 -5
  93. phoenix/server/api/routers/v1/experiment_evaluations.py +2 -2
  94. phoenix/server/api/routers/v1/experiment_runs.py +2 -2
  95. phoenix/server/api/routers/v1/experiments.py +4 -4
  96. phoenix/server/api/routers/v1/spans.py +13 -12
  97. phoenix/server/api/routers/v1/traces.py +5 -5
  98. phoenix/server/api/routers/v1/utils.py +5 -5
  99. phoenix/server/api/subscriptions.py +284 -162
  100. phoenix/server/api/types/AnnotationSummary.py +3 -3
  101. phoenix/server/api/types/Cluster.py +8 -7
  102. phoenix/server/api/types/Dataset.py +5 -4
  103. phoenix/server/api/types/Dimension.py +3 -3
  104. phoenix/server/api/types/DocumentEvaluationSummary.py +8 -7
  105. phoenix/server/api/types/EmbeddingDimension.py +6 -5
  106. phoenix/server/api/types/EvaluationSummary.py +3 -3
  107. phoenix/server/api/types/Event.py +7 -7
  108. phoenix/server/api/types/Experiment.py +3 -3
  109. phoenix/server/api/types/ExperimentComparison.py +2 -4
  110. phoenix/server/api/types/Inferences.py +9 -8
  111. phoenix/server/api/types/InferencesRole.py +2 -2
  112. phoenix/server/api/types/Model.py +2 -2
  113. phoenix/server/api/types/Project.py +11 -18
  114. phoenix/server/api/types/Segments.py +3 -3
  115. phoenix/server/api/types/Span.py +8 -7
  116. phoenix/server/api/types/TimeSeries.py +8 -7
  117. phoenix/server/api/types/Trace.py +2 -2
  118. phoenix/server/api/types/UMAPPoints.py +6 -6
  119. phoenix/server/api/types/User.py +3 -3
  120. phoenix/server/api/types/node.py +1 -3
  121. phoenix/server/api/types/pagination.py +4 -4
  122. phoenix/server/api/utils.py +2 -4
  123. phoenix/server/app.py +16 -25
  124. phoenix/server/bearer_auth.py +4 -10
  125. phoenix/server/dml_event.py +3 -3
  126. phoenix/server/dml_event_handler.py +10 -24
  127. phoenix/server/grpc_server.py +3 -2
  128. phoenix/server/jwt_store.py +22 -21
  129. phoenix/server/main.py +3 -3
  130. phoenix/server/oauth2.py +3 -2
  131. phoenix/server/rate_limiters.py +5 -8
  132. phoenix/server/static/.vite/manifest.json +31 -31
  133. phoenix/server/static/assets/components-C70HJiXz.js +1612 -0
  134. phoenix/server/static/assets/{index-DCzakdJq.js → index-DLe1Oo3l.js} +2 -2
  135. phoenix/server/static/assets/{pages-CAL1FDMt.js → pages-C8-Sl7JI.js} +269 -434
  136. phoenix/server/static/assets/{vendor-6IcPAw_j.js → vendor-CtqfhlbC.js} +6 -6
  137. phoenix/server/static/assets/{vendor-arizeai-DRZuoyuF.js → vendor-arizeai-C_3SBz56.js} +2 -2
  138. phoenix/server/static/assets/{vendor-codemirror-DVE2_WBr.js → vendor-codemirror-wfdk9cjp.js} +1 -1
  139. phoenix/server/static/assets/{vendor-recharts-DwrexFA4.js → vendor-recharts-BiVnSv90.js} +1 -1
  140. phoenix/server/thread_server.py +1 -1
  141. phoenix/server/types.py +17 -29
  142. phoenix/services.py +4 -3
  143. phoenix/session/client.py +12 -24
  144. phoenix/session/data_extractor.py +3 -3
  145. phoenix/session/evaluation.py +1 -2
  146. phoenix/session/session.py +11 -20
  147. phoenix/trace/attributes.py +16 -28
  148. phoenix/trace/dsl/filter.py +17 -21
  149. phoenix/trace/dsl/helpers.py +3 -3
  150. phoenix/trace/dsl/query.py +13 -22
  151. phoenix/trace/fixtures.py +11 -17
  152. phoenix/trace/otel.py +5 -15
  153. phoenix/trace/projects.py +3 -2
  154. phoenix/trace/schemas.py +2 -2
  155. phoenix/trace/span_evaluations.py +9 -8
  156. phoenix/trace/span_json_decoder.py +3 -3
  157. phoenix/trace/span_json_encoder.py +2 -2
  158. phoenix/trace/trace_dataset.py +6 -5
  159. phoenix/trace/utils.py +6 -6
  160. phoenix/utilities/deprecation.py +3 -2
  161. phoenix/utilities/error_handling.py +3 -2
  162. phoenix/utilities/json.py +2 -1
  163. phoenix/utilities/logging.py +2 -2
  164. phoenix/utilities/project.py +1 -1
  165. phoenix/utilities/re.py +3 -4
  166. phoenix/utilities/template_formatters.py +5 -4
  167. phoenix/version.py +1 -1
  168. phoenix/server/static/assets/components-hX0LgYz3.js +0 -1428
  169. {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/WHEEL +0 -0
  170. {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/entry_points.txt +0 -0
  171. {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/licenses/IP_NOTICE +0 -0
  172. {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/licenses/LICENSE +0 -0
phoenix/trace/schemas.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from dataclasses import dataclass
2
2
  from datetime import datetime
3
3
  from enum import Enum
4
- from typing import Any, List, Mapping, NamedTuple, Optional
4
+ from typing import Any, Mapping, NamedTuple, Optional
5
5
  from uuid import UUID
6
6
 
7
7
  EXCEPTION_TYPE = "exception.type"
@@ -169,7 +169,7 @@ class Span:
169
169
  OpenTelemetry Inspiration:
170
170
  https://opentelemetry.io/docs/concepts/signals/traces/#span-events
171
171
  """
172
- events: List[SpanEvent]
172
+ events: list[SpanEvent]
173
173
 
174
174
  """
175
175
  An extension of the OpenTelemetry Span interface to include the
@@ -1,10 +1,11 @@
1
1
  import json
2
2
  from abc import ABC
3
+ from collections.abc import Callable, Mapping, Sequence
3
4
  from dataclasses import dataclass, field
4
5
  from itertools import product
5
6
  from pathlib import Path
6
7
  from types import MappingProxyType
7
- from typing import Any, Callable, List, Mapping, Optional, Sequence, Set, Tuple, Type, Union
8
+ from typing import Any, Optional, Union
8
9
  from uuid import UUID, uuid4
9
10
 
10
11
  import pandas as pd
@@ -20,11 +21,11 @@ EVAL_PARQUET_FILE_NAME = "evaluations-{id}.parquet"
20
21
 
21
22
 
22
23
  class NeedsNamedIndex(ABC):
23
- index_names: Mapping[Tuple[str, ...], Callable[[Any], bool]]
24
- all_valid_index_name_sorted_combos: Set[Tuple[str, ...]]
24
+ index_names: Mapping[tuple[str, ...], Callable[[Any], bool]]
25
+ all_valid_index_name_sorted_combos: set[tuple[str, ...]]
25
26
 
26
27
  @classmethod
27
- def preferred_names(cls) -> List[str]:
28
+ def preferred_names(cls) -> list[str]:
28
29
  return [choices[0] for choices in cls.index_names.keys()]
29
30
 
30
31
  @classmethod
@@ -43,7 +44,7 @@ class NeedsNamedIndex(ABC):
43
44
  )
44
45
 
45
46
  @classmethod
46
- def find_valid_index_names(cls, dtypes: "pd.Series[Any]") -> Optional[List[str]]:
47
+ def find_valid_index_names(cls, dtypes: "pd.Series[Any]") -> Optional[list[str]]:
47
48
  valid_names = []
48
49
  for names, check_type in cls.index_names.items():
49
50
  for name in names:
@@ -92,7 +93,7 @@ class Evaluations(NeedsNamedIndex, NeedsResultColumns, ABC):
92
93
  f"dataframe=<rows: {len(self.dataframe)!r}>)"
93
94
  )
94
95
 
95
- def __dir__(self) -> List[str]:
96
+ def __dir__(self) -> list[str]:
96
97
  return ["get_dataframe"]
97
98
 
98
99
  def get_dataframe(self, prefix_columns_with_name: bool = True) -> pd.DataFrame:
@@ -153,7 +154,7 @@ class Evaluations(NeedsNamedIndex, NeedsResultColumns, ABC):
153
154
 
154
155
  def __init_subclass__(
155
156
  cls,
156
- index_names: Mapping[Tuple[str, ...], Callable[[Any], bool]],
157
+ index_names: Mapping[tuple[str, ...], Callable[[Any], bool]],
157
158
  **kwargs: Any,
158
159
  ) -> None:
159
160
  super().__init_subclass__(**kwargs)
@@ -327,7 +328,7 @@ class TraceEvaluations(
327
328
  ): ...
328
329
 
329
330
 
330
- def _parse_schema_metadata(schema: Schema) -> Tuple[UUID, str, Type[Evaluations]]:
331
+ def _parse_schema_metadata(schema: Schema) -> tuple[UUID, str, type[Evaluations]]:
331
332
  """
332
333
  Validates and parses the pyarrow schema metadata.
333
334
  """
@@ -1,6 +1,6 @@
1
1
  import json
2
2
  from datetime import datetime
3
- from typing import Any, Dict, Optional
3
+ from typing import Any, Optional
4
4
 
5
5
  from openinference.semconv.trace import SpanAttributes
6
6
 
@@ -22,7 +22,7 @@ INPUT_MIME_TYPE = SpanAttributes.INPUT_MIME_TYPE
22
22
  OUTPUT_MIME_TYPE = SpanAttributes.OUTPUT_MIME_TYPE
23
23
 
24
24
 
25
- def json_to_attributes(obj: Optional[Dict[str, Any]]) -> Dict[str, Any]:
25
+ def json_to_attributes(obj: Optional[dict[str, Any]]) -> dict[str, Any]:
26
26
  if obj is None:
27
27
  return {}
28
28
  if not isinstance(obj, dict):
@@ -34,7 +34,7 @@ def json_to_attributes(obj: Optional[Dict[str, Any]]) -> Dict[str, Any]:
34
34
  return obj
35
35
 
36
36
 
37
- def json_to_span(data: Dict[str, Any]) -> Any:
37
+ def json_to_span(data: dict[str, Any]) -> Any:
38
38
  """
39
39
  A hook for json.loads to convert a dict to a Span object.
40
40
  """
@@ -2,7 +2,7 @@ import json
2
2
  from dataclasses import asdict
3
3
  from datetime import datetime
4
4
  from enum import Enum
5
- from typing import Any, List
5
+ from typing import Any
6
6
  from uuid import UUID
7
7
 
8
8
  import numpy as np
@@ -60,5 +60,5 @@ def span_to_json(span: Span) -> str:
60
60
  return json.dumps(span, cls=SpanJSONEncoder)
61
61
 
62
62
 
63
- def spans_to_jsonl(spans: List[Span]) -> str:
63
+ def spans_to_jsonl(spans: list[Span]) -> str:
64
64
  return "\n".join(span_to_json(span) for span in spans)
@@ -1,7 +1,8 @@
1
1
  import json
2
+ from collections.abc import Iterable, Iterator
2
3
  from datetime import datetime
3
4
  from pathlib import Path
4
- from typing import Any, Iterable, Iterator, List, Optional, Tuple, Union, cast
5
+ from typing import Any, Optional, Union, cast
5
6
  from uuid import UUID, uuid4
6
7
  from warnings import warn
7
8
 
@@ -116,7 +117,7 @@ class TraceDataset:
116
117
  A human readable name for the dataset.
117
118
  """
118
119
  dataframe: pd.DataFrame
119
- evaluations: List[Evaluations] = []
120
+ evaluations: list[Evaluations] = []
120
121
  _id: UUID
121
122
  _data_file_name: str = "data.parquet"
122
123
 
@@ -152,11 +153,11 @@ class TraceDataset:
152
153
  self.evaluations = list(evaluations)
153
154
 
154
155
  @classmethod
155
- def from_spans(cls, spans: List[Span]) -> "TraceDataset":
156
+ def from_spans(cls, spans: list[Span]) -> "TraceDataset":
156
157
  """Creates a TraceDataset from a list of spans.
157
158
 
158
159
  Args:
159
- spans (List[Span]): A list of spans.
160
+ spans (list[Span]): A list of spans.
160
161
 
161
162
  Returns:
162
163
  TraceDataset: A TraceDataset containing the spans.
@@ -349,7 +350,7 @@ class TraceDataset:
349
350
  return pd.concat([df, evals_df], axis=1)
350
351
 
351
352
 
352
- def _parse_schema_metadata(schema: Schema) -> Tuple[UUID, str, List[UUID]]:
353
+ def _parse_schema_metadata(schema: Schema) -> tuple[UUID, str, list[UUID]]:
353
354
  """
354
355
  Returns parsed metadata from a parquet schema or raises an exception if the
355
356
  metadata is invalid.
phoenix/trace/utils.py CHANGED
@@ -2,7 +2,7 @@ import json
2
2
  import os
3
3
  import re
4
4
  from traceback import format_exception
5
- from typing import List, Optional, Tuple, cast
5
+ from typing import Optional, cast
6
6
  from urllib import request
7
7
 
8
8
  import pandas as pd
@@ -14,16 +14,16 @@ def parse_file_extension(file_path: str) -> str:
14
14
 
15
15
  def download_json_traces_fixture(
16
16
  url: str,
17
- ) -> List[str]:
17
+ ) -> list[str]:
18
18
  """
19
19
  Stores the traces fixture as list of jsons from the jsonl files in the phoenix bucket.
20
20
  """
21
21
 
22
22
  with request.urlopen(url) as f:
23
- return cast(List[str], f.readlines())
23
+ return cast(list[str], f.readlines())
24
24
 
25
25
 
26
- def json_lines_to_df(lines: List[str]) -> pd.DataFrame:
26
+ def json_lines_to_df(lines: list[str]) -> pd.DataFrame:
27
27
  """
28
28
  Convert a list of JSON line strings to a Pandas DataFrame.
29
29
  """
@@ -56,9 +56,9 @@ def get_stacktrace(exception: BaseException) -> str:
56
56
  _VERSION_TRIPLET_REGEX = re.compile(r"(\d+)\.(\d+)\.(\d+)")
57
57
 
58
58
 
59
- def extract_version_triplet(version: str) -> Optional[Tuple[int, int, int]]:
59
+ def extract_version_triplet(version: str) -> Optional[tuple[int, int, int]]:
60
60
  return (
61
- cast(Tuple[int, int, int], tuple(map(int, match.groups())))
61
+ cast(tuple[int, int, int], tuple(map(int, match.groups())))
62
62
  if (match := _VERSION_TRIPLET_REGEX.search(version))
63
63
  else None
64
64
  )
@@ -1,8 +1,9 @@
1
1
  import functools
2
2
  import warnings
3
- from typing import Any, Callable, Type, TypeVar
3
+ from collections.abc import Callable
4
+ from typing import Any, TypeVar
4
5
 
5
- GenericClass = TypeVar("GenericClass", bound=Type[Any])
6
+ GenericClass = TypeVar("GenericClass", bound=type[Any])
6
7
  CallableType = TypeVar("CallableType", bound=Callable[..., Any])
7
8
 
8
9
 
@@ -1,12 +1,13 @@
1
1
  import logging
2
2
  import traceback
3
- from typing import Any, Callable, Iterable, Optional, Type, TypeVar, cast
3
+ from collections.abc import Callable, Iterable
4
+ from typing import Any, Optional, TypeVar, cast
4
5
 
5
6
  F = TypeVar("F", bound=Callable[..., Any])
6
7
 
7
8
 
8
9
  def graceful_fallback(
9
- fallback_method: Callable[..., Any], exceptions: Optional[Iterable[Type[BaseException]]] = None
10
+ fallback_method: Callable[..., Any], exceptions: Optional[Iterable[type[BaseException]]] = None
10
11
  ) -> Callable[[F], F]:
11
12
  """
12
13
  Decorator that reroutes failing functions to a specified fallback method.
phoenix/utilities/json.py CHANGED
@@ -1,8 +1,9 @@
1
1
  import dataclasses
2
2
  import datetime
3
+ from collections.abc import Mapping, Sequence
3
4
  from enum import Enum
4
5
  from pathlib import Path
5
- from typing import Any, Mapping, Sequence, Union, get_args, get_origin
6
+ from typing import Any, Union, get_args, get_origin
6
7
 
7
8
  import numpy as np
8
9
  from strawberry import UNSET
@@ -1,6 +1,6 @@
1
1
  # A collection of printing and logging utilities
2
2
 
3
- from typing import Any, List
3
+ from typing import Any
4
4
 
5
5
  from tqdm.auto import tqdm
6
6
 
@@ -10,7 +10,7 @@ def printif(condition: bool, *args: Any, **kwargs: Any) -> None:
10
10
  tqdm.write(*args, **kwargs)
11
11
 
12
12
 
13
- def log_a_list(list_of_str: List[str], join_word: str) -> str:
13
+ def log_a_list(list_of_str: list[str], join_word: str) -> str:
14
14
  if list_of_str is None or len(list_of_str) == 0:
15
15
  return ""
16
16
  if len(list_of_str) == 1:
@@ -1,4 +1,4 @@
1
- from typing import Iterable
1
+ from collections.abc import Iterable
2
2
 
3
3
  from openinference.semconv.resource import ResourceAttributes
4
4
  from opentelemetry.proto.common.v1.common_pb2 import KeyValue
phoenix/utilities/re.py CHANGED
@@ -1,6 +1,5 @@
1
1
  import logging
2
2
  from re import compile, split
3
- from typing import Dict, List
4
3
  from urllib.parse import unquote
5
4
 
6
5
  logger = logging.getLogger(__name__)
@@ -19,7 +18,7 @@ _HEADER_PATTERN = compile(_KEY_VALUE_FORMAT)
19
18
  _DELIMITER_PATTERN = compile(r"[ \t]*,[ \t]*")
20
19
 
21
20
 
22
- def parse_env_headers(s: str) -> Dict[str, str]:
21
+ def parse_env_headers(s: str) -> dict[str, str]:
23
22
  """
24
23
  Parse ``s``, which is a ``str`` instance containing HTTP headers encoded
25
24
  for use in ENV variables per the W3C Baggage HTTP header format at
@@ -28,8 +27,8 @@ def parse_env_headers(s: str) -> Dict[str, str]:
28
27
 
29
28
  src: https://github.com/open-telemetry/opentelemetry-python/blob/2d5cd58f33bd8a16f45f30be620a96699bc14297/opentelemetry-api/src/opentelemetry/util/re.py#L52
30
29
  """
31
- headers: Dict[str, str] = {}
32
- headers_list: List[str] = split(_DELIMITER_PATTERN, s)
30
+ headers: dict[str, str] = {}
31
+ headers_list: list[str] = split(_DELIMITER_PATTERN, s)
33
32
  for header in headers_list:
34
33
  if not header: # empty string
35
34
  continue
@@ -1,12 +1,13 @@
1
1
  import re
2
2
  from abc import ABC, abstractmethod
3
+ from collections.abc import Iterable
3
4
  from string import Formatter
4
- from typing import Any, Iterable, Set
5
+ from typing import Any
5
6
 
6
7
 
7
8
  class TemplateFormatter(ABC):
8
9
  @abstractmethod
9
- def parse(self, template: str) -> Set[str]:
10
+ def parse(self, template: str) -> set[str]:
10
11
  """
11
12
  Parse the template and return a set of variable names.
12
13
  """
@@ -37,7 +38,7 @@ class FStringTemplateFormatter(TemplateFormatter):
37
38
  'world'
38
39
  """
39
40
 
40
- def parse(self, template: str) -> Set[str]:
41
+ def parse(self, template: str) -> set[str]:
41
42
  return set(field_name for _, field_name, _, _ in Formatter().parse(template) if field_name)
42
43
 
43
44
  def _format(self, template: str, variable_names: Iterable[str], **variables: Any) -> str:
@@ -57,7 +58,7 @@ class MustacheTemplateFormatter(TemplateFormatter):
57
58
 
58
59
  PATTERN = re.compile(r"(?<!\\){{\s*(\w+)\s*}}")
59
60
 
60
- def parse(self, template: str) -> Set[str]:
61
+ def parse(self, template: str) -> set[str]:
61
62
  return set(match for match in re.findall(self.PATTERN, template))
62
63
 
63
64
  def _format(self, template: str, variable_names: Iterable[str], **variables: Any) -> str:
phoenix/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "5.5.2"
1
+ __version__ = "5.6.0"