|
1 | 1 | import sys |
2 | | -import os |
3 | | -import typing as tp |
4 | 2 |
|
5 | 3 | import invoke |
6 | 4 |
|
| 5 | + |
| 6 | +ARTIFACTS = ( |
| 7 | + '*.egg-info', |
| 8 | + '.hypothesis', |
| 9 | + 'build', |
| 10 | + 'dist', |
| 11 | + 'src/*.so' |
| 12 | +) |
| 13 | + |
| 14 | + |
7 | 15 | @invoke.task |
8 | 16 | def clean(context): |
9 | 17 | '''Clean doc and build artifacts |
10 | 18 | ''' |
11 | | - context.run(f"{sys.executable} setup.py develop --uninstall", echo=True) |
| 19 | + cmd = f'{sys.executable} -m pip uninstall --yes arraykit' |
| 20 | + context.run(cmd, echo=True, pty=True) |
12 | 21 |
|
13 | | - for artifact in ("*.egg-info", "*.so", "build", "dist", ".hypothesis"): |
14 | | - context.run(f"rm -rf {artifact}", echo=True) |
| 22 | + for artifact in sorted(ARTIFACTS): |
| 23 | + context.run(f'rm -rf {artifact}', echo=True, pty=True) |
15 | 24 |
|
16 | | - # context.run("black .", echo=True)@task(clean) |
17 | 25 |
|
18 | | -@invoke.task |
| 26 | +@invoke.task(clean) |
19 | 27 | def build(context): |
20 | | - context.run(f"pip install -r requirements.txt", echo=True) |
21 | | - context.run(f"{sys.executable} setup.py develop", echo=True) |
| 28 | + context.run('pip install -r requirements.txt', echo=True, pty=True) |
| 29 | + context.run(f'{sys.executable} -m pip install .', echo=True, pty=True) |
| 30 | + |
22 | 31 |
|
23 | | -@invoke.task(pre=(clean, build)) |
| 32 | +@invoke.task(build) |
24 | 33 | def test(context): |
25 | 34 | cmd = 'pytest -s --color no --disable-pytest-warnings --tb=native' |
26 | | - context.run(cmd) |
| 35 | + context.run(cmd, echo=True, pty=True) |
27 | 36 |
|
28 | | -@invoke.task(pre=(clean, build)) |
| 37 | + |
| 38 | +@invoke.task(build) |
29 | 39 | def performance(context): |
30 | | - context.run(f"{sys.executable} performance/main.py", echo=True) |
| 40 | + context.run(f'{sys.executable} -m performance', echo=True, pty=True) |
| 41 | + |
31 | 42 |
|
32 | | -@invoke.task(pre=(clean, build)) |
| 43 | +@invoke.task |
33 | 44 | def lint(context): |
34 | 45 | '''Run pylint static analysis. |
35 | 46 | ''' |
36 | | - context.run('pylint -f colorized test performance') |
37 | | - |
| 47 | + cmd = 'pylint -f colorized *.py performance src test' |
| 48 | + context.run(cmd, echo=True, pty=True) |
0 commit comments