A Jupyter Notebook %%magic to quickly edit and run source code
Project description
# Jupyter Source Magic
A Jupyter Notebook %%magic to quickly edit and run source code.
Both saves and evaluates source code when cell is run
Accepts and evaluates other cell magic annotations, without saving them
Deals with existing files and monitors external changes
Disclaimer
This is an experimental project. Use at your own risk.
Usage
Load extension inside a Jupyter notebook:
` %load_ext jupytersourcemagic `
Add code with Cell magic:
` %%source path/to/source.py # code to run `
Run to save and evaluate.
Examples
Save and run a script:
` %%source path/to/source.py print('hello') `
Load an existing source to edit.
` %loadsource path/to/source.py ## when run, cell contents will be replaced with path/to/source.py `
Handle other cell magic annotations:
` %%source path/to/source.sh %%bash echo 'hello' `
Help
Display usage and configuration options:
` %%source? `
Installation
Install and activate dependencies:
[ipywidgets](https://github.com/jupyter-widgets/ipywidgets)
[jupyter-interval-widget](https://github.com/srizzo/jupyter-interval-widget)
Then:
$ pip install jupyter-source-magic
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-source-magic-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a773e28b5a9ac45beaf3dd275a6ea806265f74a218a3a1ffc2447da996eae13 |
|
MD5 | 314f10d7b9c0a5aebcd7bbd2f8662946 |
|
BLAKE2b-256 | d48b341fba3bceb30f858e1d3546e56f08baad96e2429c739605f166b9ea0b42 |
Hashes for jupyter_source_magic-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44716a82a42933da5b457fd2c02dea6479b6e6540c85fc6ae5dcb351bbeaaf2b |
|
MD5 | de0e87abd834f025b2ab7663fc7eed31 |
|
BLAKE2b-256 | 3abbc68922b4d596e1cb4732baa417d0a22571f33c45627dca7316f52c1bf714 |