-
-
Notifications
You must be signed in to change notification settings - Fork 848
Document next
in versionadded & similar directives
#1413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1083,16 +1083,42 @@ units as well as normal text: | |
(``class``, ``attribute``, ``function``, ``method``, ``c:type``, etc), | ||
a ``versionadded`` should be included at the end of its description block. | ||
|
||
The first argument must be given and is the version in question. The second | ||
argument is optional and can be used to describe the details of the feature. | ||
The first argument must be given and is the version in question. | ||
Instead of a specific version number, you can---and should---use | ||
the word ``next``, indicating that the API will first appear in the | ||
upcoming release. | ||
The second argument is optional and can be used to describe the details of the feature. | ||
|
||
Example:: | ||
|
||
.. function:: func() | ||
|
||
Return foo and bar. | ||
|
||
.. versionadded:: 3.5 | ||
.. versionadded:: next | ||
|
||
When a release is made, the release manager will change the ``next`` to | ||
the just-released version. For example, if ``func`` in the above example is | ||
released in 3.14, the snippet will be changed to:: | ||
|
||
.. function:: func() | ||
|
||
Return foo and bar. | ||
|
||
.. versionadded:: 3.14 | ||
|
||
The tool to do this replacement is `update_version_next.py`_ | ||
in the release-tools repository. | ||
|
||
.. _update_version_next.py: https://github.com/python/release-tools/blob/master/update_version_next.py | ||
|
||
When backporting to versions before 3.14, check if ``Doc/tools/extensions/pyspecific.py`` | ||
contains the function ``expand_version_arg``. If it's not there, | ||
use a specific version instead of ``next``. | ||
|
||
When adding documentation for a function that existed in a past version, | ||
but wasn't documented yet, use the version number where the function was | ||
added instead of ``next``. | ||
|
||
.. describe:: versionchanged | ||
|
||
|
@@ -1106,7 +1132,7 @@ units as well as normal text: | |
|
||
Return foo and bar, optionally with *spam* applied. | ||
|
||
.. versionchanged:: 3.6 | ||
.. versionchanged:: next | ||
Added the *spam* parameter. | ||
|
||
Note that there should be no blank line between the directive head and the | ||
ezio-melotti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -1118,22 +1144,25 @@ units as well as normal text: | |
|
||
There is one required argument: the version from which the feature is | ||
deprecated. | ||
Similarly to ``versionadded``, you should use the word ``next`` to indicate | ||
the API will be first deprecated in the upcoming release. | ||
|
||
Example:: | ||
|
||
.. deprecated:: 3.8 | ||
.. deprecated:: next | ||
|
||
.. describe:: deprecated-removed | ||
|
||
Like ``deprecated``, but it also indicates in which version the feature is | ||
removed. | ||
|
||
There are two required arguments: the version from which the feature is | ||
deprecated, and the version in which the feature is removed. | ||
deprecated (usually ``next``), and the version in which the feature | ||
is removed, which must be a specific version number (*not* ``next``). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the tool that convert There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not explicitly, but it will fail. It's not a big priority, since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for fixing that! |
||
|
||
Example:: | ||
|
||
.. deprecated-removed:: 3.8 4.0 | ||
.. deprecated-removed:: next 4.0 | ||
|
||
.. describe:: impl-detail | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to just decide which versions
next
should be backported to, backport it, and then list those versions here.Can you also clarify when would backporting be necessary for a
versionadded
? New features should be documented on thenext
release, and not backported to previous versions.The only exception I can think of is if we are documenting an addition after the fact, but this is covered in the next paragraph.
versionchanged
are more likely to be backported, so maybe this paragraph should be moved there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, but practically, sometimes the backporting decisions take weeks; I don't think they shouldn't block the PR to main.
New API is sometimes added for security fixes, either to enable old behaviour in cases where it's so insecure that we change the default, or to enable new secure behaviour. (Also: third-party redistributors can backport features. That's not what the devguide documents, but the tooling is built with that in mind.)
versionchanged
sharts with “Similar toversionadded
”, so I added the docs here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, with the first sentence I meant the support for
next
itself. IOW, ifnext
is supported from e.g. 3.12+, then the docs should simply say something like "When backporting to versions before 3.12, use a specific version instead ofnext
.". If you are planning to use the current wording until the support fornext
has been backported and then update this paragraph accordingly, that's ok (assuming thatnext
does the right thing when used on older versions).For security fixes and similar I was thinking that are more likely to be
versionchanged
, but sometimes new APIs are indeed added. Since the docs forversionchanged
start with "Similar toversionadded
", I now think it's ok to leave the paragraph here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! Yes, I expect to change the wording after backporting the feature, and I plan to talk to RMs after this is merged and announced.