-
Notifications
You must be signed in to change notification settings - Fork 2
/
justfile
74 lines (60 loc) · 1.74 KB
/
justfile
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
uv := `which uv`
charmcraft := `which charmcraft`
project_dir := justfile_directory()
src := project_dir / "src"
tests := project_dir / "tests"
lib := project_dir / "lib/charms/filesystem_client"
all := src + " " + tests + " " + lib
export PYTHONPATH := project_dir + ":" + project_dir / "lib" + ":" + src
export PY_COLORS := "1"
export PYTHONBREAKPOINT := "pdb.set_trace"
uv_run := "uv run --frozen --extra dev"
# Regenerate uv.lock.
lock:
uv lock --no-cache
# Fetch the required charm libraries.
fetch-libs:
charmcraft fetch-libs
# Create a development environment.
env: lock fetch-libs
uv sync --extra dev
# Upgrade uv.lock with the latest deps
upgrade:
uv lock --upgrade --no-cache
# Generate requirements.txt from pyproject.toml
requirements: lock
uv export --frozen --no-hashes --format=requirements-txt -o requirements.txt
# Apply coding style standards to code
fmt: lock
{{uv_run}} ruff format {{all}}
{{uv_run}} ruff check --fix {{all}}
# Check code against coding style standards
lint: lock fetch-libs
{{uv_run}} codespell {{lib}}
{{uv_run}} codespell {{project_dir}}
{{uv_run}} ruff check {{all}}
{{uv_run}} ruff format --check --diff {{all}}
# Run static type checks
typecheck *args: lock fetch-libs
{{uv_run}} pyright {{args}}
# Run unit tests
unit *args: lock fetch-libs
{{uv_run}} coverage run \
--source={{src}} \
--source={{lib}} \
-m pytest \
--tb native \
-v \
-s \
{{args}} \
{{tests}}/unit
{{uv_run}} coverage report
# Run integration tests
integration *args: lock fetch-libs
{{uv_run}} pytest \
-v \
-s \
--tb native \
--log-cli-level=INFO \
{{args}} \
{{tests}}/integration