Metadata-Version: 2.3
Name: notebook_setup2
Version: 1.3
Summary: Tools to setup and configure jupyter notebooks (ipynb files) with line and cell magic
Project-URL: homepage, https://github.com/1081/notebook_setup2
License-Expression: MIT
License-File: LICENSE
Keywords: autoreload,cell magic,ipynb,jupyter,line magic,notebook,plotly render
Requires-Python: >=3.7
Requires-Dist: ipykernel
Requires-Dist: ipython
Description-Content-Type: text/markdown

# notebook_setup

Tools to setup and configure jupyter notebooks (ipynb files) with line and cell magic

## Install

```bash
pip install notebook_setup2
```

## Usage

```python
from notebook_setup2 import notebook_setup, notebook_config_plotly_rendering
```

### Notebook setup

```python
notebook_setup(autoreload=True, background_transparent=True)
```

`autoreload=True` ➜ runs this line magic:

```
%load_ext autoreload
%autoreload 2
```

`background_transparent=True` ➜ runs this cell magic:

```
%%html
<style>
.cell-output-ipywidget-background {background-color: transparent !important;}
.jp-OutputArea-output {background-color: transparent;}
</style>
```

### Configure the behavior of Plotly figures in Jupyter notebooks

```python
notebook_config_plotly_rendering(
    force_small_file=True, 
    global_renderer="svg",
    )
```

Only figures with `fig.show()` are effected by this configuration.

`force_small_file=True` ➜ Plotly figures are not saved inside the notebook  

`global_renderer: str =`"[available options](https://plotly.com/python/renderers/)" ➜ Specifies render format, has only effect if `force_small_file=False`  

### Configuration examples

**Develop notebooks** minimal file size, saves large notebooks very quickly:

```python
notebook_config_plotly_rendering(
    force_small_file=True,
    global_renderer="svg",
    )
```

**Export as html or push to GitHub**  small file size, vector or raster images depending on selected renderer

```python
notebook_config_plotly_rendering(
    force_small_file=False, 
    global_renderer="svg",
    )
```

**Archive notebooks on disk**  large file size, stores interactive figures, uses default renderer

```python
notebook_config_plotly_rendering(
    force_small_file=False, 
    global_renderer=None,
    )
```

**Configure individual figures**  independent of setting of `global_renderer`

```python
fig.show(renderer="browser")
```

Hint: `"browser"` opens a figure in your web browser, you have bigger window compared to a notebook cell
