Repository navigation
Add snippet updater to azpysdk - #45120
Merged
Merged
Conversation
jenny (JennyPng)
marked this pull request as ready for review
February 11, 2026 22:59
jenny (JennyPng)
requested a review
from Scott Beddall (scbedd)
as a code owner
February 11, 2026 22:59
jenny (JennyPng)
requested review from
Ben Broderick Phillips (benbp),
Laia Patiño (laiapat) and
Wes Haggard (weshaggard)
as code owners
February 11, 2026 22:59
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the Python README snippet updater into the azpysdk CLI, refactors the black check to expose reusable formatting logic, and updates CI/pipeline wiring and documentation to use the new command.
Changes:
- Add
azpysdk update_snippetcommand (with optional--no-black) and new unit tests underazpysdk/tests. - Refactor
azpysdk blackto reuse a sharedformat_directoryimplementation. - Update pipeline step/template and docs to invoke snippet updates via
dispatch_checks.py/azpysdk.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| eng/tools/azure-sdk-tools/azpysdk/update_snippet.py | New azpysdk check to extract snippets and sync them into README files (and optionally run black). |
| eng/tools/azure-sdk-tools/azpysdk/tests/test_update_snippet.py | New unit tests for snippet extraction and README updating. |
| eng/tools/azure-sdk-tools/azpysdk/tests/init.py | Adds azpysdk tests package marker. |
| eng/tools/azure-sdk-tools/azpysdk/main.py | Registers the new update_snippet subcommand in the CLI. |
| eng/tools/azure-sdk-tools/azpysdk/black.py | Refactors black invocation into a reusable format_directory helper. |
| eng/pipelines/templates/steps/update_snippet.yml | Switches snippet update execution to dispatch_checks.py running the update_snippet check. |
| eng/pipelines/templates/steps/analyze.yml | Passes through updated parameters for the new snippet update template. |
| doc/tool_usage_guide.md | Documents the new azpysdk update_snippet command. |
| doc/dev/code_snippets.md | Updates snippet-maintenance instructions to use azpysdk update_snippet. |
| eng/tools/azure-sdk-tools/ci_tools/snippet_update/python_snippet_updater.py | Removes the legacy snippet updater script. |
| eng/tools/azure-sdk-tools/tests/test_python_snippet_updater.py | Removes legacy tests for the old updater. |
| eng/tools/azure-sdk-tools/ci_tools/snippet_update/test_python_snippet_updater.py | Removes legacy tests for the old updater. |
Scott Beddall (scbedd)
approved these changes
Mar 6, 2026
Scott Beddall (scbedd)
left a comment
Member
There was a problem hiding this comment.
This looks like a solid update jenny (@JennyPng) .
I did agree with the copilot comment for paranoia's sake, but the regex does handle it so it's just an extra check.
aprilk-ms
pushed a commit
that referenced
this pull request
Mar 11, 2026
* initial migrated script * minor * run black before update, refactor black * update pipeline step * add tests to azpysdk * minor * update doc * delete old script mentions * fail in update if black fails * minor fix * fix link * dont omit mgmt * fix, dont error if no samples dir * move test to proper location
Ankit Singhal (singankit)
pushed a commit
that referenced
this pull request
Mar 16, 2026
* initial migrated script * minor * run black before update, refactor black * update pipeline step * add tests to azpysdk * minor * update doc * delete old script mentions * fail in update if black fails * minor fix * fix link * dont omit mgmt * fix, dont error if no samples dir * move test to proper location
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.
closes #45007
add update_snippet to azpysdk
https://github.com/Azure/azure-sdk-for-python/blob/main/eng/tools/azure-sdk-tools/ci_tools/snippet_update/python_snippet_updater.py
remove original script and tests
update snippet depends on proper black format being applied to samples
refactor black.py to have black running logic be reusable
run black in update_snippet
move tests for update_snippet
update snippet docs
pipelines
core: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5864413&view=logs&j=36df4387-3551-57fa-098c-b43a23930261&t=2cab49f9-f561-5eca-3dcd-aa98c816598e&s=ff05ad62-bb9a-53b6-ce9f-72f329a63e7c
storage: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5880152&view=logs&j=b70e5e73-bbb6-5567-0939-8415943fadb9&t=0a38c4fb-2772-5578-aac2-81402a187585
next step