-
Notifications
You must be signed in to change notification settings - Fork 1
/
Taskfile.yml
139 lines (121 loc) · 3.62 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
version: "3"
tasks:
pull_grammar:
cmds:
# - curl -L https://github.com/python/cpython/raw/main/Grammar/python.gram > tasks/python.gram
- curl -L https://github.com/we-like-parsers/pegen/raw/main/data/python.gram > tasks/python.gram
generate-meta:
cmds:
- git checkout pegen/grammar_parser.py
- python3 -m pegen pegen/metagrammar.gram -o pegen/grammar_parser.py
- ruff format pegen/grammar_parser.py
generate:
deps:
- dev
cmds:
- python3 tasks/generator.py
- ruff check --fix peg_parser/parser.py
- ruff format peg_parser/parser.py
- scc peg_parser/parser.py --uloc
- ls -lh peg_parser/parser.py
generates:
- peg_parser/parser.py
sources:
- tasks/*.py
- tasks/*.gram
- pegen/*.py
check-duplicates:
cmds:
- pylint --enable=R0801 --disable=W,C,R0916,R0911,R0912,R0904 --min-similarity-lines=1 peg_parser/parser.py
- jscpd peg_parser/parser.py
profile-tasks:
cmds:
- python tasks/profile_mem.py | tee -a {{.LOG_FILE}}
- python tasks/simple.py | tee -a {{.LOG_FILE}}
vars:
LOG_FILE:
sh: echo ".local/logs/xonsh-parser-$(date "+%Y%m%d-%H%M%S").$(git rev-parse --short HEAD).log"
dev:
cmds:
- cd xonsh_tokenizer; maturin develop
profile:
# deps:
# - profile-tasks
cmds:
- mkdir -p .local/logs
- asv run --python=same --show-stderr | tee -a {{.LOG_FILE}}
# - asv profile --python=same benchmarks.PeakMemSuite.peakmem_parser_large_file | tee -a {{.LOG_FILE}}
vars:
LOG_FILE:
sh: echo ".local/logs/xonsh-parser-$(date "+%Y%m%d-%H%M%S").$(git rev-parse --short HEAD).log"
ply-add:
cmds:
- git subtree add --prefix=ply --squash
pegen-add:
cmds:
- git fetch https://github.com/we-like-parsers/pegen.git main:tmp-pegen-main --no-tags --depth 1
- git show tmp-pegen-main:data/python.gram > .local/python.gram
- git read-tree --prefix=pegen -u tmp-pegen-main:src/pegen
test:
deps:
- generate
cmds:
- python -m pytest {{.CLI_ARGS}}
# sources:
# - '**/*.py'
test-cov:
cmd: task test -- --cov=peg_parser --cov-report=html
wtest:
cmds:
- watchexec -e py,gram --clear -- task test -- --ff -x -vv --testmon
asv-bench:
cmds:
- asv run "main^!" -v
- asv publish
- asv preview
memray:
cmds:
- pytest --memray
mypy1:
cmds:
- mypy peg_parser
mypy:
cmds:
- watchexec -e py,toml,gram --clear -- task generate mypy1
build_dep:
cmds:
- pip install setuptools_scm wheel
mypycify:
deps:
- build_dep
cmds:
- env COMPILE_WITH_MYPYC=1 pip install -e . --no-build-isolation
sources:
- peg_parser/subheader.py
- peg_parser/toke*.py
cythonize:
deps:
- build_dep
cmds:
- env COMPILE_WITH_CYTHON=1 pip install -e . --no-build-isolation
sources:
- peg_parser/*.py
- peg_parser/*.pxd
clean:
cmds:
- find peg_parser -name "*.so" -delete -print
- find peg_parser -name "*.c" -delete -print
- find peg_parser -name "*.html" -delete -print
release:
# https://python-semantic-release.readthedocs.io/en/latest/commands.html
cmds:
- semantic-release version --no-vcs-release {{.CLI_ARGS}}
- git push --follow-tags
pytest-bench:
cmds:
# - cd ~/src/rust/xonsh-rd-parser && maturin develop --release
# --benchmark-histogram
- pytest tests/benchmarks.py --benchmark-only --benchmark-autosave {{.CLI_ARGS}} | tee -a pytest-bench.log
pytest-bench-compare:
cmds:
- pytest-benchmark compare