10000 Support PEP 695 and PEP 696 syntax in ``py:function`` and `py:class` directives. by picnixz · Pull Request #11444 · sphinx-doc/sphinx · GitHub
[go: up one dir, main page]

Skip to content

Support PEP 695 and PEP 696 syntax in py:function and py:class directives. #11444

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

Merged
merged 25 commits into from
Jul 23, 2023
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
882d9d8
Add partial support for PEP 695 and PEP 696 syntax (#11438)
picnixz May 28, 2023
031afb8
Fix linter
picnixz May 30, 2023
da95253
rename a test for better clarity
picnixz May 30, 2023
0f985da
fix linter check
picnixz May 30, 2023
5c353f2
fix linter check
picnixz May 30, 2023
cf0d946
remove unused code
picnixz May 30, 2023
81c3bbc
improve tests
picnixz Jun 1, 2023
f553df1
fix linter check
picnixz Jun 1, 2023
08a6840
update .gitignore to ignore the autogenerated (persistent) test-file …
picnixz Jun 3, 2023
489ec30
PEP 695/696 skeleton support for autodoc
picnixz Jun 3, 2023
4eaa0ed
allow independent multi-line support for type parameters and argument…
picnixz Jun 3, 2023
a843d7c
implement visitor methods for type parameters
picnixz Jun 3, 2023
178b8a2
refactor visitor methods for parameters list-like nodes
picnixz Jun 3, 2023
d1293f7
implement LaTeX support
picnixz Jun 3, 2023
e28c44d
fix linter issues
picnixz Jun 3, 2023
9a88771
update LaTeX info strings
picnixz Jun 3, 2023
d66e98a
update CHANGES
picnixz Jun 3, 2023
a1b89bb
update documentation
picnixz Jun 3, 2023
02df300
update LaTeX code and writer
picnixz Jun 6, 2023
160b5cc
update LaTeX doc
picnixz Jun 6, 2023
a924d4a
update Python domain doc
picnixz Jun 6, 2023
79a2b06
fix typo in LaTeX doc
picnixz Jun 6, 2023
8a1800b
Merge branch 'master' into feature/11438-PEP-695-support
picnixz Jul 16, 2023
7127d63
Merge branch 'master' into feature/11438-PEP-695-support
AA-Turner Jul 23, 2023
ba39b4f
Updates
AA-Turner Jul 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
Prev Previous commit
Next Next commit
update Python domain doc
  • Loading branch information
picnixz committed Jun 6, 2023
commit a924d4ad04c76e53b1ec0d8f42c69fcd9b208e17
23 changes: 18 additions & 5 deletions doc/usage/restructuredtext/domains.rst
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ The following directives are provided for module and class contents:
.. py:exception:: name[type parmeters](parameters)

Describes an exception class. The signature can, but need not include
parentheses with constructor arguments.
parentheses with constructor arguments, or may optionally include type
parameters (see :pep:`695`).

.. rubric:: options

Expand Down Expand Up @@ -379,9 +380,9 @@ The following directives are provided for module and class contents:
.. rst:directive:option:: single-line-type-parameter-list
:type: no value

Ensure that the class constructor's type parameters are emitted on a
single logical line, overriding :confval:`python_maximum_signature_line_length`
and :confval:`maximum_signature_line_length`.
Ensure that the class type parameters are emitted on a single logical
line, overriding :confval:`python_maximum_signature_line_length` and
:confval:`maximum_signature_line_length`.

.. rst:directive:: .. py:attribute:: name

Expand Down Expand Up @@ -620,7 +621,19 @@ argument support), you can use brackets to specify the optional parts:
It is customary to put the opening bracket before the comma.

Since Python 3.12, it is possible to indicate type parameters directly at the
function or class definition site::
function or class definition site:

.. code-block:: python

class MyDict[T](dict[str, T]):
...

def add[T](x: T, y: T) -> T:
return x + y

The corresponding documentation would look like::

.. py:class:: MyDict[T]

.. py:function:: add[T](x: T, y: T) -> T

Expand Down
0