From 7d53e14050c355186f1c0c0feab2bd46ecb80dc3 Mon Sep 17 00:00:00 2001 From: "Vipul Gupta (@vipulgupta2048)" Date: Mon, 18 Nov 2024 21:16:56 +0530 Subject: [PATCH] patch: Create versioned docs for Python SDK Signed-off-by: Vipul Gupta (@vipulgupta2048) --- .cspell/balena-words.txt | 1 + .gitignore | 6 +++++- config/navigation.txt | 2 +- config/redirects.txt | 4 ++++ pages/reference/sdk/python-sdk.md | 14 ++++++++++++++ templates/balena-sdk-python.html | 8 ++++++++ tools/build.sh | 3 +++ tools/fetch-external.sh | 2 +- 8 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 pages/reference/sdk/python-sdk.md create mode 100644 templates/balena-sdk-python.html diff --git a/.cspell/balena-words.txt b/.cspell/balena-words.txt index f45656de8..6ac414256 100644 --- a/.cspell/balena-words.txt +++ b/.cspell/balena-words.txt @@ -8,6 +8,7 @@ balenacli balenahup balenalib balenasdk +balenasdkpython balenista balenistas Barys diff --git a/.gitignore b/.gitignore index ca4ea799c..641c7a7ca 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ tmp # Ignore external docs that are pulled via tools/fetch-external.sh # pages/reference/sdk/node-sdk.md -pages/reference/sdk/python-sdk.md +# pages/reference/sdk/python-sdk.md pages/reference/supervisor/supervisor-api.md pages/reference/supervisor/upgrade-policy.md @@ -50,6 +50,10 @@ shared/balena-cli-versions/ config/dictionaries/balenasdk.json shared/balena-sdk-versions/ +# Ignore dynamic Python SDK version docs +config/dictionaries/balenasdkpython.json +shared/balena-sdk-python-versions/ + # Ignore dynamic assets generated for Getting Started static/img/device/** config/dictionaries/device.json diff --git a/config/navigation.txt b/config/navigation.txt index 2a3ee4598..be4ca64a0 100644 --- a/config/navigation.txt +++ b/config/navigation.txt @@ -152,7 +152,7 @@ Reference CLI[/reference/balena-cli/$balenacli] SDKs Node.js SDK[/reference/sdk/node-sdk/$balenasdk] - Python SDK[/reference/sdk/python-sdk] + Python SDK[/reference/sdk/python-sdk/$balenasdkpython] Deprecation Policy[/reference/sdk/deprecation-policy] Diagnostics diff --git a/config/redirects.txt b/config/redirects.txt index 2b893f5eb..9782879bb 100644 --- a/config/redirects.txt +++ b/config/redirects.txt @@ -274,6 +274,10 @@ /reference/sdk/node-sdk/ /reference/sdk/node-sdk/latest/ /reference/sdk/node-sdk /reference/sdk/node-sdk/latest/ +# Versioned Python.js SDK docs +/reference/sdk/python-sdk/ /reference/sdk/python-sdk/latest/ +/reference/sdk/python-sdk /reference/sdk/python-sdk/latest/ + # Important: keep dynamic redirect below the static redirects # https://developers.cloudflare.com/pages/platform/redirects/ diff --git a/pages/reference/sdk/python-sdk.md b/pages/reference/sdk/python-sdk.md new file mode 100644 index 000000000..a77c4fd4d --- /dev/null +++ b/pages/reference/sdk/python-sdk.md @@ -0,0 +1,14 @@ +--- +title: balena Python SDK Documentation + +layout: balena-sdk-python.html + +dynamic: + variables: [ $balenasdkpython ] + ref: $original_ref/$balenasdkpython + $switch_text: balena SDK version $balenasdkpython +--- + +# Balena Python SDK {{ $balenasdkpython.version }} Documentation + +{{import "balena-sdk-python-versions"}} diff --git a/templates/balena-sdk-python.html b/templates/balena-sdk-python.html new file mode 100644 index 000000000..a05b70b2b --- /dev/null +++ b/templates/balena-sdk-python.html @@ -0,0 +1,8 @@ +{% extends "default.html" %} + +{% block dynamicSwitchCustom %} +

+

+{% endblock %} + +
diff --git a/tools/build.sh b/tools/build.sh index df254a4ba..8a3b372f2 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -16,6 +16,9 @@ node ./tools/versioning.js https://github.com/balena-io/balena-cli/blob/master/d # Generate versioned balena-sdk docs node ./tools/versioning.js https://github.com/balena-io/balena-sdk/blob/master/DOCUMENTATION.md +# Generate versioned balena-sdk docs +node ./tools/versioning.js https://github.com/balena-io/balena-sdk-python/blob/master/DOCUMENTATION.md + # Generate Masterclasses Dynamically ./tools/build-masterclass.sh diff --git a/tools/fetch-external.sh b/tools/fetch-external.sh index 6e0d126ce..ddd8edc15 100755 --- a/tools/fetch-external.sh +++ b/tools/fetch-external.sh @@ -100,7 +100,7 @@ cd shared/sdk/ && { } & # get latest python SDK docs -curl --fail --show-error -o pages/reference/sdk/python-sdk.md -L https://github.com/balena-io/balena-sdk-python/raw/master/DOCUMENTATION.md & +# curl --fail --show-error -o pages/reference/sdk/python-sdk.md -L https://github.com/balena-io/balena-sdk-python/raw/master/DOCUMENTATION.md & # get latest base images ref docs cd pages/reference/base-images/ && {