Skip to content

Commit 47285a9

Browse files
authored
Drop support for py38 & uv chore upgrade (#606)
* py3.9 Signed-off-by: Teo <[email protected]> * trigger wf Signed-off-by: Teo <[email protected]> * add Python 3.13 support * remove devin test timing out CI Signed-off-by: Teo <[email protected]> --------- Signed-off-by: Teo <[email protected]>
1 parent 82f9bb9 commit 47285a9

File tree

9 files changed

+126
-273
lines changed

9 files changed

+126
-273
lines changed

.github/workflows/codecov.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/python-testing.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# :: Use nektos/act to run this locally
2+
# :: Example:
3+
# :: `act push -j python-tests --matrix python-version:3.10 --container-architecture linux/amd64`
4+
name: Python Tests
5+
on:
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- 'agentops/**/*.py'
12+
- 'agentops/**/*.ipynb'
13+
- 'tests/**/*.py'
14+
- 'tests/**/*.ipynb'
15+
pull_request:
16+
branches:
17+
- main
18+
paths:
19+
- 'agentops/**/*.py'
20+
- 'agentops/**/*.ipynb'
21+
- 'tests/**/*.py'
22+
- 'tests/**/*.ipynb'
23+
24+
jobs:
25+
python-tests:
26+
runs-on: ubuntu-latest
27+
env:
28+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
29+
30+
strategy:
31+
matrix:
32+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
33+
fail-fast: false
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Setup UV
39+
uses: astral-sh/setup-uv@v5
40+
continue-on-error: true
41+
with:
42+
python-version: ${{ matrix.python-version }}
43+
cache-prefix: uv-${{ matrix.python-version }}
44+
enable-cache: true
45+
cache-dependency-glob: "**/pyproject.toml"
46+
47+
- name: Install dependencies
48+
run: |
49+
uv sync --group test --group dev
50+
51+
- name: Run tests with coverage
52+
timeout-minutes: 10
53+
run: |
54+
uv run -m pytest tests/ -v --cov=agentops --cov-report=xml
55+
env:
56+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
57+
AGENTOPS_API_KEY: ${{ secrets.AGENTOPS_API_KEY }}
58+
PYTHONUNBUFFERED: "1"
59+
60+
# Only upload coverage report for python3.11
61+
- name: Upload coverage to Codecov
62+
if: ${{matrix.python-version == '3.11'}}
63+
uses: codecov/codecov-action@v5
64+
with:
65+
token: ${{ secrets.CODECOV_TOKEN }}
66+
files: ./coverage.xml
67+
flags: unittests
68+
name: codecov-umbrella
69+
fail_ci_if_error: true # Should we?

agentops/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import threading
1515
import traceback
1616
from decimal import Decimal
17+
from functools import cached_property
1718
from typing import List, Optional, Tuple, Union
1819
from uuid import UUID, uuid4
1920

@@ -27,7 +28,6 @@
2728
from .meta_client import MetaClient
2829
from .session import Session, active_sessions
2930
from .singleton import conditional_singleton
30-
from .helpers import cached_property
3131

3232

3333
@conditional_singleton

agentops/helpers.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -174,22 +174,3 @@ def wrapper(self, *args, **kwargs):
174174
return func(self, *args, **kwargs)
175175

176176
return wrapper
177-
178-
179-
class cached_property:
180-
"""
181-
Decorator that converts a method with a single self argument into a
182-
property cached on the instance.
183-
See: https://github.com/AgentOps-AI/agentops/issues/612
184-
"""
185-
186-
def __init__(self, func):
187-
self.func = func
188-
self.__doc__ = func.__doc__
189-
190-
def __get__(self, instance, cls=None):
191-
if instance is None:
192-
return self
193-
value = self.func(instance)
194-
setattr(instance, self.func.__name__, value)
195-
return value

pyproject.toml

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,20 @@ authors = [
99
{ name="Alex Reibman", email="[email protected]" },
1010
{ name="Shawn Qiu", email="[email protected]" },
1111
{ name="Braelyn Boynton", email="[email protected]" },
12-
{ name="Howard Gil", email="[email protected]" }
12+
{ name="Howard Gil", email="[email protected]" },
13+
{ name="Constantin Teodorescu", email="[email protected]" },
14+
{ name="Pratyush Shukla", email="[email protected]" }
1315
]
1416
description = "Observability and DevTool Platform for AI Agents"
1517
readme = "README.md"
16-
requires-python = ">=3.7"
18+
requires-python = ">=3.9,<3.14"
1719
classifiers = [
1820
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3.13",
1926
"License :: OSI Approved :: MIT License",
2027
"Operating System :: OS Independent",
2128
]
@@ -24,52 +31,69 @@ dependencies = [
2431
"psutil>=5.9.8,<6.1.0",
2532
"termcolor>=2.3.0,<2.5.0",
2633
"PyYAML>=5.3,<7.0",
27-
"opentelemetry-api>=1.22.0,<2.0.0", # API for interfaces
28-
"opentelemetry-sdk>=1.22.0,<2.0.0", # SDK for implementation
29-
"opentelemetry-exporter-otlp-proto-http>=1.22.0,<2.0.0", # For OTLPSpanExporter
34+
"opentelemetry-api>=1.22.0,<2.0.0",
35+
"opentelemetry-sdk>=1.22.0,<2.0.0",
36+
"opentelemetry-exporter-otlp-proto-http>=1.22.0,<2.0.0",
37+
# "typing-extensions>=4.9.0; python_version >= '3.8'",
38+
# "pydantic>=2.7.4,<3.0.0; python_version < '3.13'",
39+
# "pydantic-core>=2.23.4; python_version >= '3.8' and python_version < '3.13'"
3040
]
3141

3242
[dependency-groups]
33-
dev = [
34-
"pytest==7.4.0",
35-
"pytest-depends",
36-
"pytest-asyncio",
37-
"pytest-vcr",
38-
"pytest-mock",
39-
"pyfakefs",
40-
"requests_mock==1.11.0",
41-
"ruff",
42-
"vcrpy>=6.0.0; python_version >= '3.8'",
43-
"python-dotenv"
44-
]
45-
ci = [
46-
"tach~=0.9",
43+
test = [
44+
"openai>=1.0.0,<2.0.0",
45+
"langchain",
46+
"pytest-cov",
4747
]
4848

49-
[project.optional-dependencies]
50-
langchain = [
51-
"langchain==0.2.14; python_version >= '3.8.1'"
49+
dev = [
50+
# Testing essentials
51+
"pytest>=7.4.0,<8.0.0", # Testing framework with good async support
52+
"pytest-depends", # For testing complex agent workflows
53+
"pytest-asyncio", # Async test support for testing concurrent agent operations
54+
"pytest-mock", # Mocking capabilities for isolating agent components
55+
"pyfakefs", # File system testing
56+
"pytest-recording", # Alternative to pytest-vcr with better Python 3.x support
57+
"vcrpy @ git+https://github.com/kevin1024/vcrpy.git@81978659f1b18bbb7040ceb324a19114e4a4f328",
58+
# Code quality and type checking
59+
"ruff", # Fast Python linter for maintaining code quality
60+
"mypy", # Static type checking for better reliability
61+
"types-requests", # Type stubs for requests library
62+
63+
# HTTP mocking and environment
64+
"requests_mock>=1.11.0", # Mock HTTP requests for testing agent external communications
65+
"python-dotenv", # Environment management for secure testing
66+
67+
# Agent integration testing
5268
]
5369

70+
# CI dependencies
71+
ci = [
72+
"tach~=0.9" # Task runner for CI/CD pipelines
73+
]
5474

5575
[project.urls]
5676
Homepage = "https://github.com/AgentOps-AI/agentops"
5777
Issues = "https://github.com/AgentOps-AI/agentops/issues"
5878

79+
[tool.uv]
80+
compile-bytecode = true # Enable bytecode compilation for better performance
81+
default-groups = ["test", "dev"] # Default groups to install for development
82+
5983
[tool.autopep8]
6084
max_line_length = 120
6185

62-
[project.scripts]
63-
agentops = "agentops.cli:main"
64-
6586
[tool.pytest.ini_options]
66-
asyncio_mode = "strict"
67-
asyncio_default_fixture_loop_scope = "function"
87+
asyncio_mode = "auto"
88+
asyncio_default_fixture_loop_scope = "function" # WARNING: Changing this may break tests. A `module`-scoped session might be faster, but also unstable.
6889
test_paths = [
6990
"tests",
7091
]
71-
addopts = "--import-mode=importlib --tb=short -p no:warnings"
92+
addopts = "--tb=short -p no:warnings"
7293
pythonpath = ["."]
94+
faulthandler_timeout = 30 # Reduced from 60
95+
timeout = 60 # Reduced from 300
96+
disable_socket = true # Add this to prevent hanging on socket cleanup
7397

7498
[tool.ruff]
7599
line-length = 120

tests/openai_handlers/test_openai_integration.py

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)