Metadata-Version: 2.3
Name: plotlyshare
Version: 2.0.1
Summary: Link-based sharing of `plotly` plots
Keywords: plotly,interactive,plot
Author: plutonium239
Author-email: plutonium239 <plutonium.239.811@gmail.com>
License: The MIT License (MIT)
         
         Copyright (c) 2026 Samarth Bhatia
         
          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.
         
         
         This license applies to the python client.
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Dist: rich
Requires-Dist: plotly
Requires-Dist: wonderwords
Requires-Dist: requests
Requires-Dist: orjson
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/plutonium-239/plotlyshare
Project-URL: Issues, https://github.com/plutonium-239/plotlyshare/issues
Description-Content-Type: text/markdown

# PlotlyShare v2 (🚀 -> 🌥)
[![Downloads](https://static.pepy.tech/badge/plotlyshare)](https://pepy.tech/project/plotlyshare)

The purpose of this package is to provide a seamless way to share interactive `plotly` plots, providing a similar experience to ~~google~~ docs/etc. 

The idea is to preserve the interactivity and responsiveness of `plotly` plots with the ease of **link-based sharing** and without all the hassle of sending an html file, or worse, a static image/document. Two examples: 
- [sine noise - proportional](https://plotlyshare.pages.dev/#/plot/demo_plots/demo.da2938bdb028899928cde3467fb7bf7f)
- [alcoholic lord 22nd Aug](https://plotlyshare.pages.dev/#/plot/demo_plots/demo.81b9314703a002f021880c256d1660f8)

<!-- TODO: add screenshots -->

> [!TIP]
> If you used plotlyshare v1, go [here](https://plotlyshare.pages.dev) for migration instructions

## Installation
```bash
uv add "plotlyshare>=2"
```

```bash
pip install "plotlyshare>=2"
```

## First Time Setup

To use this, run `uv run -m plotlyshare setup`/`python -m plotlyshare setup` and set your ==CLI Token== as follows:

Log in to https://plotlyshare.pages.dev 
> [!NOTE]
> This requires you to have a google account, as the storage (drive) is private to you. I'm working on adding a similar workflow for github as well. 

Click on your profile icon, here you will see a ==CLI Token== section. Click on that to reveal it and copy the token with the copy button.

Enter that value for the `CLI_TOKEN` in the setup prompt, then it will test the connection and report back.


## Usage
And then whenever making a plot, simply import `plotlyshare` (import order doesn't matter) and set `renderer='plotlyshare'` when calling `fig.show()` like below:


<table style="table-layout:auto;">
<tr>
<td>
    
With `plotly.express` 

</td>
<td>

With `plotly.graph_objects`

</td>
</tr>
<tr>
<td>
    
```python
import plotly.express as px
import plotlyshare
...
fig = px.line(...)
...
fig.show(renderer='plotlyshare')
```

</td>
<td>

```python
import plotly.graph_objects as go
import plotlyshare
...
fig = go.Figure(...)
...
fig.show(renderer='plotlyshare')
```

</td>
</tr>
</table>

<!--  
```py
...
import plotly.express as px
import plotly.graph_objects as go

import plotlyshare

...
fig = px.line(...)
fig = go.Figure(...)

fig.show(renderer='plotlyshare')
```
 -->

And that's it, the package will upload your plot to plotlyshare and assign it a randomly generated name with a date like *`mushy pancake 24th Jul`*. 
It will display the name and the **direct link** to the plot, **ready to share** with anyone. Additionally, it also tells you how big the plot was so you can keep track of storage (unlikely to be a problem).

Plots are **private by default** and you can change the privacy for each plot from the dashboard.

## Misc

**Change your plot's name:** 

To add a title to your plot (instead of the default randomly generated one), you can edit it from
1. your [online dashboard](https://plotlyshare.pages.dev/#/dash)
2. the plot's page
3. or even set it directly when uploading: 
```python
fig.show(renderer='plotlyshare', plot_name='this plot has a fancy name')
```

## Screenshots:

<!-- ![image](https://hackmd.io/_uploads/r1WQ9afPll.png) -->

![image](https://hackmd.io/_uploads/SyhtxyBwxl.png)
