Skip to content

Conversation

lagru
Copy link
Member

@lagru lagru commented Aug 10, 2025

Since the "optional" statement isn't used in any way right now, enforcing a specific layout for what comes after the "doctype" serves no useful purpose. I don't intend docstub to be linter so I don't think it's likely that we will ever enforce annotating that a parameter is "optional" in the docstring – while it's nice to do so, it's reasonably easy to see it from the signature.

This also makes it easy to add info like requested in #65. It's not used in any way but it's possible to include in docstrings. Docstub shouldn't make it harder writing rich docstrings if possible.

Update the docs accordingly. Also try to be more precise about differentiating "doctypes" from valid Python types.

Release note

For maintainers and optionally contributors, please refer to changelist's README on how to document this PR for the release notes.

Relax grammar for specifying optional and additional information
after type descriptions in docstrings. You can now specify as much
optional information after the first top-level comma as you want
and in arbitrary order, e.g., `some_param: int, in range (0, 1), optional`.
This optional information is ignored by docstub.
{label="enhancement"}

lagru added 2 commits August 10, 2025 14:43
Since the "optional" statement isn't used in any way right now,
enforcing a specific layout for what comes after the "doctype" serves
no useful purpose. I don't intend docstub to be linter so I don't think
it's likely that we will ever enforce annotating that a parameter is
"optional" in the docstring – while it's nice to do so, it's reasonably
easy to see it from the signature.

Update the docs accordingly. Also try to be more precise about
differentiating "doctypes" from valid Python types.
@lagru lagru added documentation Improvements or adds to documentation enhancement New feature or functionality labels Aug 10, 2025
@lagru lagru merged commit 1928d24 into main Aug 10, 2025
7 checks passed
@lagru lagru deleted the join-optional-extra-info branch August 10, 2025 13:31
@lagru lagru added this to the v0.4 milestone Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or adds to documentation enhancement New feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant