Update the local tricks.yml
to run this.
ipython -m deathbeds.2018-07-02-Watch-Testing -- --commands "'ipython -m tests'"
import deathbeds
from pathlib import Path
from IPython.utils.capture import capture_output
from IPython import get_ipython
import os, sys
pattern = '''[0-9]*.ipynb'''
root = Path(deathbeds.__file__).parent
cwd = os.getcwd()
'C:\\Users\\deathbeds\\deathbeds.github.io\\deathbeds'
md_list = lambda str: __import__('IPython').display.Markdown(''.join(f"""* [{str}]({str}) """ for str in str.splitlines()))
<function __main__.<lambda>(str)>
skip = """2018-07-20-Literate-Markdown-Kernel.ipynb
2018-07-06-Revisiting-cadquery-and-ipywidgets-part-1.ipynb
2018-07-17-Extracting-a-blog-roll-for-deathbeds.ipynb
2018-07-13-Supercharged-imarkdown-as-code.md.ipynb
"""
'2018-07-20-Literate-Markdown-Kernel.ipynb\n2018-07-06-Revisiting-cadquery-and-ipywidgets-part-1.ipynb\n2018-07-17-Extracting-a-blog-roll-for-deathbeds.ipynb\n2018-07-13-Supercharged-imarkdown-as-code.md.ipynb\n'
from deathbeds import __Markdown_code_cells
with __Markdown_code_cells.MarkdownImporter(): __import__('deathbeds.2018-07-13-Supercharged-imarkdown-as-code')
os.chdir(root)
notebooks = '\n'.join(object for object in __import__('delegator').run('git ls-files [0-9]*.ipynb').out.splitlines() if object not in skip)
os.chdir(cwd)
try: import cv2
except: notebooks = notebooks.replace("""2018-06-20-OpenCV-and-a-Widget.ipynb\n""", "")
"""pwd doesn't work on windows."""
try: import luigi
except: notebooks = notebooks.replace("""2018-07-03-Luigi-command-line.ipynb\n""", "")
opts = "-c ../tox.ini --doctest-modules --mpl --verbose".split()
['-c', '../tox.ini', '--doctest-modules', '--mpl', '--verbose']
if __name__ == '__main__':
print(Path(sys.argv[-1]).name, Path(sys.argv[-1]).name in notebooks.splitlines())
if (Path(sys.argv[-1]).name in notebooks.splitlines()):
opts += sys.argv[1:-1] + [Path(sys.argv[-1]).name]
elif __name__ == '__main__':
opts += notebooks.splitlines()
try:
os.chdir(str(root))
with capture_output(False, False): raise SystemExit(
__import__('pytest').main(
opts, [__Markdown_code_cells]))
finally: os.chdir(cwd)
kernel-26eb5ae1-baa1-4d15-9026-df8c9b46cfd8.json False
usage: ipykernel_launcher.py [options] [file_or_dir] [file_or_dir] [...] ipykernel_launcher.py: error: unrecognized arguments: --mpl inifile: ../tox.ini rootdir: C:\Users\deathbeds\deathbeds.github.io\deathbeds
An exception has occurred, use %tb to see the full traceback. SystemExit: 2
C:\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py:2971: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D. warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)