Commit Graph

9 Commits

Author SHA1 Message Date
Dennis Shao
1275ce88f9 Add missing rst files 2022-06-22 21:50:12 +00:00
Dennis Shao
c62c2340ca Update rst files for Python generated docs 2022-06-22 21:33:46 +00:00
Deanna Garcia
bb7e5824b2 Pin googleapis-common-protos to most recent version 2022-05-12 20:39:50 +00:00
Deanna Garcia
43b1427c18 Update python doc gen versions 2022-05-12 18:12:55 +00:00
noahdietz
5abf802bc2 Replace master with main in URLs & docs 2022-04-12 10:25:08 -07:00
David L. Jones
c953182fa9
Generate documentation for internal.container. (#7294)
Since our (public) generated APIs document their use of repeated fields, we should probably document its API, too.

This includes some changes to generate_docs.py to explicitly allow named modules, since the repeated field implementation lives in the "internal" tree.
2020-04-22 21:41:12 -07:00
David L. Jones
228fbf513d Change dependencies in the Conda environment.
We can remove the dependency on sphinxcontrib, since sphinx.ext.napoleon is
already available. This means we can drop conda-forge, which substantially
reduces build memory usage (see: readthedocs/readthedocs.org#6742,
conda/conda#5003, conda/conda#8650, readthedocs/readthedocs.org#6692).

Bump Sphinx to 2.4.0, while we're at it.
2020-03-09 19:55:33 -07:00
Tim Swast
35a2bf9d90
python: publish sphinx docs to read the docs
Background:

This is a follow-up to the PR that adds sphinx docs.

Read the Docs is a hosting platform for documentation, primarily Python
docs. It supports builds at commit time as well as at specific git
labels to support versioned docs. I have claimed the
protobuf.readthedocs.io project and can add any Googlers who need access
to be able to configure and trigger builds.
https://readthedocs.org/projects/protobuf/builds/ It's also relatively
easy to create a new project to test the documentation builds from a
fork, such as https://readthedocs.org/projects/tswast-protobuf/builds/

About this change:

Once web hooks are configured, Read the Docs will automatically build
the docs for the latest changes on the master branch.

I needed to update `python/setup.py` to support installation from the
root of the repository because Read the Docs does not `cd python` before
installing the protobuf package with `setup.py install`. To support
this, I updated the file paths to use the absolute path to files. The
`__file__` special variable comes in handy for this, as it provides the
path to the `setup.py` file.

A banner is added to the docs when published to readthedocs. This links
to the official documentation and the future home of the stable API
reference on googleapis.dev.
2020-02-28 13:36:50 -06:00
Tim Swast
29c83baecc
python: add sphinx docs (#6525)
* python: generate documentation with Sphinx and Read the Docs

Background:

Formerly, the Python protobuf reference documentation was built with
[Epydoc](http://epydoc.sourceforge.net/). This package has not been
updated since 2008, and it has inconsistent formatting (see internal
issue 131415575) with most Python documentation. Sphinx is used for the
official docs.python.org docs as well as most other Python packages,
including the Google client libraries and related packages, such as
https://googleapis.dev/python/google-api-core/latest/

To build the docs with Sphinx:

1. Install the needed packages (`sphinx`, `sphinxcontrib-napoleon` for
Google-style docstring support). I've created a conda environment file
to make this easier:

```
conda env create -f python/docs/environment.yml
```

2. (Optional) Generate reference docs files and regenerate index:

```
cd python
python generate_docs.py
cd ..
```

3. Run Sphinx.

```
cd python/docs
make html
```

About this change:

The script at `python/generate_docs.py` creates a ReStructured Text file
for each public module in the protobuf Python package. The script also
updates the table of contents in `python/docs/index.rst` to point to
these module references.

Future work:

Testing the docs build on PRs requires contributors to actually do some
setup work to configure builds on their fork. It'd be better if CI had a
docs build session to verify that the Sphinx docs generation at least
runs.

There are many warnings due to not-quite-correct docstrings in the
actual Python code itself. I'm choosing to ignore these errors to keep
the PR small, but I recommend you fix these and then enable "fail on
warnings" in the docs build on CI.

* add docs to EXTRA_DIST

* add instructions to build documentation to generate_docs.py

* exclude python/odcs from cpp_distcheck
2020-02-11 11:40:17 -08:00