Skip to content

Add Python modernization and deprecation guardrails - #327

Open
andystaples wants to merge 5 commits into
mainfrom
andystaples-python-modernization-guardrails
Open

andystaples wants to merge 5 commits into
mainfrom
andystaples-python-modernization-guardrails

Conversation

@andystaples

@andystaples andystaples commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add compatibility-aware modernization guidance: use current Python idioms without raising package minimum versions or changing public/runtime annotation behavior.
  • Run Ruff's UP rules alongside Flake8 in the existing Nox lint session. Target Python 3.11 for core/Managed and Python 3.13 for Functions, including tests and examples; exclude generated protobuf files.
  • Treat DeprecationWarning and PendingDeprecationWarning as errors in the root pytest configuration. Use Python 3.13 as the strict Nox deprecation gate while retaining the full compatibility matrices; other Nox interpreter versions continue to report these warnings without failing.
  • Fix two small modernization findings, replace deprecated utcnow() calls in executor tests without changing naive-UTC timestamp comparisons, migrate the pagination test to the supported logger API, and assert warnings in tests deliberately exercising deprecated compatibility APIs.

Deliberate limits and follow-up

This does not attempt a repository-wide modernization sweep. Temporarily excluded rules do not reject new occurrences until their cleanup is complete:

Ruff is not a comprehensive deprecated-API database, and runtime warning enforcement only covers executed code. Parent pytest filters do not govern separately launched Functions workers. Package versions and dependency minimums are unchanged.

andystaples and others added 4 commits November 2, 2026 12:21
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@andystaples
andystaples marked this pull request as ready for review November 2, 2026 19:55
Copilot AI balanced review requested due to automatic review settings November 2, 2026 19:55

Copilot AI 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.

🟢 Approval recommended

The Python modernization and deprecation-check changes have no active review issues.

No open issues 🎉

What changed in this PR

Adds Python modernization and deprecation checks across the core SDK and both providers without changing package minimum versions or public API behavior.

Changes:

  • Integrates Ruff modernization rules with Nox linting, using package-specific Python targets and scoped exclusions.
  • Makes deprecation warnings fail tests by default, with Python 3.13 as the strict Nox gate while retaining compatibility coverage.
  • Updates affected tests and documents guardrails and deferred cleanup.
File Description
tests/​durabletask/​test_proto_task_hub_shim.py Removes unnecessary class declaration parentheses.
tests/​durabletask/​test_orchestration_executor.py Replaces deprecated UTC calls while preserving naive timestamps.
tests/​durabletask/​test_batch_actions.py Uses the supported client logger parameter.
tests/​durabletask/​extensions/​history_export/​test_activities.py Removes a redundant UTF-8 encoding argument.
tests/​durabletask-azuremanaged/​test_dts_batch_actions.py Uses the supported Managed client logger parameter.
tests/​azure-functions-durable/​test_worker_compat.py Asserts the expected retry-options deprecation warning.
tests/​azure-functions-durable/​test_client_compat.py Asserts the expected entity unpickling deprecation warning.
pyproject.toml Configures Ruff targets, exclusions, and pytest warning enforcement.
noxfile.py Adds Ruff linting and interpreter-specific warning handling.
docs/​development.md Explains checks, exceptions, and focused validation commands.
dev-requirements.txt Adds Ruff as a development dependency.
.github/​copilot-instructions.md Documents compatibility-aware modernization and warning-handling guidance.

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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