Skip to content

Pass --skip-pylint to apistubgen only when --md is specified#46158

Merged
swathipil merged 3 commits intomainfrom
copilot/add-conditional-skip-pylint
Apr 8, 2026
Merged

Pass --skip-pylint to apistubgen only when --md is specified#46158
swathipil merged 3 commits intomainfrom
copilot/add-conditional-skip-pylint

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

--skip-pylint was never conditionally passed to apistubgen. It should only be appended when --md (generate_md=True) is used, since markdown generation does not require pylint analysis.

Changes

  • azpysdk/apistub.py: Append --skip-pylint to cmds iff args.generate_md is True:

    if getattr(args, "generate_md", False):
        cmds.append("--skip-pylint")
  • tests/test_apistub.py: Two new tests in TestRunOutputDirectory:

    • test_generate_md_adds_skip_pylint — asserts --skip-pylint is present when generate_md=True
    • test_no_generate_md_omits_skip_pylint — asserts --skip-pylint is absent when generate_md=False

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pypi.org
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/lib/python3.9/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-1d2ihifr/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=42 wheel (dns block)
  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Problem

In eng/tools/azure-sdk-tools/azpysdk/apistub.py, the run() method builds the cmds list that is passed to apistubgen. Currently, --skip-pylint is never conditionally added based on whether --md was passed in.

The requirement is:

  • When --md is passed (i.e. args.generate_md is True), --skip-pylint must be appended to the apistubgen command (cmds).
  • When --md is not passed (i.e. args.generate_md is False), --skip-pylint must not be added to the cmds.

Location

File: eng/tools/azure-sdk-tools/azpysdk/apistub.py

The relevant section in run() (around line 145–152) where cmds is assembled:

cmds = ["-m", "apistub", "--pkg-path", pkg_path]

if out_token_path:
    cmds.extend(["--out-path", out_token_path])
if cross_language_mapping_path:
    cmds.extend(["--mapping-path", cross_language_mapping_path])

logger.info("Running apistub {}.".format(cmds))

Required Change

Add a conditional block after the existing cmds assembly (before the logger.info line) to append --skip-pylint only when generate_md is True:

if getattr(args, "generate_md", False):
    cmds.append("--skip-pylint")

Tests

Update eng/tools/azure-sdk-tools/tests/test_apistub.py to add/update tests that verify:

  1. When generate_md=True, the cmds passed to run_venv_command include "--skip-pylint".
  2. When generate_md=False, the cmds passed to run_venv_command do not include "--skip-pylint".

The existing _make_args helper already supports generate_md, so you can capture cmds in fake_apistub_run (similar to how test_no_dest_dir_uses_staging does) and assert on the presence/absence of --skip-pylint.

Notes

  • This is a draft PR, so mark it as draft.
  • No other files need to change.
  • Keep changes minimal and focused on this conditional logic.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: help me open a draft PR to update the azpysdk apistub --md command to ensure --skip-pylint is also passed in to apistubgen ONLY when --md is passed in too. If --md is not passed in, then --skip-pylint should not be passed to the apistubgen command

Assistant: Let me explore the repository to understand the current codebase before creating the PR.

Assistant: Now I have a full picture of the code. Let me create the draft PR.

Assistant: We're waiting for your response to the tool call dialog to continue opening the draft PR.

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Add conditional appending of --skip-pylint in run method Pass --skip-pylint to apistubgen only when --md is specified Apr 6, 2026
Copilot AI requested a review from swathipil April 6, 2026 19:34
@swathipil swathipil marked this pull request as ready for review April 6, 2026 19:36
@swathipil swathipil requested review from mccoyp and scbedd as code owners April 6, 2026 19:36
@swathipil swathipil requested review from JennyPng and Copilot April 6, 2026 19:36
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

This PR updates the azpysdk apistub wrapper so it only forwards --skip-pylint to apistubgen when --md (markdown generation) is requested, aligning command construction with the intended behavior.

Changes:

  • Conditionally append --skip-pylint to the apistubgen command only when args.generate_md is True.
  • Add unit tests to verify --skip-pylint is present with generate_md=True and absent with generate_md=False.

Reviewed changes

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

File Description
eng/tools/azure-sdk-tools/azpysdk/apistub.py Adds conditional --skip-pylint flag inclusion when markdown generation is requested.
eng/tools/azure-sdk-tools/tests/test_apistub.py Adds coverage for flag presence/absence based on generate_md.

…s.run and creating token JSON

Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-python/sessions/6aaa6910-2dab-4716-a109-89bc72d2c96e

Co-authored-by: swathipil <76007337+swathipil@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 6, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from swathipil April 6, 2026 20:03
@swathipil swathipil enabled auto-merge (squash) April 6, 2026 20:09
Copy link
Copy Markdown
Member

@JennyPng JennyPng left a comment

Choose a reason for hiding this comment

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

lgtm

@swathipil
Copy link
Copy Markdown
Member

/check-enforcer override

@swathipil swathipil merged commit c60b9b2 into main Apr 8, 2026
15 checks passed
@swathipil swathipil deleted the copilot/add-conditional-skip-pylint branch April 8, 2026 17:33
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.

5 participants