diff --git a/.circleci/config.yml b/.circleci/config.yml index 2a4a72ef062..0c50b2ec401 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -323,116 +323,6 @@ jobs: - store_artifacts: path: output.tgz - build-doc: - resource_class: xlarge - docker: - - image: cimg/python:3.9-browsers - - steps: - - add_ssh_keys: - fingerprints: - - "dc:5f:39:48:00:b4:72:34:e1:d2:c4:e1:1f:d1:e2:ce" #plotlydocbot - - - checkout - - browser-tools/install-chrome - - browser-tools/install-chromedriver - - run: - name: Install dependencies - command: | - cd doc - sudo apt-get update - sudo apt-get install rename - curl -LsSf https://astral.sh/uv/install.sh | sh - uv venv - source .venv/bin/activate - uv pip install -r requirements.txt - cd .. - if [ "${CIRCLE_BRANCH}" != "doc-prod" ]; then - uv pip uninstall plotly - uv pip install -e . - fi - - - run: - name: make html - command: | - cd doc - source .venv/bin/activate - echo ${mapbox_token} > python/.mapbox_token - make -kj8 || make -kj8 - curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/front-matter-ci.py > front-matter-ci.py - curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/check-or-enforce-order.py > check-or-enforce-order.py - python front-matter-ci.py build/html - python check-or-enforce-order.py build/html - if [ "${CIRCLE_BRANCH}" == "doc-prod" ]; then - cd build/html - git init - git config user.name plotlydocbot - git config user.email accounts@plot.ly - git add * - git commit -m "build of https://github.com/plotly/plotly.py/commit/${CIRCLE_SHA1}" - git push --force git@github.com:plotly/plotly.py-docs.git master:built - rm -rf .git - cd ../.. - cd build/ipynb - git init - git config user.name plotlydocbot - git config user.email accounts@plot.ly - git add * - git commit -m "build of https://github.com/plotly/plotly.py/commit/${CIRCLE_SHA1}" - git push --force git@github.com:plotly/plotly.py-docs.git master:built_ipynb - rm -rf .git - cd ../.. - fi - tar -zcf build/html.tgz build/html - rm -rf build/html build/ipynb - cd .. - - - run: - name: trigger doc build - command: | - if [ "${CIRCLE_BRANCH}" == "doc-prod" ]; then - git clone --depth=1 https://github.com/plotly/graphing-library-docs.git - cd graphing-library-docs - git config user.name plotlydocbot - git config user.email accounts@plot.ly - git commit --allow-empty -m "deploying https://github.com/plotly/plotly.py/commit/${CIRCLE_SHA1}" - git push - cd .. - rm -rf graphing-library-docs - fi - - - run: - name: make doc - command: | - cd doc - source .venv/bin/activate - # For the API doc, we need to use the local version of plotly - # since we are tweaking the source because of - # graph_objs/graph_objects - if [ "${CIRCLE_BRANCH}" == "doc-prod" ]; then - uv pip uninstall plotly - cd .. - uv pip install -e . - cd doc - cd apidoc - make html - cd _build/html - touch .nojekyll - git init - git config user.name plotlydocbot - git config user.email accounts@plot.ly - git add * - git add .nojekyll - git commit -m "build of https://github.com/plotly/plotly.py/commit/${CIRCLE_SHA1}" - git push --force git@github.com:plotly/plotly.py-docs.git master:gh-pages - rm -rf .git - cd ../.. - fi - - - store_artifacts: - path: doc/build - destination: doc/build - workflows: code_formatting: jobs: @@ -476,4 +366,3 @@ workflows: python_version: - "3.12" - python_311_percy - - build-doc diff --git a/.github/workflows/build-doc.yml b/.github/workflows/build-doc.yml new file mode 100644 index 00000000000..8e994093cfd --- /dev/null +++ b/.github/workflows/build-doc.yml @@ -0,0 +1,160 @@ +name: Build Documentation + +on: + push: + branches: + - doc-prod + pull_request: + +jobs: + build-doc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + python-version: "3.9" + + - name: Install system dependencies + run: sudo apt-get update && sudo apt-get install rename + + - name: Install doc dependencies + run: | + cd doc + uv venv + source .venv/bin/activate + uv pip install -r requirements.txt + + - name: Install plotly in editable mode + if: github.ref_name != 'doc-prod' + run: | + cd doc + source .venv/bin/activate + uv pip uninstall plotly + uv pip install -e .. + + - name: List installed packages + run: | + cd doc + source .venv/bin/activate + uv pip list + + - name: Build HTML docs + env: + MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }} + run: | + cd doc + source .venv/bin/activate + echo "${MAPBOX_TOKEN}" > python/.mapbox_token + make -kj8 || make -kj8 + curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/front-matter-ci.py > front-matter-ci.py + curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/check-or-enforce-order.py > check-or-enforce-order.py + python front-matter-ci.py build/html + python check-or-enforce-order.py build/html + + - name: Upload HTML docs artifact + uses: actions/upload-artifact@v4 + with: + name: doc-html + path: doc/build/html/ + + - name: Create GitHub App token + if: github.ref_name == 'doc-prod' && github.event_name == 'push' + uses: actions/create-github-app-token@v2 + id: app-token + with: + app-id: ${{ vars.GRAPHING_LIBRARIES_CI_GHAPP_ID }} + private-key: ${{ secrets.GRAPHING_LIBRARIES_CI_GHAPP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: plotly.py-docs,graphing-library-docs + + - name: Checkout plotly.py-docs (built) + if: github.ref_name == 'doc-prod' && github.event_name == 'push' + uses: actions/checkout@v6 + with: + repository: plotly/plotly.py-docs + ref: built + token: ${{ steps.app-token.outputs.token }} + path: plotly.py-docs-html + + - name: Deploy HTML docs + if: github.ref_name == 'doc-prod' && github.event_name == 'push' + run: | + git config --global user.name plotlydocbot + git config --global user.email accounts@plot.ly + rm -rf plotly.py-docs-html/* + cp -r doc/build/html/* plotly.py-docs-html/ + cd plotly.py-docs-html + git add . + git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit" + git push --force + + - name: Checkout plotly.py-docs (built_ipynb) + if: github.ref_name == 'doc-prod' && github.event_name == 'push' + uses: actions/checkout@v6 + with: + repository: plotly/plotly.py-docs + ref: built_ipynb + token: ${{ steps.app-token.outputs.token }} + path: plotly.py-docs-ipynb + + - name: Deploy notebooks + if: github.ref_name == 'doc-prod' && github.event_name == 'push' + run: | + rm -rf plotly.py-docs-ipynb/* + cp -r doc/build/ipynb/* plotly.py-docs-ipynb/ + cd plotly.py-docs-ipynb + git add . + git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit" + git push --force + + - name: Checkout graphing-library-docs + if: github.ref_name == 'doc-prod' && github.event_name == 'push' + uses: actions/checkout@v6 + with: + repository: plotly/graphing-library-docs + ref: master + token: ${{ steps.app-token.outputs.token }} + path: graphing-library-docs + + - name: Trigger downstream doc build + if: github.ref_name == 'doc-prod' && github.event_name == 'push' + run: | + cd graphing-library-docs + git commit --allow-empty -m "deploying https://github.com/plotly/plotly.py/commit/${{ github.sha }}" + git push + + - name: Build API docs + if: github.ref_name == 'doc-prod' && github.event_name == 'push' + run: | + cd doc + source .venv/bin/activate + # For the API doc, we need to use the local version of plotly + # since we are tweaking the source because of + # graph_objs/graph_objects + uv pip uninstall plotly + uv pip install -e .. + cd apidoc + make html + + - name: Checkout plotly.py-docs (gh-pages) + if: github.ref_name == 'doc-prod' && github.event_name == 'push' + uses: actions/checkout@v6 + with: + repository: plotly/plotly.py-docs + ref: gh-pages + token: ${{ steps.app-token.outputs.token }} + path: plotly.py-docs-api + + - name: Deploy API docs + if: github.ref_name == 'doc-prod' && github.event_name == 'push' + run: | + rm -rf plotly.py-docs-api/* + cp -r doc/apidoc/_build/html/* plotly.py-docs-api/ + touch plotly.py-docs-api/.nojekyll + cd plotly.py-docs-api + git add . + git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit" + git push --force diff --git a/doc/requirements.txt b/doc/requirements.txt index 8f8a77ef3e3..ccd83633597 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -33,6 +33,7 @@ requests scikit-image==0.20.0 scikit-learn scipy==1.9.1 +setuptools<=81 shapely==2.0.5 sphinx==3.5.4 sphinx_bootstrap_theme