From 46418da2d14c613aff3596db8fc772ad8e3de9fe Mon Sep 17 00:00:00 2001 From: Elizabeth Santorella Date: Fri, 10 Nov 2023 09:46:44 -0800 Subject: [PATCH] Remove kernel_name argument from tutorials build scripts (#1977) Summary: The `make_tutorials.py` script accepted a `kernel_name` argument but did nothing with it. Pull Request resolved: https://github.com/facebook/Ax/pull/1977 Test Plan: `./scripts/make_docs.sh` on my laptop; I will check that the tutorials look as expected on the website. Reviewed By: Balandat Differential Revision: D51205173 Pulled By: esantorella fbshipit-source-id: 6c80993745baffbfb595649dd32c255a77c7625e --- .github/workflows/deploy.yml | 2 +- CONTRIBUTING.md | 2 +- scripts/make_docs.sh | 13 ++----------- scripts/make_tutorials.py | 13 +------------ scripts/publish_site.sh | 11 +++-------- 5 files changed, 8 insertions(+), 33 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1882c97522c..0dbdea193ca 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,7 +39,7 @@ jobs: env: DOCUSAURUS_PUBLISH_TOKEN: ${{ secrets.DOCUSAURUS_PUBLISH_TOKEN }} run: | - bash scripts/publish_site.sh -d -k python3 -v ${{ github.event.release.tag_name }} + bash scripts/publish_site.sh -d -v ${{ github.event.release.tag_name }} deploy: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c88abeb6c41..66350ca00fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -70,7 +70,7 @@ Additional details: * This is the unversioned site built off of the current repository. Versioning is much more complex, and is generally not necessary for testing the site. Versioning is automatically handled when publishing the site to `gh-pages`. * Skipping Sphinx API & tutorials: to build the site without running Sphinx or compiling the tutorials, pass the `-o` flag to the `make_docs.sh` script. This is especially useful when you want to iterate quickly on making changes to the Docusaurus config and you've already run Sphinx and tutorial generation (the outputs are still in `website` subdirectory and will be picked up). -* Tutorials: we embed tutorials written in Jupyter notebooks into the site. By default, these tutorials are converted to HTML without execution. However, you can execute all tutorials via `./scripts/make_docs.sh -t`, optionally specifying the Jupyter kernel to use via `-k [kernel_name]`. If you do execute the tutorials, please keep in mind that the version of Ax you have installed should match the version of Ax you're trying to build tutorials for. +* Tutorials: we embed tutorials written in Jupyter notebooks into the site. By default, these tutorials are converted to HTML without execution. However, you can execute all tutorials via `./scripts/make_docs.sh -t`. If you do execute the tutorials, please keep in mind that the version of Ax you have installed should match the version of Ax you're trying to build tutorials for. ### Publishing The site is hosted as a GitHub page (on the `gh-pages` branch). We build the [latest version](https://ax.dev/versions/latest/index.html) of the site with every commit to the `main` branch via GitHub Actions. The latest version of the site can be manually updated using `./scripts/publish_site.sh` (assuming proper credentials). diff --git a/scripts/make_docs.sh b/scripts/make_docs.sh index 00f12d6a542..857bbcd0370 100755 --- a/scripts/make_docs.sh +++ b/scripts/make_docs.sh @@ -8,7 +8,7 @@ set -e usage() { - echo "Usage: $0 [-b] [-o] [-r] [-t] [-k kernel_name]" + echo "Usage: $0 [-b] [-o] [-r] [-t]" echo "" echo "Build Ax documentation. Must be executed from root of Ax repository." echo "" @@ -16,7 +16,6 @@ usage() { echo " -o Only Docusaurus (skip Sphinx, tutorials). Useful when just make change to Docusaurus settings." echo " -t Execute tutorials (instead of just converting)." echo " -r Convert backtick-quoted class or function names in .md files into links to API documentation." - echo " -k Kernel name to use for executing tutorials. Use Jupyter default if not set." echo "" exit 1 } @@ -24,7 +23,6 @@ usage() { BUILD_STATIC=false ONLY_DOCUSAURUS=false BUILD_TUTORIALS=false -KERNEL_NAME=false INSERT_API_REFS=false while getopts 'hbotrk:' flag; do @@ -44,9 +42,6 @@ while getopts 'hbotrk:' flag; do r) INSERT_API_REFS=true ;; - k) - KERNEL_NAME=${OPTARG} - ;; *) usage ;; @@ -106,11 +101,7 @@ if [[ $ONLY_DOCUSAURUS == false ]]; then # mkdir -p "website/_tutorials" # mkdir -p "website/static/files" if [[ $BUILD_TUTORIALS == true ]]; then - if [[ $KERNEL_NAME == false ]]; then - python3 scripts/make_tutorials.py -w "${cwd}" -e - else - python3 scripts/make_tutorials.py -w "${cwd}" -e -k "${KERNEL_NAME}" - fi + python3 scripts/make_tutorials.py -w "${cwd}" -e else python3 scripts/make_tutorials.py -w "${cwd}" fi diff --git a/scripts/make_tutorials.py b/scripts/make_tutorials.py index 2eefad9229d..3d8a63fe945 100644 --- a/scripts/make_tutorials.py +++ b/scripts/make_tutorials.py @@ -123,7 +123,6 @@ def run_script( def gen_tutorials( repo_dir: str, exec_tutorials: bool, - kernel_name: Optional[str] = None, name: Optional[str] = None, smoke_test: bool = False, ) -> None: @@ -262,26 +261,16 @@ def gen_tutorials( default=False, help="Execute tutorials (instead of just converting).", ) - parser.add_argument( - "-k", - "--kernel_name", - required=False, - default=None, - type=str, - help="Name of IPython / Jupyter kernel to use for executing notebooks.", - ) parser.add_argument( "-n", "--name", help="Run a specific tutorial by name. The name should not include the " - ".ipynb extension. If the tutorial is on the ignore list, you still need " - "to specify --include-ignored.", + ".ipynb extension.", ) args = parser.parse_args() gen_tutorials( args.repo_dir, args.exec_tutorials, - args.kernel_name, smoke_test=args.smoke, name=args.name, ) diff --git a/scripts/publish_site.sh b/scripts/publish_site.sh index 2fb38930288..e532f21f008 100644 --- a/scripts/publish_site.sh +++ b/scripts/publish_site.sh @@ -9,12 +9,11 @@ set -e set -x usage() { - echo "Usage: $0 [-d] [-k KERNEL_NAME] [-v VERSION]" + echo "Usage: $0 [-d] [-v VERSION]" echo "" echo "Build and push updated Ax site. Will either update latest or bump stable version." echo "" echo " -d Use Docusaurus bot GitHub credentials. If not specified, will use default GitHub credentials." - echo " -k=KERNEL_NAME Kernel name to use for executing tutorials. Use Jupyter default if not set." echo " -v=VERSION Build site for new library version. If not specified, will update latest." echo "" exit 1 @@ -22,7 +21,6 @@ usage() { VERSION=false DOCUSAURUS_BOT=false -KERNEL_NAME=false while getopts 'dhk:v:' option; do case "${option}" in @@ -32,9 +30,6 @@ while getopts 'dhk:v:' option; do h) usage ;; - k) - KERNEL_NAME=${OPTARG} - ;; v) VERSION=${OPTARG} ;; @@ -130,7 +125,7 @@ if [[ $VERSION == false ]]; then # Build site cd .. || exit - ./scripts/make_docs.sh -b -t -k "${KERNEL_NAME}" + ./scripts/make_docs.sh -b -t rm -rf ../website/build/Ax/docs/next # don't need this # Move built site to gh-pages (but keep old versions.js) @@ -183,7 +178,7 @@ else # Build new version of site (this will be stable, default version) # Execute tutorials cd .. || exit - ./scripts/make_docs.sh -b -t -k "${KERNEL_NAME}" + ./scripts/make_docs.sh -b -t # Move built site to new folder (new-site) & carry over old versions # from existing gh-pages