You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/py/README.md
+31-40Lines changed: 31 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,52 +6,52 @@
6
6
</a>
7
7
</div>
8
8
9
-
# Pre-Launch Kaleido v1.0.0
10
-
11
-
Kaleido allows you to convert plotly figures to images. Kaleido v1 is currently available as a release candidate.
12
-
13
-
## Migrating from v0 to v1
14
-
15
-
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.
16
-
17
-
- 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.
18
-
-`kaleido.scopes.plotly` has been removed in v1. Kaleido v1 provides `write_fig` and `write_fig_sync` for exporting Plotly figures.
19
-
```
20
-
from kaleido import write_fig_sync
21
-
import plotly.graph_objects as go
22
-
23
-
fig = go.Figure(data=[go.Scatter(y=[1, 3, 2])])
24
-
kaleido.write_fig_sync(fig, path="figure.png")
25
-
```
26
-
See the Quickstart section below for more details on usage for v1.
27
-
28
-
Note: Kaleido v1 works with Plotly v6.1.0 and later.
9
+
# Overview
10
+
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.
29
11
30
12
## Installation
31
13
32
-
To install the Kaleido release candidate:
14
+
Kaleido can be installed from [PyPI](https://pypi.org/project/kaleido) using `pip`:
33
15
34
16
```bash
35
-
$ pip install kaleido --upgrade --pre
17
+
$ pip install kaleido --upgrade
36
18
```
37
19
38
-
To install Chrome, we recommend using Kaleido's CLI command:
20
+
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:
39
21
40
22
```bash
41
23
$ kaleido_get_chrome
42
24
```
43
25
44
-
or functions in Python:
26
+
or function in Python:
45
27
46
28
```python
47
-
48
29
import kaleido
49
-
await kaleido.get_chrome()
50
-
# or
51
-
# kaleido.get_chrome_sync()
30
+
kaleido.get_chrome_sync()
31
+
```
32
+
33
+
## Migrating from v0 to v1
34
+
35
+
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.
36
+
37
+
- If using Kaleido v1 with Plotly.py, you will need to install Plotly.py v6.1.1 or later.
38
+
- 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.
39
+
- 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.
40
+
```
41
+
from kaleido import write_fig_sync
42
+
import plotly.graph_objects as go
43
+
44
+
fig = go.Figure(data=[go.Scatter(y=[1, 3, 2])])
45
+
kaleido.write_fig_sync(fig, path="figure.png")
52
46
```
53
47
54
-
## Quickstart
48
+
## Development guide
49
+
50
+
Below are examples of how to use Kaleido directly in your Python program.
51
+
52
+
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/)
53
+
54
+
### Usage examples
55
55
56
56
```python
57
57
import kaleido
@@ -78,7 +78,7 @@ async with kaleido.Kaleido(n=4, timeout=90) as k:
78
78
# where `fig_objects` is a dict to be expanded to the fig, path, opts arguments.
79
79
```
80
80
81
-
There are shortcut functions if just want dont want to create a `Kaleido()`.
81
+
There are shortcut functions which can be used to generate images without creating a `Kaleido()` object:
82
82
83
83
```python
84
84
import asyncio
@@ -92,7 +92,7 @@ asyncio.run(
92
92
)
93
93
```
94
94
95
-
## PageGenerators
95
+
###PageGenerators
96
96
97
97
The `page` argument takes a `kaleido.PageGenerator()` to customize versions.
98
98
Normally, kaleido looks for an installed plotly as uses that version. You can pass
0 commit comments