public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/15] Add kernel-doc modules to Documentation/tools
@ 2026-01-15 15:40 Mauro Carvalho Chehab
  2026-01-15 15:40 ` [PATCH v2 01/15] docs: custom.css: prevent li marker to override text Mauro Carvalho Chehab
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Mauro Carvalho Chehab @ 2026-01-15 15:40 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Mauro Carvalho Chehab, linux-doc, linux-kernel,
	Nícolas F. R. A. Prado, Randy Dunlap, Shuah Khan

Hi Jon,

On this version, I made it independent from the other series.
As it doesn't touch scripts/kernel-doc, you can apply it without
affecting your renaming series, either before or after your
series.

I added two extra patches on v2 to address Jani's comments. With
that, we now have 3 preparatory patches not directly related to
sphinx.ext.autodoc.

patch 1: a CSS fix to address problems on indexes
patch 2: a variable rename to stop abusing doctree name
patch 3: don't rely on cwd to get Documentation/ location

Starting from patch 4, there is a series of patches fixing,
cleaning up and improving comments inside tools/lib/python/kdoc/.

Except for one patch touching latex_fonts.py, they're optional.
Their focus is mainly to make the comments more uniform at the
docstrings, and ensure that all public vars and methods are
documented.

The final patch creates new *.rst files that points to
the python.lib.kdoc files that we're documenting.

As noticed before, sphinx.ext.autodoc can only document modules
that follows PEP8 and can be imported via "import" or "from"
directive, e.g. all files:

    - must end with ".py"
    - their names can't have "-".

Documenting a python file is very simple. All it takes is to
use:

    .. automodule:: lib.python.<dir+name>

Usually, we add a couple of variables to it, to control the
documentation scope (add/remove members, showing class
inheritance, showing members that currently don't have
docstrings, etc). That's why we're using:

    .. automodule:: lib.python.kdoc.enrich_formatter
       :members:
       :show-inheritance:
       :undoc-members:

(and similar) inside tools/kdoc*.rst.

autodoc allows filtering in/out members, file docstrings, etc.

It also allows documenting just some members or functions with
directives like:

    ..autofunction:
    ..automember:

Sphinx also has a helper script to generate .rst files with
documentation:

    $ sphinx-apidoc -o foobar tools/lib/python/

which is a variant of sphinx-quickstart. The tool seems to
allow generating everything to build it there in separate,
but this didn't work for me.

On this series, I used its output only as a starting example
to ensure that all files from kdoc were added there.

Mauro Carvalho Chehab (15):
  docs: custom.css: prevent li marker to override text
  docs: conf.py: don't use doctree with a different meaning
  docs: conf: don't rely on cwd to get documentation location
  docs: enable Sphinx autodoc extension to allow documenting python
  docs: custom.css: add CSS for python
  docs: kdoc: latex_fonts: Improve docstrings and comments
  docs: kdoc_files: Improve docstrings and comments
  docs: kdoc_item: Improve docstrings and comments
  docs: kdoc_parser: Improve docstrings and comments
  docs: kdoc_output: Improve docstrings and comments
  docs: kdoc_re: Improve docstrings and comments
  docs: kdoc: parse_data_structs: Improve docstrings and comments
  docs: kdoc: enrich_formatter: Improve docstrings and comments
  docs: kdoc: python_version: Improve docstrings and comments
  docs: add kernel-doc modules documentation

 Documentation/conf.py                       |  23 +--
 Documentation/sphinx-static/custom.css      |  12 ++
 Documentation/tools/index.rst               |   1 +
 Documentation/tools/kdoc.rst                |  12 ++
 Documentation/tools/kdoc_ancillary.rst      |  46 ++++++
 Documentation/tools/kdoc_output.rst         |  14 ++
 Documentation/tools/kdoc_parser.rst         |  29 ++++
 Documentation/tools/python.rst              |  10 ++
 tools/lib/python/kdoc/enrich_formatter.py   |  20 ++-
 tools/lib/python/kdoc/kdoc_files.py         |  23 +--
 tools/lib/python/kdoc/kdoc_item.py          |  18 +++
 tools/lib/python/kdoc/kdoc_output.py        |  60 ++++---
 tools/lib/python/kdoc/kdoc_parser.py        | 169 +++++++++++---------
 tools/lib/python/kdoc/kdoc_re.py            |  18 ++-
 tools/lib/python/kdoc/latex_fonts.py        |  95 ++++++-----
 tools/lib/python/kdoc/parse_data_structs.py |  62 ++++---
 tools/lib/python/kdoc/python_version.py     |  20 ++-
 17 files changed, 431 insertions(+), 201 deletions(-)
 create mode 100644 Documentation/tools/kdoc.rst
 create mode 100644 Documentation/tools/kdoc_ancillary.rst
 create mode 100644 Documentation/tools/kdoc_output.rst
 create mode 100644 Documentation/tools/kdoc_parser.rst
 create mode 100644 Documentation/tools/python.rst

-- 
2.52.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-01-15 15:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-15 15:40 [PATCH v2 00/15] Add kernel-doc modules to Documentation/tools Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 01/15] docs: custom.css: prevent li marker to override text Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 02/15] docs: conf.py: don't use doctree with a different meaning Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 03/15] docs: conf: don't rely on cwd to get documentation location Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 04/15] docs: enable Sphinx autodoc extension to allow documenting python Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 05/15] docs: custom.css: add CSS for python Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 06/15] docs: kdoc: latex_fonts: Improve docstrings and comments Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 07/15] docs: kdoc_files: " Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 08/15] docs: kdoc_item: " Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 09/15] docs: kdoc_parser: " Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 10/15] docs: kdoc_output: " Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 11/15] docs: kdoc_re: " Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 12/15] docs: kdoc: parse_data_structs: " Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 13/15] docs: kdoc: enrich_formatter: " Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 14/15] docs: kdoc: python_version: " Mauro Carvalho Chehab
2026-01-15 15:40 ` [PATCH v2 15/15] docs: add kernel-doc modules documentation Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox