[Python APIView] update supported py versions + related fixes#14708
Draft
swathipil wants to merge 16 commits intoAzure:mainfrom
Draft
[Python APIView] update supported py versions + related fixes#14708swathipil wants to merge 16 commits intoAzure:mainfrom
swathipil wants to merge 16 commits intoAzure:mainfrom
Conversation
a754161 to
6f52468
Compare
Contributor
There was a problem hiding this comment.
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 behindif sys.version_info >= (3, 10)). This will breakfrom apistubgentest.models import *on 3.9 with anAttributeError. 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",
packages/python-packages/apiview-stub-generator/apistub/nodes/_class_node.py
Outdated
Show resolved
Hide resolved
packages/python-packages/apiview-stub-generator/apistub/nodes/_class_node.py
Outdated
Show resolved
Hide resolved
…ithub.com/swathipil/azure-sdk-tools into swathipil/pyapi/update-supported-versions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: