pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.19k stars 613 forks source link

Python documentation tool support: ReStructured Text language/Sphinx/Etc #18456

Open chrisjrn opened 1 year ago

chrisjrn commented 1 year ago

Pants is currently of limited utility for users who want to publish Python code documentation using standard Python tools, such as Sphinx, and ReadTheDocs.

This ticket is a placeholder for scoping out support for:

kaos commented 1 year ago

Just throwing https://www.mkdocs.org/ in as a means to help frame the design to be flexible enough to take different tooling into account, as appropriate.

cognifloyd commented 1 year ago

Duplicate of #18288, but this one has more details. So, I'm closing that one.

cognifloyd commented 1 year ago

I've also heard of MyST which wraps Sphinx to use Markdown instead of ReST while still benefitting from all the other features of sphinx (directives, links between doc pages, intersphinx links, ...).

cognifloyd commented 1 year ago

Other tools I need to add to pants at some point:

(The StackStorm project needs these, but I haven't had time to work on plugins yet.)

cognifloyd commented 1 year ago

Sphinx support was added and then removed due to flaky tests:

I think the approach in that PR was almost right. One central sphinx_project target is a good UX for users, and should be simple enough for tailor. The implementation there, however, was a little over-simplistic as all of the rst source files were owned by the sphinx_project target, which would have made linting with other tools more difficult.

Instead, I think the sphinx_project should be a target generator that:

The key insight is that target generators can generate more than one type of target.

cburroughs commented 1 year ago

I'm not sure if this is implicit in "Python code documentation", but it would be spiffy if this eventually included ironing out any rough edges to generating pretty pages from python docstrings, such as with https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html or https://mkdocstrings.github.io/.