Skip to content

TPT-4835: Complete Python 3.11 compatibility cleanup - #766

Open
zliang-akamai wants to merge 1 commit into
devfrom
zliang/replace-strenum
Open

zliang-akamai wants to merge 1 commit into
devfrom
zliang/replace-strenum

Conversation

@zliang-akamai

@zliang-akamai zliang-akamai commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

📝 Description

Complete the SDK cleanup enabled by raising the minimum supported Python version to 3.11. Replace the in-house string enum implementation with the standard library while preserving the existing import path, use typing.Self for classmethod return types, remove the external mock backport dependency, and migrate the legacy Pylint configuration into pyproject.toml.

Also remove redundant compatibility imports and update newly merged tests to use unittest.mock.

✔️ How to Test

python -m pytest test/unit -q
python -m pylint linode_api4

The unit suite passed with 584 tests and 61 subtests. Pylint reported 10.00/10, and the formatting/import checks passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@zliang-akamai
zliang-akamai requested review from a team as code owners December 3, 2026 04:25
@zliang-akamai zliang-akamai added the improvement for improvements in existing functionality in the changelog. label Dec 3, 2026
@zliang-akamai
zliang-akamai requested review from josephcardillo-akamai and psnoch-akamai and a balanced review from Copilot and removed request for a team December 3, 2026 04:25

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

No active review issues remain for the Python 3.11 cleanup.

No open issues 🎉

What changed in this PR

Completes the SDK’s Python 3.11 cleanup by replacing compatibility code with standard-library features and consolidating lint configuration.

Changes:

  • Adopt enum.StrEnum while preserving the existing import path and testing serialization.
  • Use typing.Self, remove redundant imports, and replace external mock usage.
  • Move Pylint configuration into pyproject.toml.
File Description
test/​unit/​objects/​valkey_test.py Use unittest.mock.patch.
test/​unit/​objects/​serializable_test.py Test StrEnum identity and serialization.
test/​unit/​groups/​valkey_test.py Use unittest.mock.patch.
test/​unit/​base.py Use standard-library mocking.
pyproject.toml Remove mock dependency and configure Pylint.
linode_api4/​objects/​vpc.py Import standard-library StrEnum.
linode_api4/​objects/​serializable.py Replace custom StrEnum with a compatibility alias.
linode_api4/​objects/​region.py Import standard-library StrEnum.
linode_api4/​objects/​placement.py Import standard-library StrEnum.
linode_api4/​objects/​object_storage.py Import standard-library StrEnum.
linode_api4/​objects/​nodebalancer.py Import standard-library StrEnum.
linode_api4/​objects/​monitor.py Import standard-library StrEnum.
linode_api4/​objects/​lock.py Import standard-library StrEnum.
linode_api4/​objects/​linode.py Import standard-library StrEnum.
linode_api4/​objects/​image.py Import standard-library StrEnum.
linode_api4/​objects/​account.py Adopt StrEnum and remove postponed annotations.
linode_api4/​linode_client.py Remove postponed annotations import.
linode_api4/​errors.py Use Self return annotations and simplify imports.
.pylintrc Remove migrated legacy configuration.

Review effort: Balanced

This branch has not been deployed

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

Labels

improvement for improvements in existing functionality in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants