notebook_setup


Namenotebook_setup JSON
Version 1.3 PyPI version JSON
download
home_pageNone
SummaryTools to setup and configure jupyter notebooks (ipynb files) with line and cell magic
upload_time2024-05-10 08:12:52
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords autoreload cell magic ipynb jupyter line magic notebook plotly render
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # notebook_setup

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

## Install
```bash
pip install notebook_setup
```

## Usage
```python
from notebook_setup 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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "notebook_setup",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "autoreload, cell magic, ipynb, jupyter, line magic, notebook, plotly render",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c0/2f/702a8882d96587c4940c78a9e8676792d81bfc4ad734cf0362ad5d2319ad/notebook_setup-1.3.tar.gz",
    "platform": null,
    "description": "# notebook_setup\n\nTools to setup and configure jupyter notebooks (ipynb files) with line and cell magic\n\n## Install\n```bash\npip install notebook_setup\n```\n\n## Usage\n```python\nfrom notebook_setup import notebook_setup, notebook_config_plotly_rendering\n```\n\n### Notebook setup\n\n```python\nnotebook_setup(autoreload=True, background_transparent=True)\n```\n\n`autoreload=True` \u279c runs this line magic:\n\n```\n%load_ext autoreload\n%autoreload 2\n```\n\n`background_transparent=True` \u279c runs this cell magic:\n\n```\n%%html\n<style>\n.cell-output-ipywidget-background {background-color: transparent !important;}\n.jp-OutputArea-output {background-color: transparent;}\n</style>\n```\n\n### Configure the behavior of Plotly figures in Jupyter notebooks\n\n```python\nnotebook_config_plotly_rendering(\n    force_small_file=True, \n    global_renderer=\"svg\",\n    )\n```\n\nOnly figures with `fig.show()` are effected by this configuration.\n\n`force_small_file=True` \u279c Plotly figures are not saved inside the notebook  \n\n`global_renderer: str =`\"[available options](https://plotly.com/python/renderers/)\" \u279c Specifies render format, has only effect if `force_small_file=False`  \n\n### Configuration examples\n\n**Develop notebooks** minimal file size, saves large notebooks very quickly:\n\n```python\nnotebook_config_plotly_rendering(\n    force_small_file=True,\n    global_renderer=\"svg\",\n    )\n```\n\n**Export as html or push to GitHub**  small file size, vector or raster images depending on selected renderer\n\n```python\nnotebook_config_plotly_rendering(\n    force_small_file=False, \n    global_renderer=\"svg\",\n    )\n```\n\n**Archive notebooks on disk**  large file size, stores interactive figures, uses default renderer\n\n```python\nnotebook_config_plotly_rendering(\n    force_small_file=False, \n    global_renderer=None,\n    )\n```\n\n**Configure individual figures**  independent of setting of `global_renderer`\n\n```python\nfig.show(renderer=\"browser\")\n```\n\nHint: `\"browser\"` opens a figure in your web browser, you have bigger window compared to a notebook cell\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Tools to setup and configure jupyter notebooks (ipynb files) with line and cell magic",
    "version": "1.3",
    "project_urls": {
        "homepage": "https://github.com/1081/notebook_setup"
    },
    "split_keywords": [
        "autoreload",
        " cell magic",
        " ipynb",
        " jupyter",
        " line magic",
        " notebook",
        " plotly render"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c02f702a8882d96587c4940c78a9e8676792d81bfc4ad734cf0362ad5d2319ad",
                "md5": "2d85a5258db3679d6344b9cfbfba2cec",
                "sha256": "f9368a783d4d850090a70822eff041c259ee480dd628e5323f9e575d048ce871"
            },
            "downloads": -1,
            "filename": "notebook_setup-1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "2d85a5258db3679d6344b9cfbfba2cec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 5449,
            "upload_time": "2024-05-10T08:12:52",
            "upload_time_iso_8601": "2024-05-10T08:12:52.112004Z",
            "url": "https://files.pythonhosted.org/packages/c0/2f/702a8882d96587c4940c78a9e8676792d81bfc4ad734cf0362ad5d2319ad/notebook_setup-1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-10 08:12:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "1081",
    "github_project": "notebook_setup",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "notebook_setup"
}
        
Elapsed time: 4.93552s