Conversation
dpausp
force-pushed
the
ts-types
branch
2 times, most recently
from
April 28, 2026 09:28
df8204a to
bf06d2d
Compare
- Add stubs/ directory with 60+ .pyi stub files for batou package - Add uv workspace support for stubs package (stubs/pyproject.toml, stubs/ruff.toml) - Add ty type checker config (ty.toml) with per-file overrides - Add ty-check hook to .pre-commit-config.yaml - Add mypy config, typing/lint dependency-groups, stubs/typing tox envs - Add typing_tests/test_stubs.py for static type checking validation - Add stubtest-allowlist.txt for known runtime/stub divergences - Update .gitignore for stub artifacts Fix mysql stub: remove docstring (Y021), allowlist UseSudo sentinel - Remove docstring from UseSudo class (flake8-pyi Y021) - Add UseSudo/USE_SUDO to stubtest allowlist (runtime is object(), stub uses typed sentinel for narrowing) Format stubs with 130-char line length - Remove trailing commas from param lists (libcst codemod) so ruff can collapse multi-line signatures into single lines - Point tox stubs env to stubs/ruff.toml for ruff check + format - Net reduction of ~700 lines across 31 stub files Collapse multi-line stub signatures to 130 chars - Extend libcst codemod to also collapse multi-line signatures that fit on one line after trailing comma removal - Preserve @classmethod/@overload decorators and # type: ignore comments - Skip collapse when inline comment would exceed line limit Handle *args trailing commas in stub codemod - Fix libcst codemod to also remove trailing commas from star_arg params (*args), which are Param nodes with star='*', not ParamStar - Collapse log(*args) in component.pyi and exactly_one(*args) in git.pyi remove fix script
- Rename local 'args' variable to 'parsed' in main.py to avoid shadowing the builtin - Minor variable rename in utils.py Fix swapped mock.patch decorator order in owner/group tests @patch decorators apply bottom-up, so the inner decorator's mock is the first function parameter. The original code used os.stat.return_value (module attribute access) so the swap didn't matter. When we changed to using the local variable names (stat.return_value), the names were bound to the wrong mocks — setting return_value on os.chown instead of os.stat. Swap decorator order so os.stat (inner) → first param, os.chown (outer) → second param, matching the (chown, stat, root) parameter names.
autospec=True ensures mock.call args match real function signatures, catching typos and API drift at test time. - test_download: autospec on urlretrieve, hash mocks - test_file: autospec on os.chown; use real os.stat_result for os.stat (plain Mock() breaks genericpath.isfile on Python <3.14) - test_environment: autospec on Environment.add_root, Output.line - test_remote_core, test_template, test_utils: minor mock fixes
Before, each matrix version ran all tox envs. The mapping from matrix versions to used TOXENV is now set explicitly which avoids extra config outside of the workflow definition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New: separate
batou-stubspackage (understubs, mirroring the code package layout) providing type stubs (48.pyifiles, one per code module)Must be published separately on PyPI —
uv add --dev batou-stubsfor batou deployments.With that, deployment authors get IDE autocompletion and type-checking for batou components.
There's a separate new project
batou-typewhich provides type-checking for a deployment as a simple one-liner:The stubs are also used to type-check batou itself with
ty, integrated in pre-commit/tox environments.Stubs use Python 3.14+ syntax: The
.pyifiles use modern type syntax (Self, PEP 695 generics,|unions).This is fine for stubs — they're consumed by type checkers/LSP/IDE only, not at runtime.
batou itself continues to support Python 3.10+.
ty.toml,stubs/stubtest-allowlist.txt— - — makes ty/stubtest form mypy work with the dynamic nature of Batoutyping_tests/test_stubs.py— type-level tests usingassert_type()autospec=Trueon all@patchdecoratorsmain.py(args→parsed)tox-ghCI config to run correct env per Python versionrelease-this.shto publishbatou-stubsalongside batou