Skip to content

Commit

Permalink
chore: remove attrs from dd-trace-py (#9868)
Browse files Browse the repository at this point in the history
## Motivation
Remove `attrs` dependency

Merge queue dependencies:
- [x] #9777
- [x] #9860
- [x] #9867

## Checklist
- [x] PR author has checked that all the criteria below are met
- The PR description includes an overview of the change
- The PR description articulates the motivation for the change
- The change includes tests OR the PR description describes a testing
strategy
- The PR description notes risks associated with the change, if any
- Newly-added code is easy to change
- The change follows the [library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist
- [x] Reviewer has checked that all the criteria below are met 
- Title is accurate
- All changes are related to the pull request's stated goal
- Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- Testing strategy adequately addresses listed risks
- Newly-added code is easy to change
- Release note makes sense to a user of the library
- If necessary, author has acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment
- Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
  • Loading branch information
gnufede authored Jul 19, 2024
1 parent 7e7ed58 commit 81fa854
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/f20bd15.in
# pip-compile --no-annotate .riot/requirements/50d0377.in
#
aiosqlite==0.17.0
annotated-types==0.7.0
Expand Down
4 changes: 1 addition & 3 deletions docker/Dockerfile_py311_debug_mode
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ RUN git clone --depth 1 --branch v3.11.6 https://github.com/python/cpython/ "${P
&& cd -

RUN python3.11 -m pip install -U pip \
&& python3.11 -m pip install cattrs setuptools cython wheel cmake pytest pytest-cov hypothesis pytest-memray\
&& python3.11 -m pip install setuptools cython wheel cmake pytest pytest-cov hypothesis pytest-memray\
memray==1.12.0 \
requests==2.31.0 \
attrs>=20 \
bytecode>=0.14.0 \
cattrs \
envier~=0.5 \
opentelemetry-api>=1 \
protobuf>=3 \
Expand Down
4 changes: 1 addition & 3 deletions docker/Dockerfile_py312_debug_mode
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ RUN git clone --depth 1 --branch v3.12.3 https://github.com/python/cpython/ "${P
&& cd -

RUN python3.12 -m pip install -U pip \
&& python3.12 -m pip install cattrs setuptools cython wheel cmake pytest pytest-cov hypothesis pytest-memray\
&& python3.12 -m pip install setuptools cython wheel cmake pytest pytest-cov hypothesis pytest-memray\
memray==1.12.0 \
requests==2.31.0 \
attrs>=20 \
bytecode>=0.14.0 \
cattrs \
envier~=0.5 \
opentelemetry-api>=1 \
protobuf>=3 \
Expand Down
3 changes: 0 additions & 3 deletions hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies = [
"mypy==0.991",
"coverage==7.3.0",
"envier==0.5.2",
"types-attrs==19.1.0",
"types-docutils==0.19.1.1",
"types-protobuf==3.20.4.5",
"types-PyYAML==6.0.12.2",
Expand Down Expand Up @@ -72,8 +71,6 @@ python = "3.10"
features = ["opentracing"]
dependencies = [ # copied from library dependencies
"protobuf>=3",
"attrs>=20",
"cattrs",
"typing_extensions",
"xmltodict>=0.12",
"envier",
Expand Down
23 changes: 13 additions & 10 deletions lib-injection/min_compatible_versions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ aiomysql,~=0.1.0
aiopg,~=0.16.0
aiosqlite,0
algoliasearch,~=2.5
anthropic,~=0.28
anyio,>=3.4.0
aredis,0
asgiref,~=3.0
asgiref,~=3.0.0
astunparse,0
async_generator,~=1.10
asyncpg,~=0.22.0
asynctest,==0.13.0
attrs,>=20
attrs,==22.1.0
austin-python,~=1.0
blinker,0
boto3,0
Expand All @@ -30,7 +31,7 @@ bottle,>=0.12
bytecode,0
cassandra-driver,~=3.24.0
cattrs,<23.1.1
celery,~=4.4
celery,~=5.1.0
cfn-lint,~=0.53.1
channels,~=3.0
cherrypy,>=17
Expand Down Expand Up @@ -62,18 +63,18 @@ elasticsearch8,~=8.0.1
elasticsearch[async],0
envier,==0.5.2
exceptiongroup,0
falcon,~=3.0
falcon,~=3.0.0
fastapi,~=0.64.0
flask,~=0.12.0
flask-caching,~=1.10.0
flask-login,~=0.6.2
flask-openapi3,0
gevent,~=20.12.0
git+https://github.com/gnufede/pytest-memray.git@24a3c0735db99eedf57fb36c573680f9bab7cd73,0
googleapis-common-protos,0
graphene,~=3.0.0
graphql-core,~=3.2.0
graphql-relay,0
greenlet,~=1.0.0
greenlet,~=1.0
grpcio,~=1.34.0
gunicorn,==20.0.4
gunicorn[gevent],0
Expand All @@ -87,13 +88,14 @@ itsdangerous,<2.0
jinja2,~=2.11.0
kombu,>=4.2.0
langchain,==0.0.192
langchain-aws,0
langchain-anthropic,==0.1.11
langchain-aws,==0.1.3
langchain-cohere,==0.1.4
langchain-community,==0.0.14
langchain-core,==0.1.52
langchain-openai,==0.1.6
langchain-pinecone,==0.1.0
langchain_experimental,==0.0.47
langsmith,==0.1.58
logbook,~=1.0.0
loguru,~=0.4.0
mako,~=1.1.0
Expand Down Expand Up @@ -139,11 +141,11 @@ pyramid,~=1.10
pysqlite3-binary,0
pytest,~=4.0
pytest-aiohttp,0
pytest-asyncio,==0.21.1
pytest-asyncio,~=0.21.1
pytest-bdd,>=4.0
pytest-benchmark,>=3.1.0
pytest-cov,==2.9.0
pytest-django,==3.10.0
pytest-django[testing],==3.10.0
pytest-mock,==2.0.0
pytest-randomly,0
pytest-sanic,~=1.6.2
Expand Down Expand Up @@ -177,6 +179,7 @@ urllib3,~=1.0
uwsgi,0
vcrpy,==4.2.1
vertica-python,>=0.6.0
virtualenv-clone,0
websockets,<11.0
webtest,0
werkzeug,<1.0
Expand Down
23 changes: 13 additions & 10 deletions min_compatible_versions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ aiomysql,~=0.1.0
aiopg,~=0.16.0
aiosqlite,0
algoliasearch,~=2.5
anthropic,~=0.28
anyio,>=3.4.0
aredis,0
asgiref,~=3.0
asgiref,~=3.0.0
astunparse,0
async_generator,~=1.10
asyncpg,~=0.22.0
asynctest,==0.13.0
attrs,>=20
attrs,==22.1.0
austin-python,~=1.0
blinker,0
boto3,0
Expand All @@ -30,7 +31,7 @@ bottle,>=0.12
bytecode,0
cassandra-driver,~=3.24.0
cattrs,<23.1.1
celery,~=4.4
celery,~=5.1.0
cfn-lint,~=0.53.1
channels,~=3.0
cherrypy,>=17
Expand Down Expand Up @@ -62,18 +63,18 @@ elasticsearch8,~=8.0.1
elasticsearch[async],0
envier,==0.5.2
exceptiongroup,0
falcon,~=3.0
falcon,~=3.0.0
fastapi,~=0.64.0
flask,~=0.12.0
flask-caching,~=1.10.0
flask-login,~=0.6.2
flask-openapi3,0
gevent,~=20.12.0
git+https://github.com/gnufede/pytest-memray.git@24a3c0735db99eedf57fb36c573680f9bab7cd73,0
googleapis-common-protos,0
graphene,~=3.0.0
graphql-core,~=3.2.0
graphql-relay,0
greenlet,~=1.0.0
greenlet,~=1.0
grpcio,~=1.34.0
gunicorn,==20.0.4
gunicorn[gevent],0
Expand All @@ -87,13 +88,14 @@ itsdangerous,<2.0
jinja2,~=2.11.0
kombu,>=4.2.0
langchain,==0.0.192
langchain-aws,0
langchain-anthropic,==0.1.11
langchain-aws,==0.1.3
langchain-cohere,==0.1.4
langchain-community,==0.0.14
langchain-core,==0.1.52
langchain-openai,==0.1.6
langchain-pinecone,==0.1.0
langchain_experimental,==0.0.47
langsmith,==0.1.58
logbook,~=1.0.0
loguru,~=0.4.0
mako,~=1.1.0
Expand Down Expand Up @@ -139,11 +141,11 @@ pyramid,~=1.10
pysqlite3-binary,0
pytest,~=4.0
pytest-aiohttp,0
pytest-asyncio,==0.21.1
pytest-asyncio,~=0.21.1
pytest-bdd,>=4.0
pytest-benchmark,>=3.1.0
pytest-cov,==2.9.0
pytest-django,==3.10.0
pytest-django[testing],==3.10.0
pytest-mock,==2.0.0
pytest-randomly,0
pytest-sanic,~=1.6.2
Expand Down Expand Up @@ -177,6 +179,7 @@ urllib3,~=1.0
uwsgi,0
vcrpy,==4.2.1
vertica-python,>=0.6.0
virtualenv-clone,0
websockets,<11.0
webtest,0
werkzeug,<1.0
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]
dependencies = [
"attrs>=20",
"bytecode>=0.15.0; python_version>='3.12'",
"bytecode>=0.14.0; python_version~='3.11.0'",
"bytecode>=0.13.0; python_version<'3.11'",
Expand Down
1 change: 0 additions & 1 deletion riotfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
"envier": "==0.5.2",
"cattrs": "<23.1.1",
"protobuf": ">=3",
"attrs": ">=20",
"typing_extensions": latest,
"xmltodict": ">=0.12",
"opentelemetry-api": ">=1",
Expand Down
10 changes: 5 additions & 5 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import contextlib
from contextlib import contextmanager
import dataclasses
import datetime as dt
from http.client import RemoteDisconnected
import inspect
Expand All @@ -11,7 +12,6 @@
from typing import List # noqa:F401
import urllib.parse

import attr
import pkg_resources
import pytest

Expand Down Expand Up @@ -977,10 +977,10 @@ class SnapshotFailed(Exception):
pass


@attr.s
class SnapshotTest(object):
token = attr.ib(type=str)
tracer = attr.ib(type=ddtrace.Tracer, default=ddtrace.tracer)
@dataclasses.dataclass
class SnapshotTest:
token: str
tracer: ddtrace.Tracer = ddtrace.tracer

def clear(self):
"""Clear any traces sent that were sent for this snapshot."""
Expand Down

0 comments on commit 81fa854

Please sign in to comment.