Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update README and LICENSE and add code of conduct #208

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Code of Conduct

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of
experience, education, socioeconomic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* using welcoming and inclusive language,
* being respectful of differing viewpoints and experiences,
* gracefully accepting constructive criticism,
* focusing on what is best for the community, and
* showing empathy towards other community members.

Examples of unacceptable behavior by participants include:

* the use of sexualized language or imagery and unwelcome sexual
attention or advances,
* trolling, insulting/derogatory comments, and personal or political
attacks,
* public or private harassment,
* publishing others' private information, such as a physical or
electronic address, without explicit permission, and
* other conduct which could reasonably be considered inappropriate in
a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project email
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by emailing the project team. All complaints will be reviewed
and investigated and will result in a response that is deemed necessary and
appropriate to the circumstances. The project team is obligated to maintain
confidentiality with regard to the reporter of an incident. Further details of
specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from
the [Contributor Covenant](https://www.contributor-covenant.org/) version 1.4.
4 changes: 1 addition & 3 deletions LICENSE.txt → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
All code developed in this repository is released under the MIT license.

The MIT License (MIT)

Copyright (c) 2020 Plotly, Inc
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
Expand Down
65 changes: 28 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,52 @@
# Overview
Kaleido is a cross-platform library for generating static images (e.g. png, svg, pdf, etc.) for web-based visualization libraries.
# Kaleido

In short: If you `pip install kaleido` you can use `fig.write_image("filename.png")`.
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>

# Installing Kaleido
## How It Works

The kaleido package can be installed from [PyPI](https://pypi.org/) using pip...
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.

```
$ pip install kaleido
```
> 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.

## Installation

or from [conda-forge](https://conda-forge.org/) using conda.
You can install kaleido from [PyPI][pypi] using pip:

```
$ conda install -c conda-forge python-kaleido
$ pip install kaleido
```

# Use Kaleido to export plotly.py figures as static images
## 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:
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")
```

Then, open `figure.png` in the current working directory.

![fig](https://user-images.githubusercontent.com/15064365/101241780-3590b580-36c7-11eb-8eba-eb1fae256ad0.png)

See the plotly static image export documentation for more information: https://plotly.com/python/static-image-export/.

# Previous Kaleido API

Kaleido was previously arcitectured to accept "scopes"- they are no longer necessary. The old API is demonstrated below but it is only supported to the extent needed as to not break previous implementations of kaleido for plotly. This API will likely emit a deprecation warning, and proceed to be unsupported.

```python
from kaleido.scopes.plotly import PlotlyScope
import plotly.graph_objects as go
scope = PlotlyScope(
plotlyjs="https://cdn.plot.ly/plotly-latest.min.js",
# plotlyjs="/path/to/local/plotly.js",
)

fig = go.Figure(data=[go.Scatter(y=[1, 3, 2])])
with open("figure.png", "wb") as f:
f.write(scope.transform(fig, format="png"))
```

Then, open `figure.png` in the current working directory.
See the [Plotly static image export documentation][plotly-export] for more information.

![figure](https://user-images.githubusercontent.com/15064365/86343448-f8f7f400-bc26-11ea-9191-6803748c2dc9.png)
[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
Loading