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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for jupyter-source-magic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e28a1423b6a1573003aee7b2fe2a2b13fbd518c1569b9a670acd7b6a9dbfe4f8
MD5 997c6fb43491210a892b46bbc6f361c7
BLAKE2b-256 02ab7a5f754550f6e72c769c6a6fddd6a41936864c7321ae4c39946385a3ed39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jupyter_source_magic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a886f82064610aa3dac5ff45cf8729d7c2b12d9f99064a30038bc33299b0e25f
MD5 dbb11834fcc5c57d70cad8950946d8c0
BLAKE2b-256 9c0a493ea8e7c36c009edc3a2f911d2f227da0e3cf0690d47ce9592b63fca497

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