notebook_setup2


Namenotebook_setup2 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:25:48
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_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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "notebook_setup2",
    "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/d3/75/09188b8acd049a925f22f3cd77a542296e45a434b48b247a21cb14f43dc5/notebook_setup2-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\n```bash\npip install notebook_setup2\n```\n\n## Usage\n\n```python\nfrom notebook_setup2 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_setup2"
    },
    "split_keywords": [
        "autoreload",
        " cell magic",
        " ipynb",
        " jupyter",
        " line magic",
        " notebook",
        " plotly render"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "acc2ad3ce38528b4a91ee498b3ecead23a44be3104d29f50a1ba6a80c04b98f9",
                "md5": "8684fca184814af6fa6bab7852281eec",
                "sha256": "841f049122b1365b655d1bbbc6735be85c13784bdf860d6086fc19f6da1248c4"
            },
            "downloads": -1,
            "filename": "notebook_setup2-1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8684fca184814af6fa6bab7852281eec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 3895,
            "upload_time": "2024-05-10T08:25:50",
            "upload_time_iso_8601": "2024-05-10T08:25:50.175152Z",
            "url": "https://files.pythonhosted.org/packages/ac/c2/ad3ce38528b4a91ee498b3ecead23a44be3104d29f50a1ba6a80c04b98f9/notebook_setup2-1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d37509188b8acd049a925f22f3cd77a542296e45a434b48b247a21cb14f43dc5",
                "md5": "f860782a110102fdc6420e22726e15d9",
                "sha256": "975a82adb9dbc3c391646d69e86d160a18e499b56d2afe00d1c2f30036654ddb"
            },
            "downloads": -1,
            "filename": "notebook_setup2-1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f860782a110102fdc6420e22726e15d9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4979,
            "upload_time": "2024-05-10T08:25:48",
            "upload_time_iso_8601": "2024-05-10T08:25:48.509745Z",
            "url": "https://files.pythonhosted.org/packages/d3/75/09188b8acd049a925f22f3cd77a542296e45a434b48b247a21cb14f43dc5/notebook_setup2-1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-10 08:25:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "1081",
    "github_project": "notebook_setup2",
    "github_not_found": true,
    "lcname": "notebook_setup2"
}
        
Elapsed time: 4.18190s