Skip to content

[Python APIView] update supported py versions + related fixes#14708

Draft
swathipil wants to merge 16 commits intoAzure:mainfrom
swathipil:swathipil/pyapi/update-supported-versions
Draft

[Python APIView] update supported py versions + related fixes#14708
swathipil wants to merge 16 commits intoAzure:mainfrom
swathipil:swathipil/pyapi/update-supported-versions

Conversation

@swathipil
Copy link
Copy Markdown
Member

@swathipil swathipil commented Mar 25, 2026

fixes: #9557

Adding support for Python versions 3.9-3.14 (since only 3.10 was working) to available for use by the azpysdk CLI command for api.md generation.

TODO:

  • add + test 3.14
  • add test that generates SDK from tsp with all possible syntax and runs across all py versions

@swathipil swathipil changed the title Swathipil/pyapi/update supported versions [Python APIView] update supported py versions + related fixes Mar 25, 2026
@github-actions github-actions bot added the azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli label Mar 25, 2026
@swathipil swathipil force-pushed the swathipil/pyapi/update-supported-versions branch from a754161 to 6f52468 Compare March 25, 2026 00:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Python APIView stub generator and its test package to reflect newer supported Python versions (dropping older runtimes and adding newer ones), along with parsing/test adjustments to keep output stable across Python 3.9–3.13.

Changes:

  • Bump apiview-stub-generator to 0.3.28 and update supported Python versions in packaging metadata and changelog.
  • Expand CI to run tox-based tests across Python 3.9–3.13 and adjust tests/fixtures for version-specific behavior.
  • Improve class/function parsing to better preserve source-level base class/keyword representations (e.g., metaclass) and normalize TypedDict/forward-ref rendering.

Reviewed changes

Copilot reviewed 17 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/python-packages/apiview-stub-generator/tests/dataclass_parsing_test.py Makes dataclass expectations version-aware and skips KW_ONLY test on <3.10.
packages/python-packages/apiview-stub-generator/tests/class_parsing_test.py Updates expected TypedDict/Enum output and adds regression tests for forward-ref bases and EnumMeta naming.
packages/python-packages/apiview-stub-generator/tests/azure_tests/token_files/azure-eventhub-checkpointstoreblob_python.json Updates stored token output metadata for parser 0.3.28.
packages/python-packages/apiview-stub-generator/tests/azure_tests/token_files/azure-eventhub-checkpointstoreblob-aio_python.json Updates stored token output metadata for parser 0.3.28.
packages/python-packages/apiview-stub-generator/tests/apiview_test.py Adjusts diagnostic count expectation based on Python version behavior.
packages/python-packages/apiview-stub-generator/setup.py Updates python_requires and classifiers to newer Python versions.
packages/python-packages/apiview-stub-generator/ci.yml Runs test suite under Python 3.9–3.13 in CI.
packages/python-packages/apiview-stub-generator/apistub/nodes/_function_node.py Guards against non-function AST nodes from astroid.extract_node.
packages/python-packages/apiview-stub-generator/apistub/nodes/_class_node.py Adds AST-based base/keyword extraction, TypedDict normalization, and annotation handling consistency.
packages/python-packages/apiview-stub-generator/apistub/nodes/_base_node.py Fixes Optional wrapping detection differences in Python 3.9 string representations.
packages/python-packages/apiview-stub-generator/apistub/_version.py Bumps version to 0.3.28.
packages/python-packages/apiview-stub-generator/CHANGELOG.md Documents 0.3.28 changes and version support updates.
packages/python-packages/apistubgentest/setup.py Updates supported Python classifiers and python_requires.
packages/python-packages/apistubgentest/apistubgentest/models/_models.py Adds new model for forward-ref base testing and updates typing syntax for 3.9 compatibility.
packages/python-packages/apistubgentest/apistubgentest/models/_mixin.py Updates typing syntax for 3.9 compatibility.
packages/python-packages/apistubgentest/apistubgentest/models/_dataclasses.py Gates KW_ONLY usage to 3.10+ and imports accordingly.
packages/python-packages/apistubgentest/apistubgentest/models/init.py Conditionally imports KW_ONLY dataclass and adds new exports.
Comments suppressed due to low confidence (1)

packages/python-packages/apistubgentest/apistubgentest/models/init.py:59

  • __all__ includes "DataClassWithKeywordOnly" unconditionally, but on Python < 3.10 that symbol is never imported/defined (it's gated behind if sys.version_info >= (3, 10)). This will break from apistubgentest.models import * on 3.9 with an AttributeError. Consider only adding this name to __all__ when running on 3.10+, or always defining it (e.g., via a safe import/placeholder) so __all__ is accurate for each supported version.
    "DataClassSimple",
    "DataClassWithFields",
    "DataClassDynamic",
    "DataClassWithKeywordOnly",
    "DataClassWithPostInit",

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

Labels

azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python APIView] Update supported versions

2 participants