Skip to main content

Jupyter magic for managing linked JavaScript scripts and CSS styles.

Project description

jupyter-require

Jupyter magic library for managing linked JavaScript scripts and CSS styles.

About

The jupyter-require library is intended to be used in Jupyter notebooks.

jupyter-require allows you to link custom CSS and JavaScript files and even create and load your own styles and scripts directly from Jupyter notebook.


What is this for?

If you are into data visualization like me, you've most likely already heard of d3.js JavaScript ecosystem. It's incredibly powerful tool which can be used to create advanced interactive visualizations.

However, it is not very comfortable to use in Jupyter notebooks let alone integrate with Python (see the article about Custom D3.js Visualization in a Jupyter Notebook).

That's where jupyter-require and related jupyter-d3 come into play. jupyter-require allows you to source custom scripts (like d3) and styles and use them within the notebook with ease.

Check out also jupyter-d3 which takes the d3 workflow in Jupyter notebooks to another level.


Installation


pip install jupyter-require

Example usage

In Jupyter notebooks:

%load_ext jupyter_require

Loading libraries

Loading required libraries is now as simple as:

%require d3 https://d3js.org/d3.v5.min
%require d3-hierarchy https://d3js.org/d3-hierarchy.v1.min

Note that the path does NOT contain the .js file extension. This is requireJS standard.

The %require is jupyter magic command and the rest are the parameters. The command takes lib name and path.

Creating custom style elements

%%load_css

/* d3.css */


.links text {
    fill: none;
    stroke: #ccc;
    stroke-width: 1px;

}

.nodes {
    z-index: 1;
    font: 13px sans-serif;
}

.nodes circle {
    fill: darkslateblue;
    stroke: none;
}


Author: Marek Cermak macermak@redhat.com

Project details


Download files

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

Source Distribution

jupyter-require-0.1.13.tar.gz (420.8 kB view details)

Uploaded Source

Built Distribution

jupyter_require-0.1.13-py2.py3-none-any.whl (21.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file jupyter-require-0.1.13.tar.gz.

File metadata

  • Download URL: jupyter-require-0.1.13.tar.gz
  • Upload date:
  • Size: 420.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.19.6 CPython/3.6.6

File hashes

Hashes for jupyter-require-0.1.13.tar.gz
Algorithm Hash digest
SHA256 154b52464575c5f4e328c3efd004dd34f479805dc65924be38ed9938c4b4d3e2
MD5 5f1a0fadde24d17a8f08fc2cdd8b5cb4
BLAKE2b-256 248370b14825b380b69c628f2d9dd268784170423cf62a6304a25d446e3de8da

See more details on using hashes here.

File details

Details for the file jupyter_require-0.1.13-py2.py3-none-any.whl.

File metadata

  • Download URL: jupyter_require-0.1.13-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.19.6 CPython/3.6.6

File hashes

Hashes for jupyter_require-0.1.13-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 422fe1b37f3ea103a0a9529e40132d52e3d4f57d3a0ab9fa2408d70c00555129
MD5 1c18a38710a9ef0607f6afdddf3abe63
BLAKE2b-256 92361af2db5469e0952ddcf01b68af5e18859f832ef81d8df21d2735729cef5b

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