@@ -25,33 +25,37 @@ dev-py3: clean setup-py3
25
25
26
26
.PHONY : setup
27
27
setup :
28
- python -m ensurepip
28
+ - python -m ensurepip
29
29
python -m pip install --upgrade setuptools wheel pip pytest_remotedata cython
30
30
31
31
.PHONY : setup-py2
32
32
setup-py2 :
33
- python2 -m ensurepip
33
+ - python2 -m ensurepip
34
34
python2 -m pip install --upgrade " setuptools<58" wheel pip pytest_remotedata cython
35
35
36
36
.PHONY : setup-py3
37
37
setup-py3 :
38
- python3 -m ensurepip
38
+ - python3 -m ensurepip
39
39
python3 -m pip install --upgrade setuptools wheel pip pytest_remotedata cython
40
40
41
41
.PHONY : setup-pypy
42
42
setup-pypy :
43
- pypy -m ensurepip
43
+ - pypy -m ensurepip
44
44
pypy -m pip install --upgrade " setuptools<58" wheel pip pytest_remotedata
45
45
46
46
.PHONY : setup-pypy3
47
47
setup-pypy3 :
48
- pypy3 -m ensurepip
48
+ - pypy3 -m ensurepip
49
49
pypy3 -m pip install --upgrade setuptools wheel pip pytest_remotedata
50
50
51
51
.PHONY : install
52
52
install : setup
53
53
python -m pip install -e .[tests]
54
54
55
+ .PHONY : install-purepy
56
+ install-purepy : setup
57
+ python -m pip install --no-deps --upgrade -e . " pyparsing<3"
58
+
55
59
.PHONY : install-py2
56
60
install-py2 : setup-py2
57
61
python2 -m pip install -e .[tests]
@@ -127,39 +131,54 @@ test-pypy3: clean
127
131
pypy3 ./coconut/tests/dest/runner.py
128
132
pypy3 ./coconut/tests/dest/extras.py
129
133
134
+ # same as test-univ but reverses any ofs
135
+ .PHONY : test-any-of
136
+ test-any-of : export COCONUT_ADAPTIVE_ANY_OF=TRUE
137
+ test-any-of : export COCONUT_REVERSE_ANY_OF=TRUE
138
+ test-any-of : test-univ
139
+
130
140
# same as test-univ but also runs mypy
131
141
.PHONY : test-mypy-univ
132
142
test-mypy-univ : export COCONUT_USE_COLOR=TRUE
133
143
test-mypy-univ : clean
134
- python ./coconut/tests --strict --force -- keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
144
+ python ./coconut/tests --strict --keep-lines --force --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
135
145
python ./coconut/tests/dest/runner.py
136
146
python ./coconut/tests/dest/extras.py
137
147
138
148
# same as test-mypy-univ but uses --target sys
139
149
.PHONY : test-mypy
140
150
test-mypy : export COCONUT_USE_COLOR=TRUE
141
151
test-mypy : clean
142
- python ./coconut/tests --strict --force --target sys --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
152
+ python ./coconut/tests --strict --keep-lines -- force --target sys --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
143
153
python ./coconut/tests/dest/runner.py
144
154
python ./coconut/tests/dest/extras.py
145
155
146
156
# same as test-mypy but doesn't use --force
147
157
.PHONY : test-mypy-tests
148
158
test-mypy-tests : export COCONUT_USE_COLOR=TRUE
149
159
test-mypy-tests : clean-no-tests
150
- python ./coconut/tests --strict --target sys -- keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
160
+ python ./coconut/tests --strict --keep-lines --target sys --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
151
161
python ./coconut/tests/dest/runner.py
152
162
python ./coconut/tests/dest/extras.py
153
163
154
164
# same as test-univ but includes verbose output for better debugging
165
+ # regex for getting non-timing lines: ^(?!\s*(Time|Packrat|Loaded|Saving|Adaptive|Errorless|Grammar|Failed|Incremental|Pruned)\s)[^\n]*\n*
155
166
.PHONY : test-verbose
156
167
test-verbose : export COCONUT_USE_COLOR=TRUE
157
168
test-verbose : clean
158
169
python ./coconut/tests --strict --keep-lines --force --verbose
159
170
python ./coconut/tests/dest/runner.py
160
171
python ./coconut/tests/dest/extras.py
161
172
162
- # same as test-univ but includes verbose output for better debugging and is fully synchronous
173
+ # same as test-verbose but doesn't use the incremental cache
174
+ .PHONY : test-verbose-no-cache
175
+ test-verbose-no-cache : export COCONUT_USE_COLOR=TRUE
176
+ test-verbose-no-cache : clean
177
+ python ./coconut/tests --strict --keep-lines --force --verbose --no-cache
178
+ python ./coconut/tests/dest/runner.py
179
+ python ./coconut/tests/dest/extras.py
180
+
181
+ # same as test-verbose but is fully synchronous
163
182
.PHONY : test-verbose-sync
164
183
test-verbose-sync : export COCONUT_USE_COLOR=TRUE
165
184
test-verbose-sync : clean
@@ -171,15 +190,15 @@ test-verbose-sync: clean
171
190
.PHONY : test-mypy-verbose
172
191
test-mypy-verbose : export COCONUT_USE_COLOR=TRUE
173
192
test-mypy-verbose : clean
174
- python ./coconut/tests --strict --force --target sys --verbose --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
193
+ python ./coconut/tests --strict --keep-lines -- force --target sys --verbose --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
175
194
python ./coconut/tests/dest/runner.py
176
195
python ./coconut/tests/dest/extras.py
177
196
178
197
# same as test-mypy but uses --check-untyped-defs
179
198
.PHONY : test-mypy-all
180
199
test-mypy-all : export COCONUT_USE_COLOR=TRUE
181
200
test-mypy-all : clean
182
- python ./coconut/tests --strict --force --target sys --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition --check-untyped-defs
201
+ python ./coconut/tests --strict --keep-lines -- force --target sys --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition --check-untyped-defs
183
202
python ./coconut/tests/dest/runner.py
184
203
python ./coconut/tests/dest/extras.py
185
204
@@ -192,9 +211,14 @@ test-easter-eggs: clean
192
211
python ./coconut/tests/dest/extras.py
193
212
194
213
# same as test-univ but uses python pyparsing
195
- .PHONY : test-pyparsing
196
- test-pyparsing : export COCONUT_PURE_PYTHON=TRUE
197
- test-pyparsing : test-univ
214
+ .PHONY : test-purepy
215
+ test-purepy : export COCONUT_PURE_PYTHON=TRUE
216
+ test-purepy : test-univ
217
+
218
+ # same as test-univ but disables the computation graph
219
+ .PHONY : test-no-computation-graph
220
+ test-no-computation-graph : export COCONUT_USE_COMPUTATION_GRAPH=FALSE
221
+ test-no-computation-graph : test-univ
198
222
199
223
# same as test-univ but uses --minify
200
224
.PHONY : test-minify
@@ -217,30 +241,60 @@ test-no-wrap: clean
217
241
test-watch : export COCONUT_USE_COLOR=TRUE
218
242
test-watch : clean
219
243
python ./coconut/tests --strict --keep-lines --force
220
- coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest -- watch --strict --keep-lines --stack-size 4096 --recursion-limit 4096
244
+ make just- watch
221
245
python ./coconut/tests/dest/runner.py
222
246
python ./coconut/tests/dest/extras.py
223
247
224
- # mini test that just compiles agnostic tests with fully synchronous output
248
+ # just watches tests
249
+ .PHONY : just-watch
250
+ just-watch : export COCONUT_USE_COLOR=TRUE
251
+ just-watch :
252
+ coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --watch --strict --keep-lines --stack-size 4096 --recursion-limit 4096
253
+
254
+ # same as just-watch but uses verbose output and is fully sychronous and doesn't use the cache
255
+ .PHONY : just-watch-verbose
256
+ just-watch-verbose : export COCONUT_USE_COLOR=TRUE
257
+ just-watch-verbose :
258
+ coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --watch --strict --keep-lines --stack-size 4096 --recursion-limit 4096 --verbose --jobs 0 --no-cache
259
+
260
+ # mini test that just compiles agnostic tests
225
261
.PHONY : test-mini
262
+ test-mini : export COCONUT_USE_COLOR=TRUE
226
263
test-mini :
227
- coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --jobs 0 --stack-size 4096 --recursion-limit 4096
264
+ coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --stack-size 4096 --recursion-limit 4096
265
+
266
+ # same as test-mini but with verbose output
267
+ .PHONY : test-mini-verbose
268
+ test-mini-verbose : export COCONUT_USE_COLOR=TRUE
269
+ test-mini-verbose :
270
+ coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --verbose --stack-size 4096 --recursion-limit 4096
271
+
272
+ # same as test-mini-verbose but doesn't overwrite the cache
273
+ .PHONY : test-mini-cache
274
+ test-mini-cache : export COCONUT_ALLOW_SAVE_TO_CACHE=FALSE
275
+ test-mini-cache : test-mini-verbose
276
+
277
+ # same as test-mini-verbose but with fully synchronous output and fast failing
278
+ .PHONY : test-mini-sync
279
+ test-mini-sync : export COCONUT_USE_COLOR=TRUE
280
+ test-mini-sync :
281
+ coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --verbose --jobs 0 --fail-fast --stack-size 4096 --recursion-limit 4096
228
282
229
283
# same as test-univ but debugs crashes
230
284
.PHONY : test-univ-debug
231
285
test-univ-debug : export COCONUT_TEST_DEBUG_PYTHON=TRUE
232
286
test-univ-debug : test-univ
233
287
234
- # same as test-mini but debugs crashes
288
+ # same as test-mini but debugs crashes, is fully synchronous, and doesn't use verbose output
235
289
.PHONY : test-mini-debug
236
290
test-mini-debug : export COCONUT_USE_COLOR=TRUE
237
291
test-mini-debug :
238
292
python -X dev -m coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --strict --keep-lines --force --jobs 0 --stack-size 4096 --recursion-limit 4096
239
293
240
294
# same as test-mini-debug but uses vanilla pyparsing
241
- .PHONY : test-mini-debug-pyparsing
242
- test-mini-debug-pyparsing : export COCONUT_PURE_PYTHON=TRUE
243
- test-mini-debug-pyparsing : test-mini-debug
295
+ .PHONY : test-mini-debug-purepy
296
+ test-mini-debug-purepy : export COCONUT_PURE_PYTHON=TRUE
297
+ test-mini-debug-purepy : test-mini-debug
244
298
245
299
.PHONY : debug-test-crash
246
300
debug-test-crash :
@@ -266,16 +320,16 @@ clean-no-tests:
266
320
.PHONY : clean
267
321
clean : clean-no-tests
268
322
rm -rf ./coconut/tests/dest
323
+ -find . -name " __coconut_cache__" -type d -prune -exec rm -rf ' {}' +
324
+ -powershell -Command " get-childitem -Include __coconut_cache__ -Recurse -force | Remove-Item -Force -Recurse"
269
325
270
326
.PHONY : wipe
271
327
wipe : clean
272
328
rm -rf ./coconut/tests/dest vprof.json profile.log * .egg-info
273
- -find . -name " __pycache__" -delete
274
- -C:/GnuWin32/bin/find.exe . -name " __pycache__" -delete
275
- -find . -name " __coconut_cache__" -delete
276
- -C:/GnuWin32/bin/find.exe . -name " __coconut_cache__" -delete
329
+ -find . -name " __pycache__" -type d -prune -exec rm -rf ' {}' +
330
+ -powershell -Command " get-childitem -Include __pycache__ -Recurse -force | Remove-Item -Force -Recurse"
277
331
-find . -name " *.pyc" -delete
278
- -C:/GnuWin32/bin/find.exe . -name " *.pyc" -delete
332
+ -powershell -Command " get-childitem -Include *.pyc -Recurse -force | Remove-Item -Force -Recurse "
279
333
-python -m coconut --site-uninstall
280
334
-python3 -m coconut --site-uninstall
281
335
-python2 -m coconut --site-uninstall
@@ -302,20 +356,45 @@ upload: wipe dev just-upload
302
356
check-reqs :
303
357
python ./coconut/requirements.py
304
358
305
- .PHONY : profile-parser
306
- profile-parser : export COCONUT_USE_COLOR=TRUE
307
- profile-parser : export COCONUT_PURE_PYTHON=TRUE
308
- profile-parser :
309
- coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --profile --verbose --stack-size 4096 --recursion-limit 4096 2>&1 | tee ./profile.log
310
-
311
- .PHONY : profile-time
312
- profile-time :
313
- vprof -c h " ./coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --stack-size 4096 --recursion-limit 4096" --output-file ./vprof.json
314
-
315
- .PHONY : profile-memory
316
- profile-memory :
317
- vprof -c m " ./coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --stack-size 4096 --recursion-limit 4096" --output-file ./vprof.json
318
-
319
- .PHONY : view-profile
320
- view-profile :
359
+ .PHONY : profile
360
+ profile : export COCONUT_USE_COLOR=TRUE
361
+ profile :
362
+ coconut ./coconut/tests/src/cocotest/agnostic/util.coco ./coconut/tests/dest/cocotest --force --jobs 0 --profile --verbose --stack-size 4096 --recursion-limit 4096 2>&1 | tee ./profile.log
363
+
364
+ .PHONY : open-speedscope
365
+ open-speedscope :
366
+ npm install -g speedscope
367
+ speedscope ./profile.speedscope
368
+
369
+ .PHONY : pyspy
370
+ pyspy :
371
+ py-spy record -o profile.speedscope --format speedscope --subprocesses --rate 75 -- python -m coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force
372
+ make open-speedscope
373
+
374
+ .PHONY : pyspy-purepy
375
+ pyspy-purepy : export COCONUT_PURE_PYTHON=TRUE
376
+ pyspy-purepy : pyspy
377
+
378
+ .PHONY : pyspy-native
379
+ pyspy-native :
380
+ py-spy record -o profile.speedscope --format speedscope --native --rate 75 -- python -m coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --jobs 0
381
+ make open-speedscope
382
+
383
+ .PHONY : pyspy-runtime
384
+ pyspy-runtime :
385
+ py-spy record -o runtime_profile.speedscope --format speedscope -- python ./coconut/tests/dest/runner.py
386
+ speedscope ./runtime_profile.speedscope
387
+
388
+ .PHONY : vprof-time
389
+ vprof-time :
390
+ vprof -c h " ./coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --jobs 0 --stack-size 4096 --recursion-limit 4096" --output-file ./vprof.json
391
+ make view-vprof
392
+
393
+ .PHONY : vprof-memory
394
+ vprof-memory :
395
+ vprof -c m " ./coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --jobs 0 --stack-size 4096 --recursion-limit 4096" --output-file ./vprof.json
396
+ make view-vprof
397
+
398
+ .PHONY : view-vprof
399
+ view-vprof :
321
400
vprof --input-file ./vprof.json
0 commit comments