Code Snippets Extension for JupyterLab
Project description
Jupyter Lab Menu Extensions
The idea of the Snippet Library is to create a tool for rapid prototyping with the aim of quickly and easily developing data analysis workflows. It adds a customizable menu to insert code snippets, code examples and boilerplate code on notebooks.
This Jupyter Lab extension is based on the jupyterlab-snippets extension. How do I read a csv
file? There´s a snippet for that. How do I visualize missing values in a pandas dataframe? There´s a snippet for that. How do I plot the correlation matrix of my pandas dataframe (and make it look good)?. There's a snippet for that. You get the idea.
The focus of the provided snippets is helping to get started (or to get more productive) on data science tasks. The menu provides several snippets ordered by typical task groups used for exploring and visualizing data.
The default menu provides the items:
-
Data
which provides snippets to read, write and transform data. -
Modelling
which provides snippets to train ML models (mostly based onsklearn
). You'll find examples for classification, regression and clustering. -
Plotting
which provides some regularly used snippets formatplotlib
,bokeh
and thepandas
interface. -
Utils
which provides some snippets which do not fit into the former categories but are still helpful.
With the jupyter extension a set of base snippets are provided, for which we are mostly sure, that they do their job as described. Also, it's possible to add your own snippets, either by copy-pasting them or by uploading them from a python file.
Configuration
The following Prerequisites must be installed:
Anaconda
Jupyterlab 2.X
(Python 3.X)
Nodejs
jlpm
Installation
For the snippet library to work for Jupyter Lab, two packages must be installed which are the server extension
and the labextension
for the frontend.
Install the server extension of the snippet library from Pypi with the command
pip install snippetlib-jl
For the frontend it is recommended to install it from git as follows.
For Linux/macOS users
git clone https://github.com/fraunhofer-iais/IAIS-JupyterLab-Snippets-Extension.git
cd IAIS-JupyterLab-Snippets-Extension
git checkout master
make install_configure
For Windows users
git clone https://github.com/fraunhofer-iais/IAIS-JupyterLab-Snippets-Extension.git
cd IAIS-JupyterLab-Snippets-Extension
git checkout master
build_snippetlib_jl.bat
Or, you can run all installation commands manually as follows
pip install snippetlib-jl
jupyter serverextension enable --py snippetlib_jl
jlpm
jlpm build
jupyter labextension link .
jlpm build
jupyter lab build
Operating instructions
Start Jupyter Notebook
• Windows: Open Anaconda prompt and type "jupyter lab".
• Linux: Open terminal and type "jupyter lab“.
• The Jupyter front-end should open in a browser window.
How to add your own snippets
To upload a new snippet on the jupyter notebook, paste the following in a new cell.
from snippetlib_jl import upload_snippet as us
upload_snippets = us.Upload_Snippet()
Refresh the page and on the Snippets menu you should see the newly added snippet.
To create new snippets,on the jupyter notebook,paste the following in a new cell.
from snippetlib_jl import paste_snippet as ps
paste_snippets = ps.Paste_Snippet()
Refresh the page and on the Snippets menu you should see the newly added snippet.
Credits and Acknolegements
The development of this Jupyter extension was supported by the Fraunhofer Lighhouse Project Machine Learning for Production (ML4P). The main development has been carried out by the Knowledge Discovery Department of the Fraunhofer IAIS. We would like to thank Daniel Paurat for the original idea of the project.
Contact information
If you're interested in supporting the further development of this extension or if you need support for the usage please contact snippets@iais.fraunhofer.de.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file snippetlib_jl-1.7.2-py3-none-any.whl
.
File metadata
- Download URL: snippetlib_jl-1.7.2-py3-none-any.whl
- Upload date:
- Size: 86.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 074e0320d15fa8cd4dc40930e17779f57e1877a9bffaa7a78fe7a965b4418fc6 |
|
MD5 | 51c7eb48a68f5f77945e2cf031595a6d |
|
BLAKE2b-256 | 439a9ac7980329875174ba96163eafd08fa44332e0d3bc958f10c5827d830ff6 |