Skip to content

[azpysdk] Refactor apistub so that API consistency files are the default output#47561

Merged
tjprescott merged 2 commits into
mainfrom
apiStubFixes
Jun 19, 2026
Merged

[azpysdk] Refactor apistub so that API consistency files are the default output#47561
tjprescott merged 2 commits into
mainfrom
apiStubFixes

Conversation

@tjprescott

@tjprescott tjprescott commented Jun 18, 2026

Copy link
Copy Markdown
Member

This PR fundamentally changes the behavior of azpysdk apistub. Due to the introduction of the api consistency check, the command to pass that consistency check used to be:

Old Command
azpysdk apistub --md --extract-metadata --dest-dir .

This is very inconsistent with the guidance on how to pass all other Python checks!

So now the default command is what is needed to pass the CI:

New Command
azpysdk apistub .

This will generate the markdown and metadata file.

The previous default behavior, which generates the APIView token file, can be achieved by passing --token-file.

This also updates the guidance that service teams use.

Finally, this PR removes --dest-dir which was broken and has surprising results. The two usage patterns that should cover all use cases are:

from repo root
azpysdk apistub {packageName}

from package dir
azpysdk apistub .

Copilot AI review requested due to automatic review settings June 18, 2026 21:25
@tjprescott tjprescott requested review from a team, benbp, danieljurek and l0lawrence as code owners June 18, 2026 21:25
@tjprescott tjprescott changed the title Refactor so api consistency files are the default output. [azpysdk] Refactor apistub so that API consistency files are the default output Jun 18, 2026

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 inverts the default behavior of azpysdk apistub so that the API consistency files (api.md and api.metadata.yml) are produced by default, aligning the command with the rest of the azpysdk checks. The previous default (raw APIView token file generation) now requires an explicit --token-file flag. The --md and --extract-metadata flags are removed, and when no --dest-dir is supplied the output now goes to the package directory (previously the staging directory). Documentation, the generate-api-markdown skill, and internal Python callers are updated accordingly.

Changes:

  • Replace --md/--extract-metadata flags with a single --token-file opt-out; markdown + metadata generation become the default, and default output goes to the package directory.
  • Update internal callers (create_api_review_pr.py, sdk_generator.py) and tests to the new invocation/behavior.
  • Update docs and the generate-api-markdown skill to reflect azpysdk apistub . as the canonical command.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
eng/tools/azure-sdk-tools/azpysdk/apistub.py Core change: removes --md/--extract-metadata, adds --token-file, defaults to markdown+metadata generation, and writes to the package dir when no --dest-dir.
eng/tools/azure-sdk-tools/tests/test_apistub.py Updates test helpers/assertions for the new token_file flag and package-directory default output.
scripts/api_md_workflow/create_api_review_pr.py Drops the now-removed flags from both apistub invocations.
eng/tools/azure-sdk-tools/packaging_tools/sdk_generator.py Drops the now-removed flags from the apistub invocation.
doc/tool_usage_guide.md Refreshes the apistub command description.
doc/dev/tests.md Documents the new default output and --token-file/--dest-dir options.
.github/skills/generate-api-markdown/SKILL.md Updates skill steps to the new azpysdk apistub . command.

A key concern: the PR removes the --md/--extract-metadata flags but does not update the API consistency workflow adapters (.github/workflows/src/api-md-consistency/adapters/python.js and api-md-consistency.js), which still invoke and advertise those flags. Since azpysdk/main.py parses arguments strictly, this would break the API consistency CI check that the PR is intended to align with.

Comment thread eng/tools/azure-sdk-tools/azpysdk/apistub.py
@tjprescott tjprescott requested a review from a team as a code owner June 18, 2026 21:35
@tjprescott tjprescott merged commit f1dd4bb into main Jun 19, 2026
20 checks passed
@tjprescott tjprescott deleted the apiStubFixes branch June 19, 2026 16:03
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.

4 participants