From 03d7d976df0cc40cb3ce379f11ad7b43bf521254 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 26 Jul 2025 21:34:35 +0200 Subject: [PATCH 1/2] Update README.md respecting the .pre-commit-config rules --- src/py/README.md | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/py/README.md b/src/py/README.md index 7b238078..e8384438 100644 --- a/src/py/README.md +++ b/src/py/README.md @@ -7,7 +7,8 @@ # Overview -Kaleido is a cross-platform Python library for generating static images (e.g. png, svg, pdf, etc.) for Plotly.js, to be used by Plotly.py. +Kaleido is a cross-platform Python library for generating static images +(e.g. png, svg, pdf, etc.) for Plotly.js, to be used by Plotly.py. ## Installation @@ -17,7 +18,9 @@ Kaleido can be installed from [PyPI](https://pypi.org/project/kaleido) using `pi $ pip install kaleido --upgrade ``` -As of version 1.0.0, Kaleido requires Chrome to be installed. If you already have Chrome on your system, Kaleido should find it; otherwise, you can install a compatible Chrome version using the `kaleido_get_chrome` command: +As of version 1.0.0, Kaleido requires Chrome to be installed. If you already have +Chrome on your system, Kaleido should find it; otherwise, you can install +a compatible Chrome version using the `kaleido_get_chrome` command: ```bash $ kaleido_get_chrome @@ -32,12 +35,18 @@ kaleido.get_chrome_sync() ## 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. - If using Kaleido v1 with Plotly.py, you will need to install Plotly.py v6.1.1 or later. -- 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 installation section above for instructions. -- If your code uses Kaleido directly: `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 installation section above for instructions. +- If your code uses Kaleido directly: `kaleido.scopes.plotly` has been removed in v1. +Kaleido v1 provides `write_fig` and `write_fig_sync` for exporting Plotly figures. + +```python from kaleido import write_fig_sync import plotly.graph_objects as go @@ -49,7 +58,9 @@ kaleido.write_fig_sync(fig, path="figure.png") Below are examples of how to use Kaleido directly in your Python program. -If you want to export images of Plotly charts, it's not necessary to call Kaleido directly; you can use functions in the Plotly library. [See the Plotly documentation for instructions.](https://plotly.com/python/static-image-export/) +If you want to export images of Plotly charts, it's not necessary to call +Kaleido directly; you can use functions in the Plotly library. +[See the Plotly documentation for instructions.](https://plotly.com/python/static-image-export/) ### Usage examples @@ -78,7 +89,8 @@ async with kaleido.Kaleido(n=4, timeout=90) as k: # where `fig_objects` is a dict to be expanded to the fig, path, opts arguments. ``` -There are shortcut functions which can be used to generate images without creating a `Kaleido()` object: +There are shortcut functions which can be used to generate images without +creating a `Kaleido()` object: ```python import asyncio @@ -98,6 +110,7 @@ The `page` argument takes a `kaleido.PageGenerator()` to customize versions. Normally, kaleido looks for an installed plotly as uses that version. You can pass `kaleido.PageGenerator(force_cdn=True)` to force use of a CDN version of plotly (the default if plotly is not installed). + ``` my_page = kaleido.PageGenerator( plotly="A fully qualified link to plotly (https:// or file://)", From ff43fc905b9e59745e71d90c96d7035f18029905 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 26 Jul 2025 21:37:24 +0200 Subject: [PATCH 2/2] checking the pre-commit rules on README --- src/py/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/py/README.md b/src/py/README.md index e8384438..899d6740 100644 --- a/src/py/README.md +++ b/src/py/README.md @@ -38,12 +38,14 @@ kaleido.get_chrome_sync() 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. -- If using Kaleido v1 with Plotly.py, you will need to install Plotly.py v6.1.1 or later. +- If using Kaleido v1 with Plotly.py, you will need to install +Plotly.py v6.1.1 or later. - 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 installation section above for instructions. -- If your code uses Kaleido directly: `kaleido.scopes.plotly` has been removed in v1. +- If your code uses Kaleido directly: `kaleido.scopes.plotly` has been +removed in v1. Kaleido v1 provides `write_fig` and `write_fig_sync` for exporting Plotly figures. ```python @@ -118,4 +120,3 @@ my_page = kaleido.PageGenerator( others=["a list of other script links to include"] ) ``` -