Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 99820ae

Browse files
authored
Update README and CHANGELOG for v1 release (#344)
* update README for v1 release * update changelog * bump plotly min version in dev extra
1 parent 48c931e commit 99820ae

File tree

6 files changed

+36
-42
lines changed

6 files changed

+36
-42
lines changed

src/py/CHANGELOG.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Unreleased
1+
v1.0.0
22
- Add warning if using incompatible Plotly version
33

44
v1.0.0rc15

src/py/README.md

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,52 @@
66
</a>
77
</div>
88

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.
2911

3012
## Installation
3113

32-
To install the Kaleido release candidate:
14+
Kaleido can be installed from [PyPI](https://pypi.org/project/kaleido) using `pip`:
3315

3416
```bash
35-
$ pip install kaleido --upgrade --pre
17+
$ pip install kaleido --upgrade
3618
```
3719

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:
3921

4022
```bash
4123
$ kaleido_get_chrome
4224
```
4325

44-
or functions in Python:
26+
or function in Python:
4527

4628
```python
47-
4829
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")
5246
```
5347

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
5555

5656
```python
5757
import kaleido
@@ -78,7 +78,7 @@ async with kaleido.Kaleido(n=4, timeout=90) as k:
7878
# where `fig_objects` is a dict to be expanded to the fig, path, opts arguments.
7979
```
8080

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:
8282

8383
```python
8484
import asyncio
@@ -92,7 +92,7 @@ asyncio.run(
9292
)
9393
```
9494

95-
## PageGenerators
95+
### PageGenerators
9696

9797
The `page` argument takes a `kaleido.PageGenerator()` to customize versions.
9898
Normally, kaleido looks for an installed plotly as uses that version. You can pass
@@ -106,12 +106,3 @@ my_page = kaleido.PageGenerator(
106106
)
107107
```
108108

109-
## More info
110-
111-
There are plenty of doc strings in the source code.
112-
113-
[choreographer]: https://pypi.org/project/choreographer/
114-
[plotly]: https://plotly.com/
115-
[plotly-export]: https://plotly.com/python/static-image-export/
116-
[pypi]: https://pypi.org/
117-
[repo]: https://github.com/plotly/Kaleido

src/py/kaleido/_mocker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ def build_mocks():
264264
profiler = {}
265265
asyncio.run(_main(error_log, profiler))
266266
finally:
267+
# ruff: noqa: PLC0415
267268
from operator import itemgetter
268269

269270
for tab, tab_profile in profiler.items():

src/py/kaleido/_page_generator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def __init__(self, *, plotly=None, mathjax=None, others=None, force_cdn=False):
5959
plotly = (DEFAULT_PLOTLY, "utf-8")
6060
elif not plotly:
6161
try:
62+
# ruff: noqa: PLC0415
6263
import plotly as pltly # type: ignore [import-not-found]
6364

6465
plotly_path = (

src/py/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dev = [
4848
"async-timeout",
4949
"mypy>=1.14.1",
5050
"poethepoet>=0.30.0",
51-
"plotly[express]>=6.0.0",
51+
"plotly[express]>=6.1.1",
5252
"pytest-order>=1.3.0",
5353
"pandas>=2.0.3",
5454
]

src/py/tests/test_calc_fig.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313

1414
async def test_calc_fig():
15+
# ruff: noqa: PLC0415
1516
import plotly.express as px
1617

1718
with warnings.catch_warnings():

0 commit comments

Comments
 (0)