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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for jupyter-source-magic-0.1.1.tar.gz
Algorithm Hash digest
SHA256 36a80ac54a047424ed407522d087372b6c4af2100733e9fb85e6ed2c0a9ceaf0
MD5 fc243f7e04840af707d0d1438db68671
BLAKE2b-256 e46c2d9edfc9c67dd442ce1e82087dd64a25b019f400a642cb03b5e42cd2c69b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jupyter_source_magic-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99b4f0e247815943008f6930efd951ad1d8df59f4372340e62892ccfecaf76f3
MD5 6b9a75936fa8d180a201411764271b2e
BLAKE2b-256 4217f24119eb3db7a2e7336cd8785adad69b02275b836ba11a849cf1f0506bea

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