Skip to content

docs: add docstrings to deprecation helpers in _deprecate.py#3417

Open
mastash3ff wants to merge 1 commit intopython-trio:mainfrom
mastash3ff:docs/add-docstrings-deprecate
Open

docs: add docstrings to deprecation helpers in _deprecate.py#3417
mastash3ff wants to merge 1 commit intopython-trio:mainfrom
mastash3ff:docs/add-docstrings-deprecate

Conversation

@mastash3ff
Copy link
Copy Markdown

Summary

Five items in src/trio/_deprecate.py had no docstrings:

  • warn_deprecated — the core function that formats and emits deprecation warnings
  • deprecated — the decorator factory used throughout the codebase
  • deprecated_alias — creates a forwarding wrapper with a deprecation notice
  • DeprecatedAttribute — attrs-frozen class holding per-attribute deprecation metadata
  • deprecate_attributes — installs a module-level __getattr__ to warn on access

This PR adds Google-style Args/Returns docstrings to each, matching
the style already used in _sync.py, _highlevel_generic.py, and
elsewhere. No logic, behaviour, or tests are changed.

Test plan

  • No tests are needed for a documentation-only change
  • ruff check src/trio/_deprecate.py passes (verified locally)
  • ruff format --check src/trio/_deprecate.py passes (verified locally)

Five public items in `_deprecate.py` had no docstrings at all:
`warn_deprecated`, `deprecated`, `deprecated_alias`,
`DeprecatedAttribute`, and `deprecate_attributes`.  Add Google-style
Args/Returns docstrings that match the style used throughout the rest
of the codebase (e.g. `_sync.py`, `_highlevel_generic.py`).  No logic
is changed.
@A5rocks
Copy link
Copy Markdown
Contributor

A5rocks commented Apr 5, 2026

I'm not sure this is necessary because these are private API. I think documenting them makes them harder to change too!

Thanks for the PR regardless, even if it's unlikely to get merged.

@A5rocks
Copy link
Copy Markdown
Contributor

A5rocks commented Apr 6, 2026

Do you have a particular use case that requires this? Or did you run into needing docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants