From 75cb11a6e4b501ca460db645ae906e3d3f35c3e5 Mon Sep 17 00:00:00 2001 From: Laura Kasian Date: Fri, 11 Sep 2026 09:54:45 -0700 Subject: [PATCH 1/2] clean up version switcher logic after public release --- doc/source/conf.py | 49 +++------------------------------------------- 1 file changed, 3 insertions(+), 46 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index c282df74..ef2c2fe6 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,11 +1,9 @@ """Sphinx documentation configuration file.""" -import base64 import os import runpy from datetime import datetime -import requests from ansys_sphinx_theme import ansys_favicon, get_version_match from sphinx_gallery.sorting import FileNameSortKey @@ -67,13 +65,10 @@ "doc_path": "doc/source", } -# specify the location of your github repo -# Note: if the visor repo becomes public, we can set -# "json_url": f"https://{cname}/versions.json" -# and remove fetch_and_save_versions_json() +# specify the location of your GitHub repo html_theme_options = { "switcher": { - "json_url": "_static/versions.json", + "json_url": f"https://{cname}/versions.json", "version_match": switcher_version, }, "github_url": "https://github.com/ansys/Visual-Interactive-Simulation-Object-Renderer/", @@ -190,49 +185,12 @@ master_doc = "index" -# debugging segfault when running the seupt script +# debugging segfault when running the setup script import faulthandler faulthandler.enable() -def fetch_and_save_versions_json(): - """ - Fetches the `versions.json` file from the `gh-pages` branch of the private - VISOR repository using the GitHub API and saves it locally to - `source/_static/versions.json`. - - This is required for the version switcher, as the repository is private and - the file cannot be accessed via the GitHub Pages URL without authentication. - - Requires a valid `GITHUB_TOKEN` for authentication. - This is automatically set in the GitHub Actions workflow, but must be set - manually for local builds, e.g.: - export GITHUB_TOKEN="your_tokem_here" - """ - owner = "ansys" - repo = "visor" - branch = "gh-pages" - file_path = "versions.json" - api_url = f"https://api.github.com/repos/{owner}/{repo}/contents/{file_path}?ref={branch}" - token = os.getenv("GITHUB_TOKEN") - headers = {"Authorization": f"Bearer {token}"} if token else {} - - local_path = os.path.join("source", "_static", "versions.json") - print(f"Fetching {file_path} from {repo}@{branch} via GitHub API...") - - try: - response = requests.get(api_url, headers=headers) - response.raise_for_status() - content = response.json()["content"] - decoded = base64.b64decode(content).decode("utf-8") - with open(local_path, "w+", encoding="utf-8") as f: - f.write(decoded) - print(f"Saved versions.json to {local_path}") - except Exception as e: - print(f"Error fetching versions.json: {e}") - - # Run the script to generate an updated OpenAPI JSON file def generate_openapi_json(): @@ -243,7 +201,6 @@ def generate_openapi_json(): def setup(app): app.connect('builder-inited', lambda app: generate_openapi_json()) - app.connect('builder-inited', lambda app: fetch_and_save_versions_json()) app.add_css_file("css/reset.css") linkcheck_ignore = [] From ef86f8801bd9e734cd2fd5f6e80df26364433a6b Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Fri, 11 Sep 2026 17:03:26 +0000 Subject: [PATCH 2/2] chore: adding changelog file 106.documentation.md [dependabot-skip] --- doc/changelog.d/106.documentation.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/106.documentation.md diff --git a/doc/changelog.d/106.documentation.md b/doc/changelog.d/106.documentation.md new file mode 100644 index 00000000..ee7d2d7f --- /dev/null +++ b/doc/changelog.d/106.documentation.md @@ -0,0 +1 @@ +Clean up version switcher logic after public release