Skip to content

Commit

Permalink
fix: add README and LICENSE to package
Browse files Browse the repository at this point in the history
  • Loading branch information
gvwilson committed Nov 15, 2024
1 parent 02f06dc commit 2459633
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 6 deletions.
21 changes: 21 additions & 0 deletions src/py/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Plotly, Inc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
58 changes: 58 additions & 0 deletions src/py/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Kaleido

Kaleido is a cross-platform library for generating static images for [Plotly][plotly]'s visualization library.
After installing it, you can use `fig.write_image("filename.png")` to save a plot to a file.

<div align="center">
<a href="https://dash.plotly.com/project-maintenance">
<img src="https://dash.plotly.com/assets/images/maintained-by-plotly.png" width="400px" alt="Maintained by Plotly">
</a>
</div>

## How It Works

The original version of kaleido included a custom build of the Chrome web browser,
which made it very large (hundreds of megabytes) and proved very difficult to maintain.
In contrast,
this version depends on [choreographer][choreographer],
a lightweight library that enables remote control of browsers from Python.
When you ask kaleido to create an image,
it uses choreographer to run a headless instance of Chrome to render and save your figure.
Please see choreographer's documentation for details.

> The new version of kaleido is a work on progress; we would be grateful for help testing it and improving it.
> If you find a bug, please report it in [our GitHub repository][repo],
> and please include a minimal reproducible example if you can.
>
> It would also be very helpful to run the script `src/py/tests/manual.py`
> and attach its zipped output to your bug report.
> This will give us detailed information about the precise versions of software you are using
> and the platform you are running on,
> which will help us track down problems more quickly.
## Installation

You can install kaleido from [PyPI][pypi] using pip:

```
$ pip install kaleido
```

## Use

Versions 4.9 and above of the Plotly Python library will automatically use kaleido for static image export when kaleido is installed.
For example:

```python
import plotly.express as px
fig = px.scatter(px.data.iris(), x="sepal_length", y="sepal_width", color="species")
fig.write_image("figure.png", engine="kaleido")
```

See the [Plotly static image export documentation][plotly-export] for more information.

[choreographer]: https://pypi.org/project/choreographer/
[plotly]: https://plotly.com/
[plotly-export]: https://plotly.com/python/static-image-export/
[pypi]: https://pypi.org/
[repo]: https://github.com/plotly/Kaleido
13 changes: 7 additions & 6 deletions src/py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ enabled = true

[project]
name = "kaleido"
description = "plotly graph export library"
license = {file = "LICENSE.txt"}
description = "Plotly graph export library"
license = {file = "LICENSE.md"}
readme = "README.md"
requires-python = ">=3.9"
dynamic = ["version"]
dependencies = ["choreographer>=0.99.6",
"async_timeout"
]
dependencies = [
"choreographer>=0.99.6",
"async_timeout"
]
authors = [
{name = "Andrew Pikul", email = "[email protected]"},
]
Expand All @@ -31,7 +32,7 @@ maintainers = [
[project.optional-dependencies]
dev = [
"pytest",
]
]

[tool.ruff.lint]
ignore = ["E701"] # E701 oneline if's

0 comments on commit 2459633

Please sign in to comment.