-
-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathjustfile
More file actions
executable file
·126 lines (89 loc) · 3.5 KB
/
Copy pathjustfile
File metadata and controls
executable file
·126 lines (89 loc) · 3.5 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
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
#!/usr/bin/env -S just --justfile
# ^ A shebang isn't required, but allows a justfile to be executed
# like a script, with `./justfile lint`, for example.
# Use powershell for Windows so that 'Git Bash' and 'PyCharm Terminal' get the same result
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
src_dir := "aerich"
project_name := file_name(justfile_directory())
checkfiles := "tests/ conftest.py " + src_dir
pytest_opts := "--cov-append --tb=native -q --cov=" + src_dir
test_db := "/test_\\{\\}"
mysql_url := "mysql://root:" + env_var_or_default("MYSQL_PASS", "123456") + "@" + env_var_or_default("MYSQL_HOST", "127.0.0.1") + ":" + env_var_or_default("MYSQL_PORT", "3306") + test_db
postgres_test_uri := env_var_or_default("POSTGRES_USER", "postgres") + ":" + env_var_or_default("POSTGRES_PASS", "123456") + "@" + env_var_or_default("POSTGRES_HOST", "127.0.0.1") + ":" + env_var_or_default("POSTGRES_PORT", "5432") + test_db
postgres_url := "postgres://" + postgres_test_uri
psycopg_url := "psycopg://" + postgres_test_uri
default:
@just --list
up *args:
uv lock --upgrade {{ args }}
deps *args:
uv sync --reinstall-package {{ project_name }} --all-extras --all-groups --no-extra asyncmy --no-group=vector {{ args }}
_style *args:
just _ruff format {{ checkfiles }} {{ args }}
just _ruff check {{ checkfiles }} --fix {{ args }}
_run *args:
uv run --frozen {{ args }}
[unix]
_ruff command *args:
@just _run ruff {{ command }} {{ args }}
[windows]
_ruff command *args:
@just _run ruff {{ command }} --force-exclude --exclude tests/assets {{ args }}
style: deps _style
_codeqc:
@just _run ty check {{ checkfiles }}
@just _run bandit -c pyproject.toml -r {{ checkfiles }}
@just _run twine check dist/*
codeqc: build _codeqc
_build:
uv build --offline
_check: _build
just _ruff format {{ checkfiles }} --check
just _ruff check {{ checkfiles }}
just _codeqc
check: deps _check
_lint: _build _style _codeqc
lint: deps _lint
[unix]
_uvx package option *args:
uvx {{ package }} --{{option}}=.venv/bin/python {{ args }}
[windows]
_uvx package option *args:
uvx {{ package }} --{{option}}=.venv/Scripts/python.exe {{ args }}
mypy path=(src_dir) *args:
@just _uvx mypy "python-executable" {{ path }} {{ args }}
pyright path=(src_dir) *args:
@just _uvx pyright "pythonpath" {{ path }} {{ args }}
test *args: deps
just _pytest {{ args }}
test_sqlite:
just _pytest_env TEST_DB "sqlite://:memory:"
test_mysql:
just _pytest_env TEST_DB "{{ mysql_url }}" -vv -s
test_postgres:
just _pytest_env TEST_DB "{{ postgres_url }}" -vv -s
test_postgres_vector:
just _pytest_vector "{{ postgres_url }}" -vv -s tests/test_inspectdb.py::test_inspect_vector
test_psycopg:
just _pytest_env TEST_DB "{{ psycopg_url }}" -vv -s
_pytest *args:
@just _run pytest {{ args }} {{ pytest_opts }}
[unix]
_pytest_env env_name env_value *args:
{{ env_name }}='{{ env_value }}' just _pytest {{ args }}
[windows]
_pytest_env env_name env_value *args:
$env:{{ env_name }} = '{{ env_value }}'; just _pytest {{ args }}
[unix]
_pytest_vector db_url *args:
AERICH_TEST_VECTOR=1 TEST_DB='{{ db_url }}' just _pytest {{ args }}
[windows]
_pytest_vector db_url *args:
$env:AERICH_TEST_VECTOR = '1'; $env:TEST_DB = '{{ db_url }}'; just _run pytest {{ args }} {{ pytest_opts }}
_testall: test_sqlite test_postgres test_mysql
testall: deps _testall
report:
@just _run coverage report -m
build *args: deps
uv build {{ args }}
ci: build _check mypy pyright _testall