Skip to content

Commit

Permalink
chore(python): include docs/UPGRADING.md in docs/index.rst if it exis…
Browse files Browse the repository at this point in the history
…ts (#1245)

* chore(python): include docs/upgrading.rst in docs/index.rst if it exists

* lint

* use UPGRADING.md instead of upgrading.rst

* add migration guide header, update link to doc

* make spacing consistent
  • Loading branch information
parthea committed Oct 19, 2021
1 parent f621fda commit 949c010
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions synthtool/gcp/common.py
Expand Up @@ -258,6 +258,10 @@ def py_library(self, **kwargs) -> Path:
):
self.excludes += ["docs/index.rst"]

# Add kwargs to signal that UPGRADING.md should be included in docs/index.rst if it exists
if Path("docs/UPGRADING.md").exists():
kwargs["include_uprading_doc"] = True

# Assume the python-docs-samples Dockerfile is used for samples by default
if "custom_samples_dockerfile" not in kwargs:
kwargs["custom_samples_dockerfile"] = False
Expand Down
11 changes: 6 additions & 5 deletions synthtool/gcp/templates/python_library/docs/index.rst
Expand Up @@ -14,23 +14,24 @@ API Reference
{{ version }}/services
{{ version }}/types
{% endfor %}
{%- if migration_guide_version %}
{% if include_uprading_doc %}
Migration Guide
---------------

See the guide below for instructions on migrating to the {{ migration_guide_version }} release of this library.
See the guide below for instructions on migrating to the latest version.

.. toctree::
:maxdepth: 2

UPGRADING
 UPGRADING

{% endif %}
Changelog
---------

For a list of all ``{{ metadata['repo']['distribution_name'] }}`` releases:

.. toctree::
:maxdepth: 2
:maxdepth: 2

changelog
changelog

0 comments on commit 949c010

Please sign in to comment.