diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 2a4a72ef062..00000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,479 +0,0 @@ -version: 2.1 - -orbs: - browser-tools: circleci/browser-tools@1.4.8 - -executors: - docker-container: - parameters: - python_version: - description: "python version" - default: "3.12" - type: string - docker: - - image: cimg/python:<>-browsers - -commands: - test_core: - steps: - - checkout - - browser-tools/install-chrome - - browser-tools/install-chromedriver - - run: - name: Install dependencies - command: | - curl -LsSf https://astral.sh/uv/install.sh | sh - uv venv - source .venv/bin/activate - uv lock --check - uv sync --extra dev_core - - run: - name: List installed packages and python version - command: | - source .venv/bin/activate - uv pip list - python --version - - run: - name: Test core - command: | - source .venv/bin/activate - python -m pytest tests/test_core - no_output_timeout: 20m - - test_optional: - parameters: - pandas_version: - type: string - numpy_version: - type: string - steps: - - checkout - - browser-tools/install-chrome - - browser-tools/install-chromedriver - - run: - name: Install dependencies - command: | - curl -LsSf https://astral.sh/uv/install.sh | sh - uv venv - source .venv/bin/activate - uv sync --extra dev_optional - - - when: - condition: - not: - equal: - - <> - - "" - steps: - - run: - name: Install pandas - command: | - source .venv/bin/activate - uv pip install pandas==<> numpy==<> - - - run: - name: Test core - command: | - source .venv/bin/activate - python -m pytest tests/test_core - no_output_timeout: 20m - - run: - name: List installed packages and python version - command: | - source .venv/bin/activate - uv pip list - python --version - - run: - name: Test optional - command: | - source .venv/bin/activate - python -m pytest tests/test_optional - no_output_timeout: 40m - - run: - name: Test utils - command: | - source .venv/bin/activate - python -m pytest tests/test_plotly_utils/ - no_output_timeout: 20m - - run: - name: Test io - command: | - source .venv/bin/activate - python -m pytest tests/test_io - no_output_timeout: 20m - - run: - name: Test dependencies not imported - command: | - source .venv/bin/activate - python -m pytest -x test_init/test_dependencies_not_imported.py - - run: - name: Test lazy imports - command: | - source .venv/bin/activate - python -m pytest -x test_init/test_lazy_imports.py - - test_io_kaleido_v0: - steps: - - checkout - - browser-tools/install-chrome - - browser-tools/install-chromedriver - - run: - name: Install dependencies - command: | - curl -LsSf https://astral.sh/uv/install.sh | sh - uv venv - source .venv/bin/activate - uv sync --extra dev_optional - # Install Kaleido v0 instead of the v1 specified in requirements_optional.txt - uv pip uninstall kaleido - uv pip install kaleido==0.2.1 - - run: - name: List installed packages and python version - command: | - source .venv/bin/activate - uv pip list - python --version - - run: - name: Test plotly.io image output with Kaleido v0 - command: | - source .venv/bin/activate - python -m pytest tests/test_optional/test_kaleido - no_output_timeout: 20m - -jobs: - check-code-formatting: - docker: - - image: cimg/python:3.12 - - steps: - - checkout - - run: - name: Install ruff - command: | - uv venv - source .venv/bin/activate - uv sync --extra dev_core - - run: - name: Check handwritten code with ruff - command: | - source .venv/bin/activate - ruff format --check . - - test_core_py: - parameters: - python_version: - default: "3.12" - type: string - executor: - name: docker-container - python_version: <> - steps: - - test_core - - test_optional_py: - parameters: - python_version: - default: "3.12" - type: string - pandas_version: - default: "" - type: string - numpy_version: - default: "" - type: string - executor: - name: docker-container - python_version: <> - steps: - - test_optional: - pandas_version: <> - numpy_version: <> - - test_kaleido_v0: - parameters: - python_version: - default: "3.12" - type: string - executor: - name: docker-container - python_version: <> - steps: - - test_io_kaleido_v0 - - # Percy - python_311_percy: - docker: - - image: cimg/python:3.11-browsers - environment: - PERCY_ENABLED: True - PERCY_PROJECT: plotly/plotly.py - resource_class: large - - steps: - - checkout - - browser-tools/install-chrome - - browser-tools/install-chromedriver - - run: - name: Inject Percy Environment variables - command: | - echo 'export PERCY_TOKEN="$PERCY_PYTHON_TOKEN_V0"' >> $BASH_ENV - - run: - name: Install requirements - command: | - curl -LsSf https://astral.sh/uv/install.sh | sh - uv venv - source .venv/bin/activate - uv sync --extra dev_optional - - - run: - name: Build HTML figures (Pandas 2) - command: | - source .venv/bin/activate - python tests/percy/plotly-express.py - - run: - name: Build HTML figures (Pandas 1) and compare - command: | - source .venv/bin/activate - mkdir tests/percy/pandas2 - mv tests/percy/*.html tests/percy/pandas2/ - uv pip install pandas==1.5.3 numpy==1.26.4 - python tests/percy/plotly-express.py - python tests/percy/compare-pandas.py - rm -rf tests/percy/pandas2 - - run: - name: List installed packages and python version - command: | - source .venv/bin/activate - uv pip list - python --version - - run: - name: Run percy snapshots - command: | - npm i @percy/cli - npx percy snapshot -c tests/percy/snapshots.yml tests/percy/ - rm tests/percy/*.html - - plotlyjs_dev_build: - docker: - - image: cimg/python:3.12-node - environment: - LANG: en_US.UTF-8 - resource_class: large - - steps: - - checkout - - run: - name: Install dependencies - command: | - curl -LsSf https://astral.sh/uv/install.sh | sh - uv venv - source .venv/bin/activate - uv sync --extra dev_optional - - run: - name: Update plotly.js to dev - command: | - source .venv/bin/activate - python commands.py updateplotlyjsdev - - run: - name: Test core - command: | - source .venv/bin/activate - locale - pytest -k 'not nodev' tests/test_core - no_output_timeout: 20m - - run: - name: Build source distribution packages - command: | - source .venv/bin/activate - uv sync --extra dev_build - python -m build --sdist --wheel -o dist - when: always - - store_artifacts: - path: dist/ - - full_build: - docker: - - image: cimg/python:3.12-node - environment: - LANG: en_US.UTF-8 - resource_class: large - - steps: - - checkout - - run: - name: PyPI Build - command: | - curl -LsSf https://astral.sh/uv/install.sh | sh - uv venv - source .venv/bin/activate - uv sync --extra dev_build - cd js - npm ci - npm run build - cd .. - python -m build --sdist --wheel -o dist - cp -R dist output - git status - - - run: - name: Zip output - command: | - tar czf output.tgz output - - - 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: - - check-code-formatting - dev_build: - jobs: - - plotlyjs_dev_build - release_build: - jobs: - - full_build - build: - jobs: - - test_core_py: - matrix: - parameters: - python_version: - - "3.8" - - "3.9" - - "3.10" - - "3.11" - - "3.12" - - "3.13" - - test_optional_py: - matrix: - parameters: - python_version: - - "3.8" - - "3.9" - - "3.10" - - "3.11" - - "3.12" - - "3.13" - - test_optional_py: - name: "test_optional_py-3.9_pandas-1.2.4" - python_version: "3.9" - pandas_version: "1.2.4" - numpy_version: "1.26.4" - - test_kaleido_v0: - matrix: - parameters: - python_version: - - "3.12" - - python_311_percy - - build-doc diff --git a/.github/workflows/ci-builds.yml b/.github/workflows/ci-builds.yml new file mode 100644 index 00000000000..e05b76bf79a --- /dev/null +++ b/.github/workflows/ci-builds.yml @@ -0,0 +1,82 @@ +name: CI Builds + +on: + push: + pull_request: + types: [opened, reopened] + +jobs: + plotlyjs-dev-build: + name: plotlyjs_dev_build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: "22" + - name: Install dependencies + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv sync --extra dev_optional + - name: Update plotly.js to dev + run: | + source .venv/bin/activate + python commands.py updateplotlyjsdev + - name: Test core (excluding nodev) + run: | + source .venv/bin/activate + pytest -k 'not nodev' tests/test_core + - name: Build source distribution packages + run: | + source .venv/bin/activate + uv sync --extra dev_build + python -m build --sdist --wheel -o dist + - name: Upload dist artifacts + uses: actions/upload-artifact@v4 + with: + name: plotlyjs-dev-build-dist + path: dist/ + if-no-files-found: error + + full-build: + name: full_build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: "22" + - name: PyPI Build + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv sync --extra dev_build + cd js + npm ci + npm run build + cd .. + python -m build --sdist --wheel -o dist + cp -R dist output + git status + - name: Zip output + run: | + tar czf output.tgz output + - name: Upload output artifact + uses: actions/upload-artifact@v4 + with: + name: full-build-output + path: output.tgz + if-no-files-found: error diff --git a/.github/workflows/ci-format.yml b/.github/workflows/ci-format.yml new file mode 100644 index 00000000000..534853fe5ab --- /dev/null +++ b/.github/workflows/ci-format.yml @@ -0,0 +1,27 @@ +name: CI Formatting + +on: + push: + pull_request: + types: [opened, reopened] + +jobs: + check-code-formatting: + name: check-code-formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install dependencies + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv sync --extra dev_core + - name: Check handwritten code with ruff + run: | + source .venv/bin/activate + ruff format --check . diff --git a/.github/workflows/ci-percy.yml b/.github/workflows/ci-percy.yml new file mode 100644 index 00000000000..9736fd4d4c1 --- /dev/null +++ b/.github/workflows/ci-percy.yml @@ -0,0 +1,59 @@ +name: CI Percy + +on: + push: + pull_request: + types: [opened, reopened] + workflow_dispatch: + +jobs: + python-311-percy: + name: python_311_percy + runs-on: ubuntu-latest + env: + PERCY_ENABLED: "True" + PERCY_PROJECT: plotly/plotly.py + PERCY_TOKEN: ${{ secrets.PERCY_PYTHON_TOKEN_V0 }} + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: "22" + - name: Set up Chrome + uses: browser-actions/setup-chrome@v2.1.1 + with: + install-chromedriver: true + - name: Install requirements + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv sync --extra dev_optional + - name: Build HTML figures (Pandas 2) + run: | + source .venv/bin/activate + python tests/percy/plotly-express.py + - name: Build HTML figures (Pandas 1) and compare + run: | + source .venv/bin/activate + mkdir tests/percy/pandas2 + mv tests/percy/*.html tests/percy/pandas2/ + uv pip install pandas==1.5.3 numpy==1.26.4 + python tests/percy/plotly-express.py + python tests/percy/compare-pandas.py + rm -rf tests/percy/pandas2 + - name: List installed packages and python version + run: | + source .venv/bin/activate + uv pip list + python --version + - name: Run percy snapshots + run: | + npm i @percy/cli + npx percy snapshot -c tests/percy/snapshots.yml tests/percy/ + rm tests/percy/*.html diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml new file mode 100644 index 00000000000..a7b41b6152a --- /dev/null +++ b/.github/workflows/ci-tests.yml @@ -0,0 +1,188 @@ +name: CI Tests + +on: + push: + pull_request: + types: [opened, reopened] + +jobs: + test-core: + name: test_core_py (${{ matrix.python-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv lock --check + uv sync --extra dev_core + - name: List installed packages and python version + run: | + source .venv/bin/activate + uv pip list + python --version + - name: Test core + run: | + source .venv/bin/activate + python -m pytest tests/test_core + + test-optional: + name: test_optional_py (${{ matrix.python-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Set up Chrome + id: setup-chrome + uses: browser-actions/setup-chrome@v2.1.1 + with: + install-chromedriver: true + - name: Print installed Chrome and Chromedriver paths and versions + run: | + echo "Chrome path: ${{ steps.setup-chrome.outputs.chrome-path }}" + echo "Chrome version: ${{ steps.setup-chrome.outputs.chrome-path }} --version" + echo "Chromedriver path: ${{ steps.setup-chrome.outputs.chromedriver-path }}" + echo "Chromedriver version: ${{ steps.setup-chrome.outputs.chromedriver-path }} --version" + echo "chrome --version: $(chrome --version)" + - name: Set BROWSER env var + run: | + echo "BROWSER=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV + - name: Print Python webbrowser standard browser list + run: | + python -c "import webbrowser; webbrowser.register_standard_browsers(); print(webbrowser._tryorder)" + - name: Check whether we can access Chrome from Python + run: | + python -c "import webbrowser; webbrowser.get()" + - name: Install dependencies + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv sync --extra dev_optional + - name: Test core + run: | + source .venv/bin/activate + python -m pytest tests/test_core + - name: List installed packages and python version + run: | + source .venv/bin/activate + uv pip list + python --version + - name: Test optional + run: | + source .venv/bin/activate + python -m pytest tests/test_optional + - name: Test utils + run: | + source .venv/bin/activate + python -m pytest tests/test_plotly_utils/ + - name: Test io + run: | + source .venv/bin/activate + python -m pytest tests/test_io + - name: Test dependencies not imported + run: | + source .venv/bin/activate + python -m pytest -x test_init/test_dependencies_not_imported.py + - name: Test lazy imports + run: | + source .venv/bin/activate + python -m pytest -x test_init/test_lazy_imports.py + + test-optional-legacy-pandas: + name: test_optional_py-3.9_pandas-1.2.4 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.9" + - name: Set up Chrome + uses: browser-actions/setup-chrome@v2.1.1 + with: + install-chromedriver: true + - name: Install dependencies + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv sync --extra dev_optional + uv pip install pandas==1.2.4 numpy==1.26.4 + - name: Test core + run: | + source .venv/bin/activate + python -m pytest tests/test_core + - name: List installed packages and python version + run: | + source .venv/bin/activate + uv pip list + python --version + - name: Test optional + run: | + source .venv/bin/activate + python -m pytest tests/test_optional + - name: Test utils + run: | + source .venv/bin/activate + python -m pytest tests/test_plotly_utils/ + - name: Test io + run: | + source .venv/bin/activate + python -m pytest tests/test_io + - name: Test dependencies not imported + run: | + source .venv/bin/activate + python -m pytest -x test_init/test_dependencies_not_imported.py + - name: Test lazy imports + run: | + source .venv/bin/activate + python -m pytest -x test_init/test_lazy_imports.py + + test-kaleido-v0: + name: test_kaleido_v0 (3.12) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Set up Chrome + uses: browser-actions/setup-chrome@v2.1.1 + with: + install-chromedriver: true + - name: Install dependencies + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv sync --extra dev_optional + uv pip uninstall kaleido + uv pip install kaleido==0.2.1 + - name: List installed packages and python version + run: | + source .venv/bin/activate + uv pip list + python --version + - name: Test plotly.io image output with Kaleido v0 + run: | + source .venv/bin/activate + python -m pytest tests/test_optional/test_kaleido