-
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathtasks.py
More file actions
52 lines (39 loc) · 1.24 KB
/
Copy pathtasks.py
File metadata and controls
52 lines (39 loc) · 1.24 KB
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
import shutil
from invoke import task
@task
def build(c):
"""Build the distribution packages."""
c.run('uv build')
@task
def clean(c):
"""Remove build artifacts."""
for path in ('build', 'dist'):
shutil.rmtree(path, ignore_errors=True)
@task
def docs(c):
"""Build the HTML documentation."""
c.run('uv sync --group dev')
c.run('uv run sphinx-build -b html -a -E -v docs/source docs/html')
@task(help={'coverage': 'Measure test coverage and print a report.'})
def tests(c, coverage=False):
"""Run unit tests."""
if coverage:
c.run('uv run python -m coverage run -m unittest -v', pty=True)
c.run('uv run python -m coverage report')
else:
c.run('uv run python -m unittest -v', pty=True)
@task(aliases=['checktypes'])
def typechecks(c):
"""Run mypy static type checks."""
c.run('uv run mypy')
@task(pre=[build])
def release(c):
"""Tag and push the current version as a release."""
version = c.run(
'uv run python -c "import rule_engine; print(rule_engine.__version__)"',
dry=False,
hide=True
).stdout.strip()
release_tag = 'v' + version
c.run('git tag -sm "Version {0}" {1}'.format(version, release_tag))
c.run('git push --tags')