From 03fad26005a9c2a450390aaf11836999a9fd511d Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 24 May 2025 09:56:30 +0400 Subject: [PATCH 01/10] update markdownlint --- .gitignore | 3 +++ src/py/.pre-commit-config.yaml | 22 ++++++++++++++-------- src/py/pyproject.toml | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 48dbaac5..66aa7eec 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ src/py/integration_tests/report* # avoid ignore .gitkeep !src/py/integration_tests/renders/.gitkeep node_modules/ + +# IDE +.idea diff --git a/src/py/.pre-commit-config.yaml b/src/py/.pre-commit-config.yaml index 2a672b12..ea43db43 100644 --- a/src/py/.pre-commit-config.yaml +++ b/src/py/.pre-commit-config.yaml @@ -6,7 +6,7 @@ exclude: | (?x)( src/py/site/.*| src/py/integration_tests/mocks/.*| - src/py/intergation_tests/renders/.*| + src/py/integration_tests/renders/.*| src/js/.*| \.js$ ) @@ -79,15 +79,21 @@ repos: rev: v1.28.2 hooks: - id: typos - - repo: https://github.com/markdownlint/markdownlint - rev: v0.13.0 + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.45.0 hooks: - id: markdownlint - name: Markdownlint - description: Run markdownlint on your Markdown files - entry: mdl --rules ~MD026 --style .markdown.rb - language: ruby - files: \.(md|mdown|markdown)$ + # args: [ "--ignore", "book/**/*.md", "--ignore", "opinion.md" ] + # too old: + # - repo: https://github.com/markdownlint/markdownlint + # rev: v0.13.0 + # hooks: + # - id: markdownlint + # name: Markdownlint + # description: Run markdownlint on your Markdown files + # entry: mdl --rules ~MD026 --style .markdown.rb + # language: ruby + # files: \.(md|mdown|markdown)$ - repo: https://github.com/Yelp/detect-secrets rev: v1.5.0 hooks: diff --git a/src/py/pyproject.toml b/src/py/pyproject.toml index 79b2733d..e9ac32ca 100644 --- a/src/py/pyproject.toml +++ b/src/py/pyproject.toml @@ -14,7 +14,7 @@ kaleido = ['vendor/**'] [project] name = "kaleido" description = "Plotly graph export library" -license = {file = "LICENSE.md"} +license = {file = "LICENSE"} readme = "README.md" requires-python = ">=3.8" dynamic = ["version"] From 08bc26c460fe950e726553478c7341cd0da196a6 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 24 May 2025 10:02:46 +0400 Subject: [PATCH 02/10] pre-commit workflow --- .github/workflows/pre-commit.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..4c6e59cb --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,32 @@ +# Workflow: pre-commit +# Purpose: This workflow runs pre-commit checks on the +# codebase to ensure code quality and consistency. +# It automatically validates code style, formatting, and other +# checks defined in the pre-commit configuration. +name: pre-commit + +# Trigger: This workflow runs on every push to the repository +on: + push + +# Permissions: Only read access to repository contents is needed +permissions: + contents: read + +jobs: + # Job: pre-commit + # Purpose: Executes the pre-commit checks against the codebase + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout [${{ github.repository }}] + uses: actions/checkout@v4 + + - name: Install Node 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + + - uses: pre-commit/action@v3.0.1 + with: + extra_args: '--verbose --all-files' From f738698dc52f54a32894853936a47521d92cc90c Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 24 May 2025 10:08:35 +0400 Subject: [PATCH 03/10] pre-commit workflow --- .github/workflows/pre-commit.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 4c6e59cb..39e48fe7 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,13 +1,8 @@ -# Workflow: pre-commit -# Purpose: This workflow runs pre-commit checks on the -# codebase to ensure code quality and consistency. -# It automatically validates code style, formatting, and other -# checks defined in the pre-commit configuration. name: pre-commit # Trigger: This workflow runs on every push to the repository on: - push + push: # Permissions: Only read access to repository contents is needed permissions: @@ -29,4 +24,4 @@ jobs: - uses: pre-commit/action@v3.0.1 with: - extra_args: '--verbose --all-files' + extra_args: '--all-files --config src/py/.pre-commit-config.yaml' From bb9ef5cb5356f8c8ca298e5fc41aa54773f6f691 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 24 May 2025 10:13:04 +0400 Subject: [PATCH 04/10] License is not an md file --- src/py/{LICENSE.md => LICENSE} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/py/{LICENSE.md => LICENSE} (100%) diff --git a/src/py/LICENSE.md b/src/py/LICENSE similarity index 100% rename from src/py/LICENSE.md rename to src/py/LICENSE From 6f03b2da9f5c80947504632bd2c1c0b669fc4055 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 24 May 2025 17:29:15 +0400 Subject: [PATCH 05/10] checking pre-commit.yml --- .github/workflows/pre-commit.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 39e48fe7..ff91134a 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -22,6 +22,7 @@ jobs: with: node-version: '20' - - uses: pre-commit/action@v3.0.1 - with: - extra_args: '--all-files --config src/py/.pre-commit-config.yaml' +# Let's activate this later, more corrections are needed +# - uses: pre-commit/action@v3.0.1 +# with: +# extra_args: '--all-files --config src/py/.pre-commit-config.yaml' From 8c77289af74e16a48c6909747ea7057e9fa9ea79 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 24 May 2025 17:43:12 +0400 Subject: [PATCH 06/10] checking pre-commit.yml --- src/py/.pre-commit-config.yaml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/py/.pre-commit-config.yaml b/src/py/.pre-commit-config.yaml index ea43db43..c0686a7b 100644 --- a/src/py/.pre-commit-config.yaml +++ b/src/py/.pre-commit-config.yaml @@ -79,21 +79,15 @@ repos: rev: v1.28.2 hooks: - id: typos - - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.45.0 + - repo: https://github.com/markdownlint/markdownlint + rev: v0.13.0 hooks: - id: markdownlint - # args: [ "--ignore", "book/**/*.md", "--ignore", "opinion.md" ] - # too old: - # - repo: https://github.com/markdownlint/markdownlint - # rev: v0.13.0 - # hooks: - # - id: markdownlint - # name: Markdownlint - # description: Run markdownlint on your Markdown files - # entry: mdl --rules ~MD026 --style .markdown.rb - # language: ruby - # files: \.(md|mdown|markdown)$ + name: Markdownlint + description: Run markdownlint on your Markdown files + entry: mdl --rules ~MD026 --style .markdown.rb + language: ruby + files: \.(md|mdown|markdown)$ - repo: https://github.com/Yelp/detect-secrets rev: v1.5.0 hooks: From fdfffed64f4f8fad85b78e39e2af89018ee11a0d Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 24 May 2025 17:46:10 +0400 Subject: [PATCH 07/10] checking pre-commit.yml --- .github/workflows/pre-commit.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index ff91134a..39e48fe7 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -22,7 +22,6 @@ jobs: with: node-version: '20' -# Let's activate this later, more corrections are needed -# - uses: pre-commit/action@v3.0.1 -# with: -# extra_args: '--all-files --config src/py/.pre-commit-config.yaml' + - uses: pre-commit/action@v3.0.1 + with: + extra_args: '--all-files --config src/py/.pre-commit-config.yaml' From 6f44caf5b0c8f402ec17027e367923f814ea709e Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 24 May 2025 17:53:18 +0400 Subject: [PATCH 08/10] comments in markdown.rb --- .markdown.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.markdown.rb b/.markdown.rb index 338ef020..aba50030 100644 --- a/.markdown.rb +++ b/.markdown.rb @@ -1,3 +1,8 @@ +# MD026: Trailing punctuation in header - Disallows headers ending with specified punctuation characters rule 'MD026', :punctuation => '.,;:!' + +# MD013: Line length - Enforces a maximum line length, but ignores code blocks rule 'MD013', :ignore_code_blocks => true + +# MD033: Inline HTML - This rule is excluded, allowing inline HTML in Markdown files exclude_rule 'MD033' From fa0448d29166edbcf8310e97155309c162530b30 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 24 May 2025 17:56:38 +0400 Subject: [PATCH 09/10] shellcheck complaining --- .github/workflows/publish_testpypi.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish_testpypi.yml b/.github/workflows/publish_testpypi.yml index c690f34a..3890e142 100644 --- a/.github/workflows/publish_testpypi.yml +++ b/.github/workflows/publish_testpypi.yml @@ -34,11 +34,15 @@ jobs: # don't modify sync file! messes up version! - run: uv sync --all-extras --frozen # does order matter? - run: uv build + #- name: Reinstall from wheel + # run: > + # uv pip install dist/kaleido-$(uv + # run --no-sync --with setuptools-git-versioning + # setuptools-git-versioning)-py3-none-any.whl - name: Reinstall from wheel - run: > - uv pip install dist/kaleido-$(uv - run --no-sync --with setuptools-git-versioning - setuptools-git-versioning)-py3-none-any.whl + run: | + WHEEL_PATH=$(ls dist/kaleido-*-py3-none-any.whl) + uv pip install "$WHEEL_PATH" - run: uv run --no-sync kaleido_get_chrome -v # --i ${{ matrix.chrome_v }} - name: Diagnose run: uv run --no-sync choreo_diagnose --no-run From d8cd2e97c018458b86cd8ea5cd1fcfb5e14008db Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 24 May 2025 17:59:57 +0400 Subject: [PATCH 10/10] fixing lines too long --- src/py/README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/py/README.md b/src/py/README.md index 6f28da29..a672a292 100644 --- a/src/py/README.md +++ b/src/py/README.md @@ -8,14 +8,24 @@ # Pre-Launch Kaleido v1.0.0 -Kaleido allows you to convert plotly figures to images. Kaleido v1 is currently available as a release candidate. +Kaleido allows you to convert plotly figures to images. +Kaleido v1 is currently available as a release candidate. ## Migrating from v0 to v1 -Kaleido v1 introduces a new API. If you're currently using v0, you'll need to make changes to your code and environment where you are running Kaleido. +Kaleido v1 introduces a new API. If you're currently using v0, +you'll need to make changes to your code and environment +where you are running Kaleido. + +- Chrome is no longer included with Kaleido. + Kaleido will look for an existing Chrome installation, + but also provides commands for installing Chrome. + If you don't have Chrome, you'll need to install it. + See the following installation section for more details. +- `kaleido.scopes.plotly` has been removed in v1. + Kaleido v1 provides `write_fig` and `write_fig_sync` + for exporting Plotly figures. -- Chrome is no longer included with Kaleido. Kaleido will look for an existing Chrome installation, but also provides commands for installing Chrome. If you don't have Chrome, you'll need to install it. See the following installation section for more details. -- `kaleido.scopes.plotly` has been removed in v1. Kaleido v1 provides `write_fig` and `write_fig_sync` for exporting Plotly figures. ``` from kaleido import write_fig_sync import plotly.graph_objects as go @@ -23,6 +33,7 @@ Kaleido v1 introduces a new API. If you're currently using v0, you'll need to ma fig = go.Figure(data=[go.Scatter(y=[1, 3, 2])]) kaleido.write_fig_sync(fig, path="figure.png") ``` + See the Quickstart section below for more details on usage for v1. Note: Kaleido v1 works with Plotly v6.1.0 and later.