mirror of
https://github.com/astral-sh/ruff.git
synced 2026-11-26 06:15:39 +08:00
## Summary Pulls in https://github.com/astral-sh/docstring-adder/pull/169, so that we have a version of docstring-adder that supports 3.15. This enables us to add docstrings for the new-in-3.15 branches in typeshed. I also switched us to temporarily use a version of Black from git, because I'm too impatient to wait for a release that includes https://github.com/psf/black/commit/f665703258bfa1916f8a6c1cbab0bc384b90cbac. ## Test Plan CI on docstring-adder
28 lines
1.3 KiB
Bash
Executable File
28 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This script uses the https://github.com/astral-sh/docstring-adder tool to codemod docstrings into our vendored typeshed stubs.
|
|
#
|
|
# We run the tool with the full matrix of Python versions supported by typeshed,
|
|
# so that we codemod in docstrings that only exist on certain versions.
|
|
#
|
|
# The codemod will only add docstrings to functions/classes that do not
|
|
# already have docstrings. We run with Python 3.15 before running with
|
|
# any other Python version so that we get the Python 3.15 version of the
|
|
# docstring for a definition that exists on all Python versions: if we
|
|
# ran with Python 3.10 first, then the later runs with Python 3.11+ would
|
|
# not modify the docstring that had already been added using the old version of Python.
|
|
#
|
|
# Note that the codemod can only add docstrings if they exist on the Python platform
|
|
# the codemod is run with. If you need to add docstrings for a Windows-specific API,
|
|
# you'll need to run the codemod on a Windows machine.
|
|
|
|
set -eu
|
|
|
|
docstring_adder="git+https://github.com/astral-sh/docstring-adder.git@084654f4e9c94481f4a1ebeeb9f5dbc82c1933df"
|
|
stdlib_path="./crates/ty_vendored/vendor/typeshed/stdlib"
|
|
|
|
for python_version in 3.15 3.14 3.13 3.12 3.11 3.10
|
|
do
|
|
PYTHONUTF8=1 uvx --python="$python_version" --force-reinstall --from="${docstring_adder}" add-docstrings --stdlib-path="${stdlib_path}"
|
|
done
|