Commit Graph

138 Commits

Author SHA1 Message Date
Adam Turner
9d6667d8f7 Enable Ruff perflint (PERF) rules 2024-01-04 04:12:26 +00:00
Adam Turner
78976662d9 Fix PT003 (implied `scope='function'`) 2023-08-10 13:11:25 +01:00
grayjk
ac2b7599d2
autosummary: Extract summary line after "e.g." (#11196)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-08-07 22:20:30 +01:00
Adam Turner
49d8304670
Start using `pathlib.Path and deprecate sphinx.testing.path` (#11526) 2023-07-28 00:39:12 +01:00
Jean-François B
509cc4533c LaTeX: get aligned longtable obey current list indent
Fix #11268.

Thanks to @picnixz.
2023-04-11 20:32:31 +02:00
Jens Hedegaard Nielsen
3edae68904
autosummary: Support documenting inherited attributes (#10691)
The current implementation of ``import_ivar_by_name`` filters
attributes if the name of the object that the attribute belongs to
does not match the object being documented. However, for inherited
attributes this is not the case. Filtering only on the attribute name
seems to resolve the issue. It is not clear to me if there are any
unwanted sideeffects of this and we should filter on the list of
qualnames for the object and all its super classes (if any).

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-04-06 23:33:43 +01:00
Clément Pinard
9299003d40
Autosummary: Extend `__all__` members to template rendering (#10811)
When ``False``, the ``autosummary_ignore_module_all`` option adds
members to the module's members entry that will be used for autodoc,
but otherwise ignores it. As such, if a class is available in the 
``__all__``, it won't be generated.

This commit aims to extend the ``__all__`` handling not only to
members, but also to corresponding attribute types (function,
classes, exceptions, modules)

The ``imported_members`` option is set to ``True`` if the object has
an ``__all__`` member and ``autosummary_ignore_module_all`` is ``False``
2023-04-06 00:02:37 +01:00
Adam Turner
f435fc05e6 Prefer `contextlib.chdir to sphinx.util.osutil.cd` 2023-03-05 18:49:17 +00:00
Adam Turner
4804390604 Resolve `flake8-return` errors 2023-02-18 02:16:50 +00:00
Adam Turner
13442f6901 Fix pytest style issues 2023-02-18 02:16:50 +00:00
Adam Turner
c8f4a03dac Fix COM812 2023-02-18 01:58:05 +00:00
Adam Turner
a13cf2c24d Adopt `profile = "black" for isort`
This allows using Ruff's import sorting fixers
2023-01-07 18:31:15 +00:00
Adam Turner
4032070e81
Run pyupgrade (#11070) 2023-01-02 00:01:14 +00:00
Takeshi KOMIYA
5344b1b241 Merge branch '5.x' into 10258_autosummary 2022-05-07 21:27:47 +09:00
Adam Turner
4674cc11c8 .write_text(...) -> .write_text(..., encoding='utf8') 2022-04-27 03:11:08 +01:00
Adam Turner
24e3b7c8c8 .read_text() -> .read_text(encoding='utf8') 2022-04-27 03:04:19 +01:00
Matyas Novak
07b2a050c7 Test recognition of a documented instance of a class as a non-imported member of the module 2022-03-14 23:31:33 +01:00
Adam Turner
5775912455 Collapse single line docstrings 2022-02-20 03:13:45 +00:00
Adam Turner
6bb7b891a1 Remove copyright and licence fields 2022-02-20 03:06:23 +00:00
Adam Turner
5694e0ce60 Fix module docstring indentation 2022-02-20 00:35:13 +00:00
Adam Turner
4f5a3269a6 Fix module docstring first line 2022-02-20 00:11:08 +00:00
Adam Turner
6b8bccec59 Remove module titles in docstrings 2022-02-19 23:17:29 +00:00
Takeshi KOMIYA
b84771dcd2 A happy new year! 2022-01-01 18:45:03 +09:00
Josh Mitchell
73b7cd51ea Fix lints and reorder args of members_of 2021-11-22 13:57:56 +11:00
Josh Mitchell
8e45229fee Fixed missed ignore___all__ -> ignore_module_all 2021-11-15 13:27:26 +11:00
Josh Mitchell
79089b5fa4 Corrections from review by tk0miya 2021-11-15 13:18:47 +11:00
Josh Mitchell
ad0071ddb7 #2021: Allow autosummary to respect __all__ 2021-11-15 13:16:33 +11:00
Takeshi KOMIYA
0a8655b733 Fix #9600: autosummary: Typehints including commas confuses autosummary 2021-09-04 01:54:11 +09:00
Jake Lishman
9d7fa75d4a
Fix #9568: autosummary: summarise overlined sectioned headings correctly
Add an extra step in the autosummary summariser algorithm to get a valid
text form of section headings.  This fixed issues when the first element
of a summarised document was a section heading with overlines, such as

    =======
    Heading
    =======

Previously, the first line would be taken verbatim, which caused parse
errors in the rest of the document.
2021-08-20 17:05:58 +01:00
Pawel Budzynski
f12f5bc075 add tests 2021-04-29 14:48:56 +02:00
Takeshi KOMIYA
6e438af6c0 test: Update testcase for docutils-0.17 (empty language)
Since v0.17, docutils starts to load language module on parsing reST
document using StateMachine directly.  So far, our testcase uses invalid
language code for testing autosummary.  This fixes it to work with new
docutils.
2021-04-03 23:54:19 +09:00
Takeshi KOMIYA
7ecf6b88aa Merge branch '3.4.x' into 3.x 2021-01-01 13:56:19 +09:00
Takeshi KOMIYA
f996859420 A happy new year!
.. note::

   $ find sphinx tests LICENSE doc/conf.py -type f -exec sed -i '' -e 's/2007\-20../2007-2021/' {} \;
   $ git co sphinx/locale/**/*.js sphinx/templates/epub3/mimetype
2021-01-01 13:40:48 +09:00
Takeshi KOMIYA
54e8b8d9bc refactor: test: Use rollback_sysmodules fixture in test_ext_autosummary 2020-12-31 10:55:45 +09:00
Takeshi KOMIYA
c86e92cb95 Fix #8306: autosummary: mocked modules are documented as empty page
The :recursive: option for autosummary directive creates an empty page
for mocked modules unexpectedly.  This make them ignored.
2020-12-27 21:45:15 +09:00
Takeshi KOMIYA
65ca7aa0c9 Fix #8501: autosummary: summary extraction splits text after "el at."
Add "el at." to the list of abbreviations.
2020-11-28 11:41:06 +09:00
François Freitag
0949735210
Sort imports with isort
Keep imports alphabetically sorted and their order homogeneous across
Python source files.

The isort project has more feature and is more active than the
flake8-import-order plugin.

Most issues caught were simply import ordering from the same module.
Where imports were purposefully placed out of order, tag with
isort:skip.
2020-11-11 13:19:05 +01:00
Takeshi KOMIYA
92e863fb24 Close #8011: autosummary: Support instance attributes
This allows the autosummary directive to take instance attributes to
build documents for them.
2020-08-01 19:19:18 +09:00
Takeshi KOMIYA
da174138af
Merge pull request #7927 from jnothman/name-case-clash
Add autosummary_filename_map config to avoid clashes
2020-07-24 01:07:19 +09:00
Takeshi KOMIYA
68c732e97c autosummary: Add testcase for module constants (refs: #7469) 2020-07-17 01:15:28 +09:00
Joel Nothman
aae8ce8efa Fix toctree generation 2020-07-15 18:46:51 +10:00
Joel Nothman
52c173bdb9 Responding to comments 2020-07-10 11:30:06 +10:00
Joel Nothman
4e0ff5cac2 Fix attempt with new test root 2020-07-08 22:36:40 +10:00
Joel Nothman
72ca2bdffc Add autosummary_filename_map config to avoid clashes 2020-07-08 16:51:57 +10:00
Takeshi KOMIYA
c4f0d70d17
Merge branch '3.x' into 7865_extract_abbr 2020-06-29 02:04:40 +09:00
Takeshi KOMIYA
2d69b4211a Fix #7865: autosummary: Failed to extract summary line when abbr. found 2020-06-27 23:33:43 +09:00
Takeshi KOMIYA
4fa596ba4c Fix #7866: autosummary: Failed to extract correct summary line
A hyperlink target in the docstring causes a system_error because
node_ids are cached expectedly during extracting a summary.
2020-06-27 23:20:59 +09:00
Eric Wieser
d229b120ad Fix autoclass signature parsing
This fixes:
* Signatures defined by __new__
* Signatures defined by metaclasses
* Signatures defined by builtin base classes

All of these changes bring the sphinx docs inline with the behavior of `inspect.signature`.

Note that this changes autodoc to output `.. py:class: MyClass()` with parentheses even if no user-defined __init__ is present.
This is quite deliberate, as if no user-defined `__init__` is present the default is `object.__init__`, which indeed does not take arguments.
2020-05-28 08:36:56 +01:00
Takeshi KOMIYA
784d4cb36a Fix #7685: autosummary: imported members are listed unexpectedly 2020-05-21 01:24:46 +09:00
Daniel Fremont
de4aca857c revisions per comments from tk0miya 2020-05-17 09:07:11 -07:00