Skip to content

MAINT Drop Python 3.10 support - #2620

Open
Roman Lutz (romanlutz) wants to merge 1 commit into
microsoft:mainfrom
romanlutz:romanlutz-drop-python-310
Open

MAINT Drop Python 3.10 support#2620
Roman Lutz (romanlutz) wants to merge 1 commit into
microsoft:mainfrom
romanlutz:romanlutz-drop-python-310

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Summary

  • raise PyRIT's minimum supported Python version from 3.10 to 3.11
  • remove Python 3.10 from the CI matrix, package classifiers, documentation, and notebook metadata
  • remove Python 3.10 compatibility dependencies and shims, then adopt Python 3.11 standard-library APIs throughout the codebase
  • regenerate uv.lock for the new supported-version range

Motivation

Python 3.10 reaches end of life on October 31, 2026. In addition, recent LiteLLM releases no longer support Python 3.10, which prevents PyRIT from consuming the latest supported LiteLLM versions while retaining the old runtime floor. Moving to Python 3.11 keeps PyRIT on a maintained Python release and removes compatibility code that is no longer needed.

Testing

  • uv run -m pytest -n 4 --dist=loadfile tests/unit (14,966 passed, 6 skipped)
  • Ruff checks and formatting
  • ty type checking
  • documentation validation
  • memory migration validation

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 09c903b7-7852-4394-bee2-cbdd34dbe878
@@ -696,20 +182,37 @@ async def cancel_run_async(self, *, scenario_result_id: str) -> ScenarioRunSumma
active = self._active_tasks.get(scenario_result_id)
if active is not None and active.task is not None and not active.task.done():
active.task.cancel()
with contextlib.suppress(asyncio.CancelledError, asyncio.TimeoutError):
with contextlib.suppress(asyncio.CancelledError, TimeoutError):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a lone asyncio.TimeoutError left in _server_launcher.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think because this branch isn't up to date with latest main, can see a bunch of merge conflicts :D

Comment thread pyproject.toml
@@ -407,6 +389,7 @@ ignore = [
"DOC502", # Raised exception is not explicitly raised
"PERF203", # try-except-in-loop (intentional per-item error handling)
"SIM117", # multiple-with-statements (combining often exceeds line length)
"UP042", # Replacing public str Enums with StrEnum changes their str() behavior

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious why this is necessary?

@jsong468 Justin Song (jsong468) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge conflicts to deal with but lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants