forked from ox-vgg/follow-things-around
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (46 loc) · 1.42 KB
/
Makefile
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
## Author: David Miguel Susano Pinto <[email protected]>
##
## Copying and distribution of this file, with or without modification,
## are permitted in any medium without royalty provided the copyright
## notice and this notice are preserved. This file is offered as-is,
## without any warranty.
JQ ?= jq
JUPYTEXT ?= jupytext
## Ideally, we'd have instructions in the .py files so that jupytext
## includes then in the .ipynb files. But seems that jupytext only
## has support to filter/include stuff in the other direction (when
## generating .py from .ipynb). So we hack it this way.
##
## This is approach is particularly problematic because the
## "collapsed_sections" field but that's ok for now.
define NOTEBOOK_METADATA
{ \
"colab": { \
"provenance": [], \
"collapsed_sections": [ \
"7c1gbeVrFHUu" \
], \
"toc_visible": true \
}, \
"kernelspec": { \
"name": "python3", \
"display_name": "Python 3" \
}, \
"language_info": { \
"name": "python" \
}, \
"accelerator": "GPU", \
"gpuClass": "standard" \
}
endef
.PHONY: notebooks
notebooks: \
tracking.ipynb
# In addition to fix the notebook metadata, jupytext also adds the
# lines_to_next_cell in some cell metadata (not sure why). We remove
# them.
%.ipynb: %.py
$(JUPYTEXT) --to ipynb --output - $< \
| $(JQ) '.metadata |= $(NOTEBOOK_METADATA)' \
| $(JQ) 'del(.cells[].metadata.lines_to_next_cell)' \
> $@