{Core} `aaz`: Wrap `functools.partial` in `staticmethod()` to remove FutureWarning by RenSilvaAU · Pull Request #31973 · Azure/azure-cli · GitHub
Skip to content

{Core} aaz: Wrap functools.partial in staticmethod() to remove FutureWarning - #31973

Merged
kai ru (kairu-ms) merged 5 commits into
Azure:devfrom
RenSilvaAU:resilv/py313
Aug 26, 2025
Merged

kai ru (kairu-ms) merged 5 commits into
Azure:devfrom
RenSilvaAU:resilv/py313

Conversation

@RenSilvaAU

@RenSilvaAU Ren Silva (RenSilvaAU) commented Aug 21, 2025

Copy link
Copy Markdown
Contributor

Related command
az command

Description

Added staticmethod to functools.partial to ensure compatibility with Python 3.13.
This change addresses a breaking behavior introduced in Python 3.13 where functools.partial no longer supports static method binding without explicit declaration.
The update ensures continued functionality across supported Python versions and prevents runtime errors in affected modules.

Testing Guide

Run unit tests for modules using functools.partial as a static method.
class MyClass:
staticmethod
def my_method(x):
return x * 2

partial_func = staticmethod(functools.partial(MyClass.my_method, 5))
assert partial_func() == 10
Example:

import functools

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Aug 21, 2025

Copy link
Copy Markdown

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Ren Silva (@RenSilvaAU),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Aug 21, 2025

Copy link
Copy Markdown
️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions

Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

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.

Pull Request Overview

This PR adds staticmethod decorators to functools.partial calls to ensure compatibility with Python 3.13, which introduced breaking changes in how functools.partial handles static method binding. The change prevents runtime errors and maintains functionality across supported Python versions.

Key changes:

  • Wraps existing functools.partial calls with staticmethod decorator for preview, experimental, and deprecation info attributes
  • Affects both command group and command decorators in the AAZ command framework

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/azure-cli-core/azure/cli/core/aaz/_command.py Outdated
Comment thread src/azure-cli-core/azure/cli/core/aaz/_command.py Outdated
@bebound

Hang (bebound) commented Aug 25, 2025

Copy link
Copy Markdown
Contributor

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@RenSilvaAU Ren Silva (RenSilvaAU) changed the title added staticmethod to functools.partial [Fix]: Add staticmethod to functools.partial to remove deprecation notice Aug 25, 2025
@bebound Hang (bebound) changed the title [Fix]: Add staticmethod to functools.partial to remove deprecation notice {Core} aaz: wrap functools.partial in staticmethod() to remove FutureWarning Aug 26, 2025
@bebound Hang (bebound) changed the title {Core} aaz: wrap functools.partial in staticmethod() to remove FutureWarning {Core} aaz: Wrap functools.partial in staticmethod() to remove FutureWarning Aug 26, 2025
@kairu-ms
kai ru (kairu-ms) merged commit fac161e into Azure:dev Aug 26, 2025
48 checks passed
@RenSilvaAU
Ren Silva (RenSilvaAU) deleted the resilv/py313 branch October 1, 2025 04:03
Hang (bebound) pushed a commit to bebound/azure-cli that referenced this pull request Oct 29, 2025
…FutureWarning (Azure#31973)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bebound Hang (bebound) mentioned this pull request Nov 17, 2025
29 tasks
Hang (bebound) added a commit that referenced this pull request Nov 24, 2025
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.

5 participants