This repository has been archived by the owner on Jul 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Taskfile.yml
187 lines (156 loc) · 6.34 KB
/
Taskfile.yml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
version: "3"
env:
SELENIUM_HUB_HOST: 127.0.0.1
SELENIUM_HUB_PORT: 4444
PYTEST_BASE_URL: http://localhost:8866
PYTEST_M: ""
PYTEST_K: ""
tasks:
# ----------------------------------------------------------------------------
# Python
build:
dir: python
cmds:
- hatch build
check:
dir: python
ignore_error: true
cmds:
- isort . --check-only --diff
- black . --check
- ruff check jupyter_flex
- flake8
fmt:
dir: python
ignore_error: true
cmds:
- isort .
- black .
- ruff check --fix jupyter_flex
lockfiles:
dir: python
cmds:
- pip-compile -q --resolver=backtracking -o requirements/pyproject.txt pyproject.toml --extra=test
- pip-compile -q --resolver=backtracking -o requirements/pyproject-docs.txt pyproject.toml --extra=test --extra=docs
- pip-compile -q --resolver=backtracking -o requirements/linting.txt requirements/linting.in
- pip-compile -q --resolver=backtracking -o requirements/examples.txt requirements/examples.in
# Convert one notebook using nbconvert
nbconvert-example:
cmds:
- jupyter-nbconvert examples/layouts/customize/classes-colors.ipynb --to=flex --output-dir docs/examples/layouts/customize --execute
# --ExecutePreprocessor.store_widget_state=True
# --ExecutePreprocessor.allow_errors=True
# Serve examples using voila
voila-examples:
dir: examples
cmds:
- voila --template flex --VoilaConfiguration.file_whitelist '.*'
# Download 3rd-party assets
download-assets:
cmds:
- curl -o python/share/jupyter/nbconvert/templates/flex/static/require.min.js https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js
download-testdata:
dir: python
cmds:
- bokeh sampledata
# ----------------------------------------------------------------------------
# Testing
pytest:
dir: python
cmds:
- pytest -k "$PYTEST_K" -m "$PYTEST_M" --splinter-webdriver remote --splinter-remote-url $SELENIUM_HUB_HOST --html=test-results/report.html --self-contained-html
pytest-all:
dir: python
cmds:
- pytest --splinter-webdriver remote --splinter-remote-url $SELENIUM_HUB_HOST --html=test-results/report.html --self-contained-html
pytest-report:
dir: python
cmds:
- coverage xml
- coverage html
selenium-server:
cmds:
- selenium-server standalone --port $SELENIUM_HUB_PORT --host 0.0.0.0
selenium-docker:
cmds:
- docker-compose up
# ----------------------------------------------------------------------------
# Docs
docs:
cmds:
- task: docs-examples-html
- mkdocs build
- task: docs-example-exec-nbs
docs-serve:
cmds:
- mkdocs serve
# Convert examples to HTML dashboards and saves them into the docs source directory
docs-examples-html:
dir: examples
cmds:
- rm -rf ../docs/examples;
- jupyter-nbconvert *.ipynb --output-dir=../docs/examples --to=flex --execute --ExecutePreprocessor.store_widget_state=True --ExecutePreprocessor.allow_errors=True
- jupyter-nbconvert docs/*.ipynb --output-dir=../docs/examples --to=flex --execute --ExecutePreprocessor.store_widget_state=True
- jupyter-nbconvert layouts/*.ipynb --output-dir=../docs/examples --to=flex --execute --ExecutePreprocessor.store_widget_state=True
- jupyter-nbconvert layouts/customize/*.ipynb --output-dir=../docs/examples --to=flex --execute --ExecutePreprocessor.store_widget_state=True
- jupyter-nbconvert plots/*.ipynb --output-dir=../docs/examples --to=flex --execute --ExecutePreprocessor.store_widget_state=True
- jupyter-nbconvert widgets/*.ipynb --output-dir=../docs/examples --to=flex --execute --ExecutePreprocessor.store_widget_state=True
# - jupyter-nbconvert illusionist/*.ipynb --output-dir=../docs/examples/illusionist --to=flex-illusionist --execute --ExecutePreprocessor.store_widget_state=True
# Execute examples notebooks and saves them into the docs output directory
docs-example-exec-nbs:
dir: examples
cmds:
- rm -rf ../site/examples/notebooks
- jupyter-nbconvert *.ipynb --output-dir=$../site/examples/notebooks --to=notebook --execute --ExecutePreprocessor.store_widget_state=True --ExecutePreprocessor.allow_errors=True
- jupyter-nbconvert docs/*.ipynb --output-dir=$../site/examples/notebooks --to=notebook --execute --ExecutePreprocessor.store_widget_state=True
- jupyter-nbconvert layouts/*.ipynb --output-dir=$../site/examples/notebooks --to=notebook --execute --ExecutePreprocessor.store_widget_state=True
- jupyter-nbconvert layouts/customize/*.ipynb --output-dir=$../site/examples/notebooks --to=notebook --execute --ExecutePreprocessor.store_widget_state=True
- jupyter-nbconvert plots/*.ipynb --output-dir=$../site/examples/notebooks --to=notebook --execute --ExecutePreprocessor.store_widget_state=True
- jupyter-nbconvert widgets/*.ipynb --output-dir=$../site/examples/notebooks --to=notebook --execute --ExecutePreprocessor.store_widget_state=True
# - jupyter-nbconvert illusionist/*.ipynb --output-dir=$../site/examples/notebooks/illusionist --to=illusionist-nb --execute --ExecutePreprocessor.store_widget_state=True
cleanall:
cmds:
- task: py-clean
- task: js-clean
- rm -rf site
- rm -rf docs/examples
py-clean:
dir: python
cmds:
- rm -rf .pytest_cache dist htmlcov test-results .ruff_cache
- rm -f .coverage coverage.xml
- find . -type f -name '*.py[co]' -delete
- find . -type d -name __pycache__ -exec rm -rf {} +
- find . -type d -name .ipynb_checkpoints -exec rm -rf {} +
# ----------------------------------------------------------------------------
# Javascript
js-build:
dir: js
cmds:
- npm run build
js-dev:
dir: js
cmds:
- npm run dev
js-install:
dir: js
cmds:
- npm install
js-clean:
cmds:
- task: js-clean-1
- task: js-clean-2
js-clean-1:
dir: js
cmds:
- npm run clean
js-clean-2:
dir: python
cmds:
- cd share/jupyter/nbconvert/templates/flex/static
- cd share/jupyter/nbconvert/templates/flex/static; rm -rf *.js* *.css* *.eot* *.woff* *.svg *.ttf *.txt
js-reset:
dir: js
cmds:
- task: js-clean
- rm -rf node_modules