tessl install tessl/pypi-pep257@0.7.0Python docstring style checker for PEP 257 compliance
Agent Success
Agent success rate when using this tile
72%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.04x
Baseline
Agent success rate without this tile
69%
Create a lightweight docstring linting helper that focuses on selecting Python files by regex and enforcing missing-docstring rules based on public objects inferred from module names and __all__.
core_alpha.py and util_extra.py, running with file pattern ^core_.*\\.py$ reports issues only from core_alpha.py. @test__all__ for public API__all__ = ["public_fn"], a missing docstring on public_fn is reported while a missing docstring on hidden_fn is ignored. @test__init__.py sets __all__ = ["exposed"], the module exposed.py is treated as public and must have a module docstring when linted. @test@generates
from pathlib import Path
from typing import Iterable, List, Pattern, TypedDict, Union
class DocIssue(TypedDict):
file: str
line: int
code: str
message: str
def lint_docstrings(
targets: Iterable[Union[str, Path]],
file_regex: Union[str, Pattern[str]] = r".*\\.py",
include_source: bool = False,
) -> List[DocIssue]:
"""Return missing-docstring issues for regex-matched files under the given targets."""Docstring style checker with regex-based file selection and public/__all__-aware missing-docstring detection.