Simple reusable magics.
Project description
``magical-magic``
=================
Dead simple ``IPython`` magics.
Installation
------------
``pip install magical-magic``
Basic Usage
-----------
.. code:: python
import magical
env = magical.register_jinja2_magic() # returns a jinja environment
magical.register_mistune_magic(escape=False)
magical.register_yaml_magic()
.. parsed-literal::
<IPython.core.display.Javascript object>
.. parsed-literal::
<IPython.core.display.Javascript object>
.. parsed-literal::
<IPython.core.display.Javascript object>
.. code:: python
data = {'🐮': 'moo', '🐑': 'bah', '🔥': 'burn'}
.. code:: python
%%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**
--------------
.. code:: python
%%mistune
## 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__()}}.
.. raw:: html
<h2>Mistune Cell Magics</h2>
<p><code>%%mistune</code> uses a pure Python markdown parser. For convenience, jinja templates can be used to
tell us about the length of <code>data</code> is 3.</p>
--------------
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 <https://github.com/tonyfast/magical-magic/blob/master/LICENSE>`__.
=================
Dead simple ``IPython`` magics.
Installation
------------
``pip install magical-magic``
Basic Usage
-----------
.. code:: python
import magical
env = magical.register_jinja2_magic() # returns a jinja environment
magical.register_mistune_magic(escape=False)
magical.register_yaml_magic()
.. parsed-literal::
<IPython.core.display.Javascript object>
.. parsed-literal::
<IPython.core.display.Javascript object>
.. parsed-literal::
<IPython.core.display.Javascript object>
.. code:: python
data = {'🐮': 'moo', '🐑': 'bah', '🔥': 'burn'}
.. code:: python
%%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**
--------------
.. code:: python
%%mistune
## 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__()}}.
.. raw:: html
<h2>Mistune Cell Magics</h2>
<p><code>%%mistune</code> uses a pure Python markdown parser. For convenience, jinja templates can be used to
tell us about the length of <code>data</code> is 3.</p>
--------------
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 <https://github.com/tonyfast/magical-magic/blob/master/LICENSE>`__.
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
magical-magic-0.0.7.tar.gz
(5.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file magical-magic-0.0.7.tar.gz.
File metadata
- Download URL: magical-magic-0.0.7.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14c759a4d3ca41a8d5b5832eb70384522313d91ca598d249b4934e427e57c68d
|
|
| MD5 |
fc86f48e7c25c2fe2c5f5bce57f44c0d
|
|
| BLAKE2b-256 |
f081b3cfedc865eb5951898a89312feed34a9549f60c4ca538a57799429d895c
|
File details
Details for the file magical_magic-0.0.7-py3.5.egg.
File metadata
- Download URL: magical_magic-0.0.7-py3.5.egg
- Upload date:
- Size: 7.2 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4904d941ef538de5912d68c50b2074445cf44b6e28a2a2ad2224cf727f0182cb
|
|
| MD5 |
e9a3bdee10e2f271c46ac76d35428cdd
|
|
| BLAKE2b-256 |
2000d588cc8b630c665a112af19387a70c5ead8ec2d24a70b554d0ca543b2724
|