Skip to content

Add snippet updater to azpysdk - #45120

Merged
jenny (JennyPng) merged 15 commits into
Azure:mainfrom
JennyPng:azpysdk-update-snippet
Mar 10, 2026
Merged

jenny (JennyPng) merged 15 commits into
Azure:mainfrom
JennyPng:azpysdk-update-snippet

Conversation

@JennyPng

@JennyPng jenny (JennyPng) commented Feb 11, 2026 •

Copy link
Copy Markdown
Member

closes #45007

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

  • azsdk mcp/cli uses the old update_snippet script, need to update that

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 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_snippet command (with optional --no-black) and new unit tests under azpysdk/tests.
  • Refactor azpysdk black to reuse a shared format_directory implementation.
  • 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.

Comment thread eng/tools/azure-sdk-tools/azpysdk/update_snippet.py Outdated
Comment thread eng/tools/azure-sdk-tools/azpysdk/update_snippet.py
Comment thread eng/tools/azure-sdk-tools/tests/test_update_snippet.py
Comment thread eng/tools/azure-sdk-tools/azpysdk/update_snippet.py
Comment thread eng/pipelines/templates/steps/update_snippet.yml Outdated
@JennyPng jenny (JennyPng) self-assigned this Feb 14, 2026
Comment thread eng/tools/azure-sdk-tools/azpysdk/update_snippet.py

@scbedd Scott Beddall (scbedd) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@JennyPng
jenny (JennyPng) merged commit 09e9b48 into Azure:main Mar 10, 2026
20 checks passed
@JennyPng
jenny (JennyPng) deleted the azpysdk-update-snippet branch March 10, 2026 22:57
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
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.

Migrate update-snippets to azpysdk, require black as prereq

4 participants