Repository navigation
We're happy to announce the feature release of docstub 0.7.0 on 2026-11-08.
This release supports Python 3.12 to 3.15.
Enhancement
- Include shape information when translating doctypes to annotations with
numpy.typing.NDArray. This includes support for shapes with optional dimensions which use expansion like in the plugin example to create a union of arrays – one for each supported rank. Shapes with "..." are treated as an unspecified number of dimensions and are transformed totuple[Any, ...]. Empty shapes are supported too (#132). - Add a new plugin system to Docstub with 2 hooks. These hooks allow overriding/extending the default grammar and transformer that are used to transform doctypes into annotations. Add a minimal guide and documentation too (#130).
- Support for callable expressions like
Callable[[int, str], int]in doctypes (#123). - Ensure that sources (file paths and line numbers) in command line output are sorted "naturally". For example
foo.py:9should go beforefoo.py:24(#119). - Log warnings emitted while parsing docstrings with NumPyDoc and link to the file and line number of the docstring (#55).
- Color debug information with "green" which might be more visible with different color schemes than the previous "bright_black" (#124).
- When printing debugging information (
-vv), include command line arguments and the fully merged configuration in the output (#124). - Declare (official) support for Python 3.15 (#128).
Performance
- Avoid overusing libcst's "slower"
findall(#121). - Cache transformed doctypes in each worker. Aggregated cache statistics are printed when showing debug information (
-vvoption) (#130).
Bug Fixes
- Add support for expressions like
Literal[1, "some string"]in doctypes. The grammar previously only allowed names inside this form (#55). - Expand arrays whose dtype is a union of dtypes into a union of arrays, one for each given dtype. This might be necessary if
numpy.typing.dtypedoes not support unions as arguments (#132). - Strip shape and dtype from ArrayLikes when converting them to an annotation since
numpy.typing.ArrayLikedoesn't support adding that information (#132).
Documentation
- Add contribution, release and style guides (#103).
- Update README after merging contributing guide (#120).
- Add HTML documentation for docstub's Python API, including source links to the repository (#129).
DevOps
- Bump actions/checkout from 5 to 6 in the actions group (#117).
- Bump the actions group across 1 directory with 3 updates (#126).
Maintenance
- Uncouple doctype transformation from name resolution (#55).
- Align with supertype of click's HelpFormatter (#127).
- Tweak logging messages in case a missing section title leads to multiple parameters with empty names being parsed by NumPyDoc in the 'Returns' section (#134).
- Remove unnecessary imports in plugin guide (#135).
Contributors
1 authors added to this release (alphabetically):
- Lars Grüter (@lagru)
1 reviewers added to this release (alphabetically):
- Lars Grüter (@lagru)