Skip to content

Commit

Permalink
Drop support for py38 & uv chore upgrade (#606)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
teocns authored Dec 30, 2024
1 parent 82f9bb9 commit 47285a9
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 273 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/codecov.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/python-testing.yml

This file was deleted.

69 changes: 69 additions & 0 deletions .github/workflows/python-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# :: Use nektos/act to run this locally
# :: Example:
# :: `act push -j python-tests --matrix python-version:3.10 --container-architecture linux/amd64`
name: Python Tests
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'agentops/**/*.py'
- 'agentops/**/*.ipynb'
- 'tests/**/*.py'
- 'tests/**/*.ipynb'
pull_request:
branches:
- main
paths:
- 'agentops/**/*.py'
- 'agentops/**/*.ipynb'
- 'tests/**/*.py'
- 'tests/**/*.ipynb'

jobs:
python-tests:
runs-on: ubuntu-latest
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Setup UV
uses: astral-sh/setup-uv@v5
continue-on-error: true
with:
python-version: ${{ matrix.python-version }}
cache-prefix: uv-${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- name: Install dependencies
run: |
uv sync --group test --group dev
- name: Run tests with coverage
timeout-minutes: 10
run: |
uv run -m pytest tests/ -v --cov=agentops --cov-report=xml
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
AGENTOPS_API_KEY: ${{ secrets.AGENTOPS_API_KEY }}
PYTHONUNBUFFERED: "1"

# Only upload coverage report for python3.11
- name: Upload coverage to Codecov
if: ${{matrix.python-version == '3.11'}}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true # Should we?
2 changes: 1 addition & 1 deletion agentops/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import threading
import traceback
from decimal import Decimal
from functools import cached_property
from typing import List, Optional, Tuple, Union
from uuid import UUID, uuid4

Expand All @@ -27,7 +28,6 @@
from .meta_client import MetaClient
from .session import Session, active_sessions
from .singleton import conditional_singleton
from .helpers import cached_property


@conditional_singleton
Expand Down
19 changes: 0 additions & 19 deletions agentops/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,3 @@ def wrapper(self, *args, **kwargs):
return func(self, *args, **kwargs)

return wrapper


class cached_property:
"""
Decorator that converts a method with a single self argument into a
property cached on the instance.
See: https://github.com/AgentOps-AI/agentops/issues/612
"""

def __init__(self, func):
self.func = func
self.__doc__ = func.__doc__

def __get__(self, instance, cls=None):
if instance is None:
return self
value = self.func(instance)
setattr(instance, self.func.__name__, value)
return value
80 changes: 52 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@ authors = [
{ name="Alex Reibman", email="[email protected]" },
{ name="Shawn Qiu", email="[email protected]" },
{ name="Braelyn Boynton", email="[email protected]" },
{ name="Howard Gil", email="[email protected]" }
{ name="Howard Gil", email="[email protected]" },
{ name="Constantin Teodorescu", email="[email protected]" },
{ name="Pratyush Shukla", email="[email protected]" }
]
description = "Observability and DevTool Platform for AI Agents"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.9,<3.14"
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
Expand All @@ -24,52 +31,69 @@ dependencies = [
"psutil>=5.9.8,<6.1.0",
"termcolor>=2.3.0,<2.5.0",
"PyYAML>=5.3,<7.0",
"opentelemetry-api>=1.22.0,<2.0.0", # API for interfaces
"opentelemetry-sdk>=1.22.0,<2.0.0", # SDK for implementation
"opentelemetry-exporter-otlp-proto-http>=1.22.0,<2.0.0", # For OTLPSpanExporter
"opentelemetry-api>=1.22.0,<2.0.0",
"opentelemetry-sdk>=1.22.0,<2.0.0",
"opentelemetry-exporter-otlp-proto-http>=1.22.0,<2.0.0",
# "typing-extensions>=4.9.0; python_version >= '3.8'",
# "pydantic>=2.7.4,<3.0.0; python_version < '3.13'",
# "pydantic-core>=2.23.4; python_version >= '3.8' and python_version < '3.13'"
]

[dependency-groups]
dev = [
"pytest==7.4.0",
"pytest-depends",
"pytest-asyncio",
"pytest-vcr",
"pytest-mock",
"pyfakefs",
"requests_mock==1.11.0",
"ruff",
"vcrpy>=6.0.0; python_version >= '3.8'",
"python-dotenv"
]
ci = [
"tach~=0.9",
test = [
"openai>=1.0.0,<2.0.0",
"langchain",
"pytest-cov",
]

[project.optional-dependencies]
langchain = [
"langchain==0.2.14; python_version >= '3.8.1'"
dev = [
# Testing essentials
"pytest>=7.4.0,<8.0.0", # Testing framework with good async support
"pytest-depends", # For testing complex agent workflows
"pytest-asyncio", # Async test support for testing concurrent agent operations
"pytest-mock", # Mocking capabilities for isolating agent components
"pyfakefs", # File system testing
"pytest-recording", # Alternative to pytest-vcr with better Python 3.x support
"vcrpy @ git+https://github.com/kevin1024/vcrpy.git@81978659f1b18bbb7040ceb324a19114e4a4f328",
# Code quality and type checking
"ruff", # Fast Python linter for maintaining code quality
"mypy", # Static type checking for better reliability
"types-requests", # Type stubs for requests library

# HTTP mocking and environment
"requests_mock>=1.11.0", # Mock HTTP requests for testing agent external communications
"python-dotenv", # Environment management for secure testing

# Agent integration testing
]

# CI dependencies
ci = [
"tach~=0.9" # Task runner for CI/CD pipelines
]

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

[tool.uv]
compile-bytecode = true # Enable bytecode compilation for better performance
default-groups = ["test", "dev"] # Default groups to install for development

[tool.autopep8]
max_line_length = 120

[project.scripts]
agentops = "agentops.cli:main"

[tool.pytest.ini_options]
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function" # WARNING: Changing this may break tests. A `module`-scoped session might be faster, but also unstable.
test_paths = [
"tests",
]
addopts = "--import-mode=importlib --tb=short -p no:warnings"
addopts = "--tb=short -p no:warnings"
pythonpath = ["."]
faulthandler_timeout = 30 # Reduced from 60
timeout = 60 # Reduced from 300
disable_socket = true # Add this to prevent hanging on socket cleanup

[tool.ruff]
line-length = 120
Expand Down
69 changes: 0 additions & 69 deletions tests/openai_handlers/test_openai_integration.py

This file was deleted.

Loading

0 comments on commit 47285a9

Please sign in to comment.