Skip to main content

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:

Then:

$ pip install jupyter-source-magic

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-source-magic-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

jupyter_source_magic-0.1.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file jupyter-source-magic-0.1.2.tar.gz.

File metadata

File hashes

Hashes for jupyter-source-magic-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0a773e28b5a9ac45beaf3dd275a6ea806265f74a218a3a1ffc2447da996eae13
MD5 314f10d7b9c0a5aebcd7bbd2f8662946
BLAKE2b-256 d48b341fba3bceb30f858e1d3546e56f08baad96e2429c739605f166b9ea0b42

See more details on using hashes here.

File details

Details for the file jupyter_source_magic-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyter_source_magic-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 44716a82a42933da5b457fd2c02dea6479b6e6540c85fc6ae5dcb351bbeaaf2b
MD5 de0e87abd834f025b2ab7663fc7eed31
BLAKE2b-256 3abbc68922b4d596e1cb4732baa417d0a22571f33c45627dca7316f52c1bf714

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