Skip to content

Comments

Rework typeshed-sync workflow to also add docstrings for Windows- and MacOS-specific APIs#19360

Merged
AlexWaygood merged 2 commits intomainfrom
alex/platform-api-docs
Jul 15, 2025
Merged

Rework typeshed-sync workflow to also add docstrings for Windows- and MacOS-specific APIs#19360
AlexWaygood merged 2 commits intomainfrom
alex/platform-api-docs

Conversation

@AlexWaygood
Copy link
Member

Summary

The docstring-adder codemod can only add docstrings for APIs that exist at runtime. I.e., if the codemod is run on a Linux machine, it can't add any docstrings for APIs that don't exist at runtime on a Linux machine. The Python stdlib has some APIs that only exist on Windows/MacOS, and it seems a shame not to provide docstrings for those too.

This PR reworks the sync_typeshed.yaml workflow so that:

  1. A Linux worker:
    a. Syncs the typeshed stubs
    b. Syncs the docstrings available on Linux
    c. Commits the changes and pushes them to an upstream branch
  2. Once the Linux worker is done, a Windows worker:
    a. Checks out the branch created by the Linux worker
    b. Syncs all docstrings available on Windows that are not available on Linux
    c. Commits the changes and pushes them to the same upstream branch
  3. Once the Windows worker is done, a MacOS worker:
    a. Checks out the branch created by the Linux worker
    b. Syncs all docstrings available on MacOS that are not available on Linux or Windows
    c. Commits the changes and pushes them to the same upstream branch
    d. Creates the typeshed-sync PR

This PR also updates the pinned commit of docstring-adder to astral-sh/docstring-adder@7f350b0, which includes astral-sh/docstring-adder#2

Test Plan

¯\_(ツ)_/¯

I ran pre-commit, and ran the new codemod_docstrings.sh script through shellcheck. Not sure how else to test this other than by merging it and seeing if it works?

@AlexWaygood AlexWaygood added ci Related to internal CI tooling ty Multi-file analysis & type inference labels Jul 15, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 15, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

openai/openai-cookbook (error)

warning: Detected debug build without --no-cache.
error: Failed to parse examples/mcp/databricks_mcp_cookbook.ipynb:12:1:8: Simple statements must be separated by newlines or semicolons

Formatter (preview)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

openai/openai-cookbook (error)

ruff format --preview

warning: Detected debug build without --no-cache.
error: Failed to parse examples/mcp/databricks_mcp_cookbook.ipynb:12:1:8: Simple statements must be separated by newlines or semicolons

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

The git thingy where you make commits to carry over the docstrings is a bit hard to understand. I think using something like the upload files action might have been slightly easier. But I don't think it's worth changing, but some documentation at the top (e.g. take the PR summary) would be great

      - name: Upload generated files
        uses: actions/upload-artifact@v4
        with:
          name: files-${{ matrix.os }}
          path: |
            path/to/generated/files/
            !path/to/exclude/
          retention-days: 1

Don't dare to break the typeshed sync and then be off for a week ;)

@AlexWaygood AlexWaygood force-pushed the alex/platform-api-docs branch from 168a845 to 584aa70 Compare July 15, 2025 17:01
@AlexWaygood AlexWaygood merged commit 8d7d021 into main Jul 15, 2025
35 checks passed
@AlexWaygood AlexWaygood deleted the alex/platform-api-docs branch July 15, 2025 17:14
@MichaReiser
Copy link
Member

I think you should have been able to run it like this:
Screenshot 2025-07-15 at 19 19 36

@AlexWaygood
Copy link
Member Author

Hmm, I'll try that on #19367

UnboundVariable pushed a commit to UnboundVariable/ruff that referenced this pull request Jul 15, 2025
…finition

* 'main' of https://github.com/astral-sh/ruff: (39 commits)
  [ty] Sync vendored typeshed stubs (astral-sh#19368)
  Fix typeshed-sync workflow (astral-sh#19367)
  Rework typeshed-sync workflow to also add docstrings for Windows- and MacOS-specific APIs (astral-sh#19360)
  [ty] Allow `-qq` for silent output mode (astral-sh#19366)
  [ty] Allow `-q` short alias for `--quiet` (astral-sh#19364)
  Add shellcheck to pre-commit (astral-sh#19361)
  distinguish references from definitions in `infer_nonlocal`
  [`pycodestyle`] Handle brace escapes for t-strings in logical lines (astral-sh#19358)
  [ty] Combine CallArguments and CallArgumentTypes (astral-sh#19337)
  Move Pylint rendering to `ruff_db` (astral-sh#19340)
  [`pylint`] Extend invalid string character rules to include t-strings (astral-sh#19355)
  Make TC010 docs example more realistic (astral-sh#19356)
  Move RDJSON rendering to `ruff_db` (astral-sh#19293)
  [`flake8-use-pathlib`] Skip single dots for `invalid-pathlib-with-suffix` (`PTH210`) on versions >= 3.14 (astral-sh#19331)
  [`ruff`] Allow `strict` kwarg when checking for `starmap-zip` (`RUF058`) in Python 3.14+ (astral-sh#19333)
  [ty] Reduce false positives for `TypedDict` types (astral-sh#19354)
  [ty] Remove `ConnectionInitializer` (astral-sh#19353)
  [ty] Use `Type::string_literal()` more (astral-sh#19352)
  [ty] Add ecosystem-report workflow (astral-sh#19349)
  [ty] Make use of salsa `Lookup` when interning values (astral-sh#19347)
  ...

# Conflicts:
#	crates/ty_ide/src/goto.rs
#	crates/ty_server/src/server.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Related to internal CI tooling ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants