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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for jupyter_require-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe77b103386c5c4d9b3d4ebbda24afcfa1536350e1fbd7833aa48d9d1dcdc5f4 |
|
MD5 | 4498504436e670ae63d1ad4fbe074191 |
|
BLAKE2b-256 | b2bdd1caf92585c50ed15a4b259c14267a1f64bc7c8fc998b5ae36b6e2c57e90 |