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

Replace Python SDK docs with vanilla Sphinx + Read the Docs theme #10279

Merged
merged 6 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/generate-provider-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
working-directory: docs
- if: github.event.action == 'non-resource-provider'
name: generate python docs
run: ./scripts/generate_python_docs.sh "${{ env.PROVIDER_SHORT_NAME }}"
run: ./scripts/generate_python_docs.sh
working-directory: docs
- name: git status
if: github.event.action == 'non-resource-provider'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pulumi-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
run: PKGS=pulumi NOBUILD=true ./scripts/run_typedoc.sh
working-directory: docs
- name: generate python docs
run: ./scripts/generate_python_docs.sh "pulumi"
run: ./scripts/generate_python_docs.sh
working-directory: docs
- name: generate markdown
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ _vendor/

# Ignore log files.
/scripts/link-checker/pages-with-broken-links.txt

.doctrees/
.buildinfo
2 changes: 1 addition & 1 deletion config/_default/menus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ languages:
- name: SDK docs
identifier: sdk-docs-python
parent: python
pageRef: /docs/reference/pkg/python/pulumi
url: https://www.pulumi.com/docs/reference/pkg/python/pulumi/
weight: 1
- name: SDK docs
identifier: sdk-docs-go
Expand Down
3 changes: 0 additions & 3 deletions content/docs/reference/pkg/python/_index.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: /docs/reference/pkg/python/pulumi/
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: /docs/reference/pkg/python/pulumi_policy/
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: /docs/reference/pkg/python/pulumi_terraform/
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: /docs/reference/pkg/python/pulumi_terraform/
---
2,517 changes: 0 additions & 2,517 deletions content/docs/reference/pkg/python/pulumi/_index.md

This file was deleted.

375 changes: 0 additions & 375 deletions content/docs/reference/pkg/python/pulumi_policy/_index.md

This file was deleted.

47 changes: 0 additions & 47 deletions content/docs/reference/pkg/python/pulumi_terraform/_index.md

This file was deleted.

503 changes: 1 addition & 502 deletions content/docs/reference/pkg/python/pulumi_terraform/state/_index.md

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions cypress/integration/site_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,4 @@ describe("www.pulumi.com", () => {
});
});
});

describe("python SDK docs", () => {
beforeEach(() => {
cy.visit("/docs/reference/pkg/python/pulumi");
});

// Regression test for https://github.com/pulumi/docs/issues/1396, which has happened multiple times.
// The CSS is applied by targeting specific node structures due to the way our Python docs are generated.
it("is styled correctly", () => {
cy.get("#pulumi-python-sdk")
.invoke("css", "--pulumi-python-sdk")
.should("equal", "true");
});
});
});
33 changes: 10 additions & 23 deletions scripts/generate_python_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,27 @@
set -o errexit -o pipefail
set -x

# Optional argument to generate docs for just a single provider.
REPO_OVERRIDE="${1:-}"

PACKAGES=(
"pulumi"
"pulumi_policy"
"pulumi_terraform"
)

OUTDIR="../../static-prebuilt/docs/reference/pkg/python"

pushd "tools/pydocgen"

pipenv --python 3
pipenv install

pipenv run pip install sphinx-rtd-theme

if [ -z "${REPO_OVERRIDE:-}" ]; then
echo "Building all Python docs..."
# Install the Python package for all the providers.
for PACKAGE in "${PACKAGES[@]}" ; do \
pipenv run pip install "${PACKAGE}"
done

# Run the pydocgen to generate the docs for all the packages.
pipenv run python -m pydocgen "../../static-prebuilt/docs/reference/pkg/python" "../../content/docs/reference/pkg"
else
# Install the Python package and run the pydocgen tool for just the provider that
# was requested.
echo "Building Python docs for ${REPO_OVERRIDE}..."
PACKAGE="pulumi"
if [ "${REPO_OVERRIDE}" != "pulumi" ]; then
PACKAGE="pulumi_${REPO_OVERRIDE}"
fi
echo "Building all Python docs..."
# Install each package.
for PACKAGE in "${PACKAGES[@]}" ; do \
pipenv run pip install "${PACKAGE}"
pipenv run python -m pydocgen "../../static-prebuilt/docs/reference/pkg/python" "../../content/docs/reference/pkg" "${PACKAGE}"
fi
done

rm -rf "$OUTDIR"
pipenv run sphinx-build -j auto -b dirhtml ./source "$OUTDIR"

popd
4 changes: 0 additions & 4 deletions static-prebuilt/docs/reference/pkg/python/.buildinfo

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading