Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(python): autogenerate docs/index.rst #1114

Merged
merged 25 commits into from
Oct 14, 2021

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Jun 14, 2021

This PR is a first step towards auto generating docs/index.rst for most python repos.

The function detect_versions in synthtool/languages/python.py is identical to the one used by node here so alternatively, we could consider moving the existing function detect_versions outside of node.py.

@parthea parthea requested a review from a team June 14, 2021 00:43
@parthea parthea requested a review from a team as a code owner June 14, 2021 00:43
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jun 14, 2021
@parthea parthea requested a review from busunkim96 June 14, 2021 00:45
@parthea
Copy link
Contributor Author

parthea commented Jun 14, 2021

As an example, I ran the version of synthtool in this PR in the python-memcache repo and auto generated the docs/index.rst file. You can see the result here.

@parthea parthea force-pushed the add-docs-index-rst-to-template branch from 70020e2 to c0af3ab Compare June 14, 2021 00:49
synthtool/languages/python.py Outdated Show resolved Hide resolved
synthtool/languages/python.py Outdated Show resolved Hide resolved
synthtool/languages/python.py Outdated Show resolved Hide resolved
tests/test_python_library.py Outdated Show resolved Hide resolved
tests/test_python_library.py Outdated Show resolved Hide resolved
@parthea parthea removed their assignment Sep 29, 2021
@parthea parthea marked this pull request as draft September 29, 2021 16:45
Copy link
Contributor

@dandhlee dandhlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like from Sphinx side not much has changed, I'll take that as a good thing. LGTM.

Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker for me on landing this, but ideally we'd DRY up the detect version logic.

If you don't opt to do so in this PR, mind creating a tracking issue to do so?

@@ -93,6 +94,50 @@ def _get_sample_readme_metadata(sample_dir: Path) -> dict:
return sample_metadata


def detect_versions(path: str = "./google/cloud") -> List[str]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How hard would it be for us to pull this into a common file, if the logic is identical?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Please could you take another look?

@parthea parthea added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Oct 13, 2021
@parthea parthea removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Oct 14, 2021
@parthea parthea requested a review from bcoe October 14, 2021 00:35
@parthea parthea assigned bcoe and unassigned chingor13 and busunkim96 Oct 14, 2021
Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for cleaning this up @parthea 👏 , reading through the current owlbot logic, I saw that versions is actually loaded in a separate code path:

        # Collect the subdirectories of the src directory.
        src = Path("src")
        versions = [v.name for v in src.iterdir() if v.is_dir()]
        # Reorder the versions so the default version always comes last.
        versions = [v for v in versions if v != default_version] + [default_version]
        logger.info(f"Collected versions ${versions} from ${src}")

So I think you've gotten rid of some code that would have otherwise have hung around indefinitely.

@parthea parthea merged commit c1e5e1c into master Oct 14, 2021
@parthea parthea deleted the add-docs-index-rst-to-template branch October 14, 2021 16:06
abdelmegahedgoogle pushed a commit to abdelmegahedgoogle/python-bigquery that referenced this pull request Apr 17, 2023
…oogleapis#1001)

Set codeowner_team to googleapis/api-bigquery as codeowner. Set default_version to v2. This change is needed for the following synthtool PRs.

googleapis/synthtool#1201
googleapis/synthtool#1114
parthea added a commit to googleapis/google-cloud-python that referenced this pull request Jun 4, 2023
…33)

By default the code owner will be googleapis/yoshi-python. This change is needed for the following synthtool PRs.

googleapis/synthtool#1201
googleapis/synthtool#1114
parthea added a commit to googleapis/google-cloud-python that referenced this pull request Jun 4, 2023
…29)

By default the code owner will be googleapis/yoshi-python. This change is needed for the following synthtool PRs.

googleapis/synthtool#1201
googleapis/synthtool#1114
parthea added a commit to googleapis/google-cloud-python that referenced this pull request Jun 4, 2023
…47)

By default the code owner will be googleapis/yoshi-python. This change is needed for the following synthtool PRs.

googleapis/synthtool#1201
googleapis/synthtool#1114
parthea added a commit to googleapis/google-cloud-python that referenced this pull request Jun 4, 2023
…116)

By default the code owner will be googleapis/yoshi-python. This change is needed for the following synthtool PRs.

googleapis/synthtool#1201
googleapis/synthtool#1114
parthea added a commit to googleapis/google-cloud-python that referenced this pull request Jun 4, 2023
…92)

By default the code owner will be googleapis/yoshi-python. This change is needed for the following synthtool PRs.

googleapis/synthtool#1201
googleapis/synthtool#1114
parthea added a commit to googleapis/google-cloud-python that referenced this pull request Jun 4, 2023
…118)

By default the code owner will be googleapis/yoshi-python. This change is needed for the following synthtool PRs.

googleapis/synthtool#1201
googleapis/synthtool#1114
vchudnov-g pushed a commit to googleapis/google-cloud-python that referenced this pull request Sep 20, 2023
…411)

By default the code owner will be googleapis/yoshi-python. This change is needed for the following synthtool PRs.

googleapis/synthtool#1201
googleapis/synthtool#1114
parthea added a commit to googleapis/google-cloud-python that referenced this pull request Sep 22, 2023
…267)

By default the code owner will be googleapis/yoshi-python. This change is needed for the following synthtool PRs.

googleapis/synthtool#1201
googleapis/synthtool#1114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
6 participants