From 031fafa7f3e2922f829eb8a47f08f0cc2d095a88 Mon Sep 17 00:00:00 2001 From: Greg Wilson Date: Mon, 21 Oct 2024 08:44:37 -0400 Subject: [PATCH] docs: update README and LICENSE and add code of conduct --- CODE_OF_CONDUCT.md | 70 +++++++++++++++++++++++++++++++++++++++ LICENSE.txt => LICENSE.md | 4 +-- README.md | 65 ++++++++++++++++-------------------- 3 files changed, 99 insertions(+), 40 deletions(-) create mode 100644 CODE_OF_CONDUCT.md rename LICENSE.txt => LICENSE.md (90%) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..bcc60e4 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -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. diff --git a/LICENSE.txt b/LICENSE.md similarity index 90% rename from LICENSE.txt rename to LICENSE.md index abfefa0..7880ca7 100644 --- a/LICENSE.txt +++ b/LICENSE.md @@ -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 diff --git a/README.md b/README.md index 8e88b57..7ae303c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# 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.
@@ -9,23 +9,33 @@ In short: If you `pip install kaleido` you can use `fig.write_image("filename.pn
-# 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 @@ -33,29 +43,10 @@ fig = px.scatter(px.data.iris(), x="sepal_length", y="sepal_width", color="speci 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