-
-
Save ryan-williams/1288bff2f9e05394a94312010da267bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def a():\n", | |
" return 'aaa'" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def b():\n", | |
" return 'bbb'" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "ur-3.7.4", | |
"language": "python", | |
"name": "ur-3.7.4" | |
}, | |
"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.7.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Convert various notebook-based import tests to Python (to additionally test that they work there) | |
set -e | |
for style in abs; do | |
for type in py nb; do | |
name="${style}_${type}" | |
nb="nb_${name}.ipynb" | |
py="py_${name}.py" | |
jupyter nbconvert "$nb" --to python --stdout | \ | |
perl -pe 's/def nb_/def py_/' \ | |
> "$py" | |
done | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ddd(): return 'DDD!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# Import from a notebook: | |
# In[ ]: | |
import ur | |
from a_b import a, b | |
def py_abs_nb(): return a() + b() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# Import from a Python file: | |
# In[ ]: | |
import ur | |
from d import ddd | |
def py_abs_py(): return ddd() + 'yay' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment