From 4d45304442f5e10f2d548a4e011adef57126b181 Mon Sep 17 00:00:00 2001 From: romanlutz Date: Mon, 18 May 2026 05:19:00 -0700 Subject: [PATCH] Tag AtomicAttack(attack=...) deprecation for v0.16.0 removal Switch the legacy `attack=` constructor kwarg from a bare `warnings.warn` to `print_deprecation_message` with `removed_in='0.16.0'`, matching the pattern used by the rest of the scenario churn (Jailbreak, Scam, Cyber, Psychosocial, etc.) and the deprecated `include_default_baseline` constructor path on Scenario. Also reflects the removal version in the docstring so users see it without triggering the warning. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pyrit/scenario/core/atomic_attack.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyrit/scenario/core/atomic_attack.py b/pyrit/scenario/core/atomic_attack.py index d63c5e65f5..ef61b8b0bb 100644 --- a/pyrit/scenario/core/atomic_attack.py +++ b/pyrit/scenario/core/atomic_attack.py @@ -14,9 +14,9 @@ """ import logging -import warnings from typing import TYPE_CHECKING, Any, Optional +from pyrit.common.deprecation import print_deprecation_message from pyrit.executor.attack import AttackExecutor, AttackStrategy from pyrit.executor.attack.core.attack_executor import AttackExecutorResult from pyrit.identifiers import build_atomic_attack_identifier @@ -74,8 +74,8 @@ def __init__( to ``atomic_attack_name``. attack_technique: An AttackTechnique bundling the attack strategy and optional technique seeds. Preferred over the deprecated ``attack`` parameter. - attack: Deprecated. The configured attack strategy to execute. Use - ``attack_technique`` instead. + attack: **Deprecated.** Will be removed in v0.16.0. The configured attack + strategy to execute. Use ``attack_technique`` instead. seed_groups: List of seed attack groups. Each seed group must have an objective set. adversarial_chat: Optional chat target for generating @@ -99,10 +99,10 @@ def __init__( if attack_technique is not None: self._attack_technique = attack_technique elif attack is not None: - warnings.warn( - "The 'attack' parameter is deprecated. Use 'attack_technique=AttackTechnique(attack=...)' instead.", - DeprecationWarning, - stacklevel=2, + print_deprecation_message( + old_item="AtomicAttack(attack=...)", + new_item="AtomicAttack(attack_technique=AttackTechnique(attack=...))", + removed_in="0.16.0", ) self._attack_technique = AttackTechnique(attack=attack) else: