Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tonyfast/magical-magic
Dead simple magics for IPython
https://github.com/tonyfast/magical-magic
Last synced: 11 days ago
JSON representation
Dead simple magics for IPython
- Host: GitHub
- URL: https://github.com/tonyfast/magical-magic
- Owner: tonyfast
- License: bsd-3-clause
- Created: 2016-09-07T13:12:52.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-02T02:57:00.000Z (over 6 years ago)
- Last Synced: 2024-10-11T19:25:02.656Z (about 1 month ago)
- Language: HTML
- Size: 458 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.rst
- License: LICENSE
Awesome Lists containing this project
README
``magical-magic``
=================Dead simple reusable ``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::
.. parsed-literal::
.. parsed-literal::
.. 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
Mistune Cell Magics
%%mistune
uses a pure Python markdown parser. For convenience, jinja templates can be used to
tell us about the length ofdata
is 3.--------------
Development
-----------Running the Build and Tests
^^^^^^^^^^^^^^^^^^^^^^^^^^^::
pip install -r requirements-dev.txt
python setup.py develop
watchmedo tricks tricks.yamlThe ``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 `__.