Skip to main content

# 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

Release files for jupyter-source-magic 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyter-source-magic 0.1.2
File Size Uploaded
jupyter-source-magic-0.1.2.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyter-source-magic 0.1.2
File Interpreter ABI Platform
jupyter_source_magic-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / jupyter-source-magic-0.1.2.tar.gz

Download URL jupyter-source-magic-0.1.2.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0a773e28b5a9ac45beaf3dd275a6ea806265f74a218a3a1ffc2447da996eae13
BLAKE2b-256 checksum
How to use checksums
d48b341fba3bceb30f858e1d3546e56f08baad96e2429c739605f166b9ea0b42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Release files / jupyter_source_magic-0.1.2-py3-none-any.whl

Download URL jupyter_source_magic-0.1.2-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44716a82a42933da5b457fd2c02dea6479b6e6540c85fc6ae5dcb351bbeaaf2b
BLAKE2b-256 checksum
How to use checksums
3abbc68922b4d596e1cb4732baa417d0a22571f33c45627dca7316f52c1bf714
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page