Skip to main content

magical-magic

Dead simple reusable IPython magics.

Installation

pip install magical-magic

Basic Usage

import magical
env = magical.register_jinja2_magic() # returns a jinja environment
magical.register_mistune_magic(escape=False)
magical.register_yaml_magic()
<IPython.core.display.Javascript object>
<IPython.core.display.Javascript object>
<IPython.core.display.Javascript object>
data = {'🐮': 'moo', '🐑': 'bah', '🔥': 'burn'}
%%jinja2
# Jinja Cell Magics

`%%jinja2` inserts data from the notebook into the template.

## An example of a list

{% for key in data %}* {{key}} - __{{data[key]}}__
{% endfor %}

Jinja Cell Magics

%%jinja2 inserts data from the notebook into the template.

An example of a list

  • 🐮 - moo

  • 🔥 - burn

  • 🐑 - bah


%%mistune -d
## Mistune Cell Magics

`%%mistune` uses a pure Python markdown parser.  For convenience, jinja templates can be used to
tell us about the length of `data` is {{data.__len__()}}.

Development

Running the Build and Tests

pip install -r requirements-dev.txt
python setup.py develop
watchmedo tricks tricks.yaml

The watchmedo script will convert your notebooks to scripts and html files. py.test-ipynb will test all notebooks matching test-*.ipynb.

Running the docs

jekyll serve docs -wit

Docs are hosted at http://localhost:4000/magical-magic/.

License

magical-magic is released as free software under the BSD 3-Clause license.

Metadata

Release files for magical-magic 0.0.9

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

Source distribution (sdist)

Source distribution for magical-magic 0.0.9
File Size Uploaded
magical-magic-0.0.9.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for magical-magic 0.0.9
File Interpreter ABI Platform
magical_magic-0.0.9-py3.5.egg Legacy Egg format - - Details

Total release size: 12.1 kB

Release files / magical-magic-0.0.9.tar.gz

Download URL magical-magic-0.0.9.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f8b55983cfb29efe0817e547f5550fead8a07c09600c825468c04d2ec6411221
BLAKE2b-256 checksum
How to use checksums
519604414dc1c166776164350547ade4d8c24e880d747be66554439b24db1a21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / magical_magic-0.0.9-py3.5.egg

Download URL magical_magic-0.0.9-py3.5.egg
Size 7.1 kB
Tags Egg
SHA-256 checksum
How to use checksums
59876075e47cb3e42df886864c1d01654248ce9733cfc0916e76ddd71d0ec9db
BLAKE2b-256 checksum
How to use checksums
e85a1afca2789ebb7db19ccd93c4ff43ebb36bcde780206f6f9e35e176fa87ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.2

0.0.1

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