From 00e7656fee36d09546e3b22422c424b85ba19780 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Thu, 13 Nov 2025 15:43:50 -0500 Subject: [PATCH 1/2] ci: upgrade ruff and enable preview --- ddtrace/appsec/_iast/_taint_tracking/__init__.py | 1 - ddtrace/appsec/_processor.py | 1 - ddtrace/contrib/internal/botocore/services/kinesis.py | 2 +- ddtrace/contrib/internal/botocore/services/sqs.py | 2 +- ddtrace/contrib/internal/pyramid/patch.py | 2 +- ddtrace/internal/writer/writer.py | 1 - hatch.toml | 2 +- pyproject.toml | 5 +++++ tests/contrib/boto/test.py | 4 ++-- tests/contrib/langgraph/conftest.py | 2 +- tests/profiling/simple_program_fork.py | 4 ++-- tests/profiling_v2/simple_program_fork.py | 4 ++-- tests/profiling_v2/simple_program_pytorch_gpu.py | 2 +- tests/tracer/test_tracer.py | 2 +- 14 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ddtrace/appsec/_iast/_taint_tracking/__init__.py b/ddtrace/appsec/_iast/_taint_tracking/__init__.py index 0c2d7902c61..ace537feed5 100644 --- a/ddtrace/appsec/_iast/_taint_tracking/__init__.py +++ b/ddtrace/appsec/_iast/_taint_tracking/__init__.py @@ -65,7 +65,6 @@ "copy_ranges_from_strings", "get_range_by_hash", "get_ranges", - "is_in_taint_map", "is_tainted", "new_pyobject_id", "origin_to_str", diff --git a/ddtrace/appsec/_processor.py b/ddtrace/appsec/_processor.py index f09944d351d..cb88ca06bfe 100644 --- a/ddtrace/appsec/_processor.py +++ b/ddtrace/appsec/_processor.py @@ -2,7 +2,6 @@ import errno from json.decoder import JSONDecodeError import os -import os.path from typing import TYPE_CHECKING from typing import Any from typing import ClassVar diff --git a/ddtrace/contrib/internal/botocore/services/kinesis.py b/ddtrace/contrib/internal/botocore/services/kinesis.py index f1f71d0b819..ce7d79ccc9d 100644 --- a/ddtrace/contrib/internal/botocore/services/kinesis.py +++ b/ddtrace/contrib/internal/botocore/services/kinesis.py @@ -6,7 +6,7 @@ from typing import List from typing import Tuple -import botocore.client +import botocore.client # noqa: F401 import botocore.exceptions from ddtrace import config diff --git a/ddtrace/contrib/internal/botocore/services/sqs.py b/ddtrace/contrib/internal/botocore/services/sqs.py index 5bf238c8cfd..19062ae8b63 100644 --- a/ddtrace/contrib/internal/botocore/services/sqs.py +++ b/ddtrace/contrib/internal/botocore/services/sqs.py @@ -3,7 +3,7 @@ from typing import Dict # noqa:F401 from typing import Optional # noqa:F401 -import botocore.client +import botocore.client # noqa: F401 import botocore.exceptions from ddtrace import config diff --git a/ddtrace/contrib/internal/pyramid/patch.py b/ddtrace/contrib/internal/pyramid/patch.py index 6f5ee9c6b5f..aef10a5e96e 100644 --- a/ddtrace/contrib/internal/pyramid/patch.py +++ b/ddtrace/contrib/internal/pyramid/patch.py @@ -1,7 +1,7 @@ from typing import Dict import pyramid -import pyramid.config +import pyramid.config # noqa: F401 import wrapt from ddtrace import config diff --git a/ddtrace/internal/writer/writer.py b/ddtrace/internal/writer/writer.py index 15e60e7ba62..9aad9ca77fa 100644 --- a/ddtrace/internal/writer/writer.py +++ b/ddtrace/internal/writer/writer.py @@ -22,7 +22,6 @@ from ddtrace.internal.settings._agent import config as agent_config from ddtrace.internal.settings.asm import ai_guard_config from ddtrace.internal.settings.asm import config as asm_config -import ddtrace.internal.utils.http from ddtrace.internal.utils.retry import fibonacci_backoff_with_jitter from ...constants import _KEEP_SPANS_RATE_KEY diff --git a/hatch.toml b/hatch.toml index 21d918c7a30..3a7815ce8b8 100644 --- a/hatch.toml +++ b/hatch.toml @@ -18,7 +18,7 @@ dependencies = [ "packaging==23.1", "pygments==2.16.1", "riot==0.20.1", - "ruff==0.11.11", + "ruff==0.14.5", "clang-format==18.1.5", "cmake-format==0.6.13", "ruamel.yaml==0.18.6", diff --git a/pyproject.toml b/pyproject.toml index 94f61c12f1f..c372823f719 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -268,6 +268,11 @@ lint.ignore = [ "G201", ] line-length = 120 + +# Allow experimental/preview checks +lint.preview = true +lint.explicit-preview-rules = true + lint.select = [ "A", "D", diff --git a/tests/contrib/boto/test.py b/tests/contrib/boto/test.py index 76dd974692a..a826e55a4c8 100644 --- a/tests/contrib/boto/test.py +++ b/tests/contrib/boto/test.py @@ -5,9 +5,9 @@ import boto.awslambda import boto.ec2 import boto.elasticache -import boto.kms +import boto.kms # noqa: F401 import boto.s3 -import boto.sqs +import boto.sqs # noqa: F401 import boto.sts from moto import mock_ec2 from moto import mock_lambda diff --git a/tests/contrib/langgraph/conftest.py b/tests/contrib/langgraph/conftest.py index a2b01780354..5882325093f 100644 --- a/tests/contrib/langgraph/conftest.py +++ b/tests/contrib/langgraph/conftest.py @@ -33,7 +33,7 @@ def mock_tracer(): def langgraph(monkeypatch, mock_tracer): patch() import langgraph - import langgraph.prebuilt + import langgraph.prebuilt # noqa: F401 pin = Pin.get_from(langgraph) pin._override(langgraph, tracer=mock_tracer) diff --git a/tests/profiling/simple_program_fork.py b/tests/profiling/simple_program_fork.py index ad8c0541ccd..57f3bf81f64 100644 --- a/tests/profiling/simple_program_fork.py +++ b/tests/profiling/simple_program_fork.py @@ -3,9 +3,9 @@ import threading from ddtrace.internal import service -import ddtrace.profiling.auto +import ddtrace.profiling.auto # noqa: F401 import ddtrace.profiling.bootstrap -import ddtrace.profiling.profiler +import ddtrace.profiling.profiler # noqa: F401 lock = threading.Lock() diff --git a/tests/profiling_v2/simple_program_fork.py b/tests/profiling_v2/simple_program_fork.py index ad8c0541ccd..57f3bf81f64 100644 --- a/tests/profiling_v2/simple_program_fork.py +++ b/tests/profiling_v2/simple_program_fork.py @@ -3,9 +3,9 @@ import threading from ddtrace.internal import service -import ddtrace.profiling.auto +import ddtrace.profiling.auto # noqa: F401 import ddtrace.profiling.bootstrap -import ddtrace.profiling.profiler +import ddtrace.profiling.profiler # noqa: F401 lock = threading.Lock() diff --git a/tests/profiling_v2/simple_program_pytorch_gpu.py b/tests/profiling_v2/simple_program_pytorch_gpu.py index 8d846c52de4..cecb90abc3a 100644 --- a/tests/profiling_v2/simple_program_pytorch_gpu.py +++ b/tests/profiling_v2/simple_program_pytorch_gpu.py @@ -4,7 +4,7 @@ from torch.profiler import ProfilerActivity import torch.utils.data import torchvision.datasets -import torchvision.models +import torchvision.models # noqa: F401 from torchvision.models import ResNet18_Weights from torchvision.models import resnet18 import torchvision.transforms as T diff --git a/tests/tracer/test_tracer.py b/tests/tracer/test_tracer.py index 2833f1c3778..65c85894a59 100644 --- a/tests/tracer/test_tracer.py +++ b/tests/tracer/test_tracer.py @@ -29,7 +29,7 @@ from ddtrace.constants import VERSION_KEY from ddtrace.contrib.internal.trace_utils import set_user from ddtrace.ext import user -import ddtrace.internal +import ddtrace.internal # noqa: F401 from ddtrace.internal.compat import PYTHON_VERSION_INFO from ddtrace.internal.rate_limiter import RateLimiter from ddtrace.internal.serverless import has_aws_lambda_agent_extension From 8d0cc76b70527b8400296a84a95f0de44eced6f0 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Thu, 13 Nov 2025 16:33:00 -0500 Subject: [PATCH 2/2] ci: replace slotscheck with PLW0244 --- .riot/requirements/16ebde6.txt | 24 ------------------ pyproject.toml | 45 +--------------------------------- riotfile.py | 6 ----- tests/suitespec.yml | 6 ----- 4 files changed, 1 insertion(+), 80 deletions(-) delete mode 100644 .riot/requirements/16ebde6.txt diff --git a/.riot/requirements/16ebde6.txt b/.riot/requirements/16ebde6.txt deleted file mode 100644 index 497357b5a92..00000000000 --- a/.riot/requirements/16ebde6.txt +++ /dev/null @@ -1,24 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile --no-annotate .riot/requirements/16ebde6.in -# -attrs==25.3.0 -click==8.2.1 -coverage[toml]==7.8.2 -exceptiongroup==1.3.0 -hypothesis==6.45.0 -iniconfig==2.1.0 -mock==5.2.0 -opentracing==2.4.0 -packaging==25.0 -pluggy==1.6.0 -pygments==2.19.1 -pytest==8.4.0 -pytest-cov==6.1.1 -pytest-mock==3.14.1 -slotscheck==0.17.0 -sortedcontainers==2.4.0 -tomli==2.2.1 -typing-extensions==4.14.0 diff --git a/pyproject.toml b/pyproject.toml index c372823f719..16ee97c55d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -154,50 +154,6 @@ exclude = [ ".worktrees", ] -[tool.slotscheck] -exclude-modules = ''' -( - ^ddtrace.(contrib|vendor) - | ^tests.(contrib|vendor) - # avoid sitecustomize modules as they start services - | ddtrace.bootstrap.sitecustomize - | ddtrace.openfeature - | ddtrace.internal.openfeature - | ddtrace.profiling.bootstrap.sitecustomize - | ddtrace.profiling.auto - # also ignore preload module to avoid exception after moving ddtrace.tracing module - | ddtrace.bootstrap.preload - # protobuf file fails to import - | tests.profiling.collector.pprof_3_pb2 - | tests.profiling.collector.pprof_312_pb2 - | tests.profiling.collector.pprof_319_pb2 - | tests.profiling.collector.pprof_421_pb2 - # TODO: resolve slot inheritance issues with profiling - | ddtrace.profiling.collector - | ddtrace.profiling._gevent - | ddtrace,appsec,iast,_taint_tracking.vendor - | ddtrace.appsec._ddwaf.ddwaf_types - | ddtrace.appsec._iast._taint_tracking - | ddtrace.appsec._iast._ast.aspects - | ddtrace.appsec._iast._taint_utils - | ddtrace.appsec._iast.taint_sinks.sql_injection - # DSM specific contribs - | ddtrace.internal.datastreams.kafka - # libdd_wrapper is a common native dependency, not a module - | ddtrace.internal.datadog.profiling.libdd_wrapper - # _ddup and _stack_v2 miss a runtime dependency in slotscheck, but ddup and stack_v2 are fine - | ddtrace.internal.datadog.profiling.ddup._ddup - | ddtrace.internal.datadog.profiling.stack_v2._stack_v2 - # coverage has version-specific checks that prevent import - | ddtrace.internal.coverage.instrumentation_py3_8 - | ddtrace.internal.coverage.instrumentation_py3_10 - | ddtrace.internal.coverage.instrumentation_py3_11 - | ddtrace.internal.coverage.instrumentation_py3_12 - | ddtrace.internal.coverage.instrumentation_py3_13 - | ddtrace.internal.coverage.instrumentation_py3_14 -) -''' - [tool.bandit] targets = ["ddtrace/"] @@ -280,6 +236,7 @@ lint.select = [ "F", "G", "I", + "PLW0244", # redefined-slots-in-subclass "W", ] lint.unfixable =[ diff --git a/riotfile.py b/riotfile.py index 1ba8eb7492e..c7b34e41293 100644 --- a/riotfile.py +++ b/riotfile.py @@ -128,12 +128,6 @@ def select_pys(min_version: str = MIN_PYTHON_VERSION, max_version: str = MAX_PYT "DD_CIVISIBILITY_FLAKY_RETRY_ENABLED": "0", }, ), - Venv( - name="slotscheck", - command="python -m slotscheck -v ddtrace/", - pys=["3.10"], - pkgs={"slotscheck": "==0.17.0"}, - ), Venv( name="build_docs", command="scripts/docs/build.sh", diff --git a/tests/suitespec.yml b/tests/suitespec.yml index 245c21d1a95..e7295183140 100644 --- a/tests/suitespec.yml +++ b/tests/suitespec.yml @@ -218,12 +218,6 @@ suites: parallelism: 2 runner: riot pattern: ^lib_injection$ - slotscheck: - parallelism: 1 - paths: - - 'ddtrace/**/*.py' - runner: riot - snapshot: false runtime: paths: - '@bootstrap'