Repository navigation
Add Python modernization and deprecation guardrails - #327
Conversation
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 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 <[email protected]>
Bernd Verst (berndverst)
left a comment
There was a problem hiding this comment.
This is a net-positive, compatibility-aware guardrail change. Ruff is wired into the existing lint workflow with package-appropriate Python targets and generated-code exclusions, while Python 3.13 provides a strict deprecation gate without removing compatibility coverage. The focused cleanup preserves naive-UTC test semantics and public/runtime annotation behavior. I found no introduced correctness, runtime-performance, breaking-change, or replay-compatibility issues. The modernization is appropriately scoped to the packages' actual supported Python versions. No blocking findings.
Summary
UPrules 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.DeprecationWarningandPendingDeprecationWarningas 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.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.