Commit Graph
5111 Commits
Author SHA1 Message Date
Adam Turner e3175f4477 Reorganise and rename `sphinx.ext.autodoc._importer` (#14036) 2025-11-04 23:00:02 +00:00
Adam Turner f7b98a03c6 Split autodoc loader functions to a new module (#14035) 2025-11-04 22:38:51 +00:00
Adam Turner 4d2bd1e862 Split autodoc name parsing utilities to a new module (#14033) 2025-11-04 21:32:15 +00:00
Adam Turner 6de23cd95e Split autodoc signature utilities to a new module (#14032) 2025-11-04 20:58:56 +00:00
Adam Turner 6127d76bb4 Integrate autodoc event callbacks into importer (#14031) 2025-11-04 19:03:32 +00:00
Adam Turner 8ca7120987 Split out `test_ext_autodoc_typehints` (#14027) 2025-11-04 12:07:05 +00:00
Adam Turner 83442bee4b Group the type alias cross-referencing test with Python domain tests (#14021) 2025-11-03 19:34:58 +00:00
Adam Turner fcc9ca037d Define and use `TEST_ROOTS_DIR` (#14020) 2025-11-03 16:09:48 +00:00
Adam Turner 8c86bad0ef Remove `env` from autodoc interfaces (#14018) 2025-11-03 00:30:53 +00:00
Adam Turner 54e80f70ae Calculate and use the `docstring_lines` attribute (#14015) 2025-11-02 21:40:48 +00:00
Adam Turner 48f6739838 Accept a sequence of strings in `extract_summary()` (#14014) 2025-11-02 21:11:40 +00:00
Adam Turner de745a9eaa Consolidate option spec processing into `_directive_options.py` (#14009) 2025-10-29 23:53:15 +00:00
Adam Turner 465b758a35 Extract `_generate_directives() from Documenter._generate()` (#13985) 2025-10-22 00:23:22 +01:00
Adam Turner fdf5411c1c Remove `DocumenterBridge` (#13984) 2025-10-21 19:06:53 +01:00
Adam Turner 6083b5a550 Move member merging logic from `options to _member_finder` (#13982) 2025-10-21 18:13:12 +01:00
Adam Turner 90192fc763 Use `_load_object_by_name()` directly (#13978) 2025-10-20 17:44:53 +01:00
Adam Turner 1156555fcc Introduce `_AutodocAttrGetter` type (#13971) 2025-10-19 18:37:12 +01:00
Adam Turner ff3e1d23e3 Use `_AutodocObjType` more consistently (#13970) 2025-10-19 18:23:27 +01:00
Adam Turner dcfaa98e80 Remove unused items in `_documenters` (#13963) 2025-10-17 03:07:31 +01:00
Adam Turner f194178967 Use a new `_best_object_type_for_member()` function (#13961) 2025-10-17 01:56:54 +01:00
Adam Turner a8f2b9629b Improve various autodoc tests (#13958) 2025-10-16 21:30:21 +01:00
Adam Turner 4c89a82c1d Improve signature handling in autodoc (#13955) 2025-10-16 18:54:18 +01:00
ad3f3cc062 Add initial support for PEP 695 type aliases (#13508)
Signed-off-by: Martin Matous <m@matous.dev>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Jeremy Maitin-Shepard <jbms@google.com>
2025-10-10 01:41:42 +01:00
Adam Turner 8923f08676 Extract most docstring-related logic (#13941) 2025-10-09 23:15:28 +00:00
Jeremy Maitin-ShepardandAdam Turner f3e8999a53 autodoc: Avoid updating `__annotations__` with parent class members (#13935)
This commit ensures that the ``__annotations__`` dict of a class is
updated only with type comment-derived annotations for direct members;
the type comment-derived annotations for parent classes are added to
those parent classes own ``__annotations__`` dicts. The inherited
member annotations are still found by ``typing.get_type_hints``.

This commit also improves the efficiency of incorporating the
annotations found by the ``ModuleAnalyzer``.  Previously, each call to
``_load_object_by_name`` for a data member or attribute would result
in separately iterating over all attributes (including within
classes) found by ModuleAnalyzer for the containing module, and in
the case of classes, the containing modules of all parent classes.
For modules with many members this cost could likely be significant.
With this commit, at least for the purpose of updating
``__annotations__`` dicts, each module's attributes only processed a
single time in total.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-10-07 00:42:42 +01:00
Adam Turner 5e0b3ef9e1 Extract directive header construction from runtime introspection (#13931) 2025-10-06 21:09:04 +01:00
Adam Turner 046151a2d5 Create subpackages for related `sphinx.ext` tests (#13930) 2025-10-06 01:16:39 +01:00
Stephen FinucaneandAdam Turner 44a98961b2 Use hyphenated version directives (#13714)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-06 00:10:35 +01:00
Jeremy Maitin-Shepard f578eedb10 Fix incorrect index treatment of the `:canonical: option in the py:type` directive (#13926) 2025-10-05 04:01:44 +01:00
Jared DillardandAdam Turner 8dd7a23fec Add warning sub-type for duplicate equation label warnings (#13929)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-05 03:59:09 +01:00
Adam Turner 645bc53486 Bump mypy to 1.18.2 2025-10-05 02:55:40 +01:00
Günter Milde 56939e92c2 Fix test setup for directive tests with Docutils 0.22+ (#13883) 2025-10-05 02:49:40 +01:00
Adam Turner 36a4294ca2 Bump Ruff to 0.13.3 2025-10-05 01:49:43 +01:00
Adam Turner eaebbec4d1 Refactor `add_sidebars() into _get_sidebars()` (#13863) 2025-09-01 19:10:06 +01:00
ludovic-steinbach 14717292b0 Use config value as default doctest group name (#13859) 2025-09-01 18:40:40 +01:00
James AddisonandAdam Turner e8ab5cf1c5 linkcheck: Fix `linkcheck_allowed_redirects` default sentinel (#13483)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-08-18 22:48:31 +01:00
Adam Turner 7814844055 Extract autodoc object member gathering (#13820) 2025-08-08 03:16:35 +01:00
Jean-François B. 6c9e3209c4 LaTeX: support CSS3 length units (#13657) 2025-08-06 12:10:59 +02:00
Jean-François B. bda34f914d LaTeX: revisit and trim visit_target() (#13616) 2025-08-06 11:35:58 +02:00
Ian Hunt-Isaak fa172eab80 Add `py:class to py:data` fallback for type alias cross-references (#10785) (#13808) 2025-08-04 21:42:03 +01:00
Adam Turner 67047523bf Prefer `props._obj to documenter.object` (#13804) 2025-08-03 18:18:56 +01:00
Adam Turner 667925d2f3 Prefer using attributes on `documenter.props` (followup) (#13803) 2025-08-03 17:26:18 +01:00
Adam Turner 3fc158804c Prefer using attributes on `self.props` in Documenter classes (#13801) 2025-08-03 17:11:20 +01:00
Adam Turner 7715d6f50e Store object `__module__ for get_real_modname()` (#13799) 2025-08-02 02:25:02 +01:00
Adam Dangoor ab5d43c0ba Remove mypy overrides for `tests/test_environment/test_environment.py` (#13792) 2025-08-02 02:24:32 +01:00
Adam Dangoor d74e54415b Remove mypy overrides for `tests/test_project.py` (#13791) 2025-08-02 02:24:03 +01:00
Adam Dangoor 9a17e80fe0 Remove mypy overrides for `tests/test_markup/test_parser.py` (#13780) 2025-08-02 02:23:41 +01:00
Adam Turner a1b80c795b Add `object_name to _ItemProperties` (#13798) 2025-08-02 01:22:49 +01:00
Adam Turner 4bed65e18f Combine name resolution and importing (#13797) 2025-08-02 01:01:21 +01:00
Adam Turner 556a5f1095 Hold properties for the documented objects in new types (#13796) 2025-08-01 15:07:48 +01:00