Skip to main content

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

Project description

notebook_setup

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

Install

pip install notebook_setup2

Usage

from notebook_setup2 import notebook_setup, notebook_config_plotly_rendering

Notebook setup

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

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" ➜ Specifies render format, has only effect if force_small_file=False

Configuration examples

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

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

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

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

notebook_config_plotly_rendering(
    force_small_file=False, 
    global_renderer=None,
    )

Configure individual figures independent of setting of global_renderer

fig.show(renderer="browser")

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

Project details


Release history Release notifications | RSS feed

This version

1.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notebook_setup2-1.3.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

notebook_setup2-1.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file notebook_setup2-1.3.tar.gz.

File metadata

  • Download URL: notebook_setup2-1.3.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.1

File hashes

Hashes for notebook_setup2-1.3.tar.gz
Algorithm Hash digest
SHA256 975a82adb9dbc3c391646d69e86d160a18e499b56d2afe00d1c2f30036654ddb
MD5 f860782a110102fdc6420e22726e15d9
BLAKE2b-256 d37509188b8acd049a925f22f3cd77a542296e45a434b48b247a21cb14f43dc5

See more details on using hashes here.

File details

Details for the file notebook_setup2-1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for notebook_setup2-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 841f049122b1365b655d1bbbc6735be85c13784bdf860d6086fc19f6da1248c4
MD5 8684fca184814af6fa6bab7852281eec
BLAKE2b-256 acc2ad3ce38528b4a91ee498b3ecead23a44be3104d29f50a1ba6a80c04b98f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page