https://github.com/deathbeds/aye
imports notebook files as iteractive python modules.
https://github.com/deathbeds/aye
Last synced: 10 months ago
JSON representation
imports notebook files as iteractive python modules.
- Host: GitHub
- URL: https://github.com/deathbeds/aye
- Owner: deathbeds
- License: bsd-3-clause
- Created: 2018-01-22T20:27:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-08T16:49:33.000Z (almost 8 years ago)
- Last Synced: 2025-02-02T22:36:40.550Z (11 months ago)
- Language: Jupyter Notebook
- Size: 256 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.ipynb
- License: LICENSE
Awesome Lists containing this project
README
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`eye` imports notebooks as Interactive Modules. With `eye` imports:\n",
"\n",
"* Notebooks can be used as python source.\n",
"* The native `importlib.reload` object reloads `eye` modules.\n",
"* `eye` provides line level debugging to the source notebook.\n",
"* `paramterize` notebooks to makes them `callable`."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
" import eye.activate\n",
" import readme"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Imported notebooks are reloadable."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
" from importlib import reload\n",
" assert reload(readme) is readme"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The [`eye/tests`](eye/tests/) explains more about the basic and advanced features of `eye` \n",
"\n",
"> `eye.tests` are importable."
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
" import eye.tests.test_basics\n",
" assert eye.tests.test_basics.__complete__ is True"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Partially loaded notebooks contain an `Exception` on the __complete__ attribute."
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
" import eye.tests.debug\n",
" assert type(eye.tests.debug.__complete__) is AssertionError"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/tonyfast/anaconda/envs/p6/lib/python3.6/site-packages/setuptools/dist.py:360: UserWarning: The version specified ('0.0.🖕') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.\r\n",
" \"details.\" % self.metadata.version\r\n",
"running pytest\r\n",
"running egg_info\r\n",
"writing eye.egg-info/PKG-INFO\r\n",
"writing dependency_links to eye.egg-info/dependency_links.txt\r\n",
"writing requirements to eye.egg-info/requires.txt\r\n",
"writing top-level names to eye.egg-info/top_level.txt\r\n",
"reading manifest file 'eye.egg-info/SOURCES.txt'\r\n",
"reading manifest template 'MANIFEST.in'\r\n",
"writing manifest file 'eye.egg-info/SOURCES.txt'\r\n",
"running build_ext\r\n",
"\u001b[1m============================= test session starts ==============================\u001b[0m\r\n",
"platform darwin -- Python 3.6.3, pytest-3.2.1, py-1.4.34, pluggy-0.4.0\r\n",
"rootdir: /Users/tonyfast/eye, inifile:\r\n",
"plugins: ipynb-1.1.0, hypothesis-3.44.6\r\n",
"\u001b[1m\r",
"collecting 0 items \u001b[0m\u001b[1m\r",
"collecting 5 items \u001b[0m\u001b[1m\r",
"collecting 7 items \u001b[0m\u001b[1m\r",
"collecting 10 items \u001b[0m\u001b[1m\r",
"collecting 12 items \u001b[0m\u001b[1m\r",
"collecting 17 items \u001b[0m\u001b[1m\r",
"collected 17 items \u001b[0m\r\n",
"\r\n",
"eye/tests/test_basics.ipynb .....\r\n",
"eye/tests/test_debug.ipynb ..\r\n",
"eye/tests/test_from_file.ipynb ...\r\n",
"eye/tests/test_md_import.ipynb ..\r\n",
"eye/tests/test_ordering.ipynb .....\r\n",
"\r\n",
"\u001b[32m\u001b[1m========================== 17 passed in 10.01 seconds ==========================\u001b[0m\r\n",
"[NbConvertApp] Converting notebook readme.ipynb to markdown\r\n",
"[NbConvertApp] Writing 1135 bytes to readme.md\r\n"
]
}
],
"source": [
" if __name__ == '__main__':\n",
" # !source activate p6 && python setup.py develop\n",
" !source activate p6 && python setup.py pytest\n",
" !jupyter nbconvert --to markdown --TemplateExporter.exclude_output=True readme.ipynb"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "p6",
"language": "python",
"name": "other-env"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}