Skip to content

Commit

Permalink
ci: Update hatch to only run on 3.9 + 3.12 (#4745)
Browse files Browse the repository at this point in the history
* ci: Update hatch to only run on 3.9

* Ruff 🐶
  • Loading branch information
anticorrelator authored Sep 25, 2024
1 parent 4f5120b commit 7669fe5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ dependencies = [
]

[[tool.hatch.envs.type.matrix]]
python = ["3.8", "3.9", "3.12"]
python = ["3.9", "3.12"]

[tool.hatch.envs.style]
detached = true
Expand All @@ -230,7 +230,7 @@ dependencies = [
]

[[tool.hatch.envs.style.matrix]]
python = ["3.8", "3.9", "3.12"]
python = ["3.9", "3.12"]

[tool.hatch.envs.notebooks]
detached = true
Expand All @@ -250,7 +250,7 @@ tests = "pytest {args}"
coverage = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/phoenix --cov=tests {args}"

[[tool.hatch.envs.test.matrix]]
python = ["3.8", "3.12"]
python = ["3.9", "3.12"]

[tool.pytest.ini_options]
asyncio_mode = "auto"
Expand Down
24 changes: 8 additions & 16 deletions scripts/testing/send_spans.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import json
import logging
import time
Expand All @@ -10,7 +9,6 @@
from typing import Any, Dict, Iterator, Set, Tuple, Type

import numpy as np
import phoenix.trace.v1 as pb
from faker import Faker
from openinference.semconv.trace import (
DocumentAttributes,
Expand All @@ -23,11 +21,13 @@
ToolCallAttributes,
)
from opentelemetry import trace # Use the default tracer provider
from opentelemetry.trace import Tracer, SpanContext, StatusCode, Status
from opentelemetry.trace import SpanContext, Status, StatusCode, Tracer
from opentelemetry.util import types
from phoenix.trace import Evaluations
from typing_extensions import TypeAlias

import phoenix.trace.v1 as pb
from phoenix.trace import Evaluations

logging.basicConfig(level=logging.INFO)

NUM_TRACES = 1000
Expand Down Expand Up @@ -84,9 +84,7 @@ def _gen_spans(
span.set_attributes(dict(_gen_attributes(span_kind, num_docs)))
span.set_status(status)
if status_code is StatusCode.ERROR:
exc = Exception(
fake.paragraph(nb_sentences=randint(1, MAX_NUM_SENTENCES + 1))
)
exc = Exception(fake.paragraph(nb_sentences=randint(1, MAX_NUM_SENTENCES + 1)))
span.record_exception(exc)
if not recurse_depth:
return
Expand Down Expand Up @@ -181,18 +179,14 @@ def _gen_messages(
yield f"{prefix}.{i}.{MessageAttributes.MESSAGE_ROLE}", role
if role == "assistant" and random() < 0.25:
for j in range(randint(1, 10)):
tool_call_prefix = (
f"{prefix}.{i}.{MessageAttributes.MESSAGE_TOOL_CALLS}"
)
tool_call_prefix = f"{prefix}.{i}.{MessageAttributes.MESSAGE_TOOL_CALLS}"
yield (
f"{tool_call_prefix}.{j}.{ToolCallAttributes.TOOL_CALL_FUNCTION_NAME}",
fake.job(),
)
yield (
f"{tool_call_prefix}.{j}.{ToolCallAttributes.TOOL_CALL_FUNCTION_ARGUMENTS_JSON}",
json.dumps(
fake.pydict(randint(0, 10), allowed_types=(float, int, str))
),
json.dumps(fake.pydict(randint(0, 10), allowed_types=(float, int, str))),
)
continue
yield (
Expand Down Expand Up @@ -236,9 +230,7 @@ def _gen_documents(
if random() < 0.4:
yield (
f"{prefix}.{i}.{DocumentAttributes.DOCUMENT_METADATA}",
json.dumps(
fake.pydict(randint(0, 10), allowed_types=(float, int, str))
),
json.dumps(fake.pydict(randint(0, 10), allowed_types=(float, int, str))),
)


Expand Down

0 comments on commit 7669fe5

Please sign in to comment.