-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
executable file
·56 lines (39 loc) · 1.38 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
import os
import glob
from setuptools import setup, Command
class BuildNotes(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import os
import shutil
import tempfile
from IPython.nbconvert.nbconvertapp import NbConvertApp
import sys
for arg in range(len(sys.argv[1:])):
sys.argv.pop(-1)
# First convert the lecture notes to slides - we have to do them
# individually in order to be able to specify a custom output prefix for
# each.
app = NbConvertApp()
app.initialize()
app.export_format = 'slides'
app.config.Exporter.template_file = 'config/slides.tpl'
for notebook in glob.glob('lectures/*.ipynb'):
app.notebooks = [notebook]
app.output_base = notebook.replace('.ipynb', '')
app.start()
# Now convert the lecture notes, problem sets, and practice problems to
# HTML notebooks.
app = NbConvertApp()
app.initialize()
app.export_format = 'html'
for notebook in glob.glob('lectures/*.ipynb'):
app.notebooks = [notebook]
app.output_base = notebook.replace('.ipynb', '')
app.start()
setup(name='python-course', cmdclass={'build': BuildNotes})