-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevenv.nix
More file actions
88 lines (75 loc) · 1.98 KB
/
Copy pathdevenv.nix
File metadata and controls
88 lines (75 loc) · 1.98 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
{
pkgs,
lib,
config,
inputs,
...
}:
{
packages = [
pkgs.git
pkgs.libusb1
pkgs.taplo
];
env.LD_LIBRARY_PATH = lib.makeLibraryPath [
pkgs.libusb1
];
languages.python = {
enable = true;
version = "3.13";
uv.enable = true;
uv.sync.enable = true;
uv.sync.groups = [ "dev" ];
};
env.SOURCE_DIRS = "src/simple_safe tests";
scripts.autofix.exec = ''
set -eux
uv run -q ruff check --fix
uv run -q ruff check --fix --select I $SOURCE_DIRS
'';
scripts.build.exec = ''
set -eux
rm -f ./dist/*.whl ./dist/*.tar.gz
uv build
echo -e "\n$(ls ./dist/*.tar.gz)" \
&& tar -ztf ./dist/*.tar.gz | sort
echo -e "\n$(ls ./dist/*.whl)" \
&& wheel2json ./dist/*.whl | jq -r '.dist_info.record.[].path' | sort
'';
scripts.check.exec = ''
set -eux
uv run -q ruff check $SOURCE_DIRS
uv run -q pyright $SOURCE_DIRS
'';
scripts.format.exec = ''
set -eux
uv run -q ruff check --fix --select I $SOURCE_DIRS
uv run -q ruff format $SOURCE_DIRS
RUST_LOG=warn taplo fmt pyproject.toml
'';
scripts.lint.exec = ''
set -eux
uv run -q ruff check --diff --select I $SOURCE_DIRS
uv run -q ruff format --check --diff $SOURCE_DIRS
RUST_LOG=warn taplo fmt --check --diff pyproject.toml
'';
scripts.profile.exec = ''
set -eux
IMPORT_LOG=$(mktemp)
uv run -q python -X importtime -m simple_safe.safe 2>$IMPORT_LOG
uv run -q tuna $IMPORT_LOG
'';
env.PYTHON_VERSIONS = "3.11 3.12 3.13";
env.PYTEST_COMMAND = "pytest -l -s -v --no-header --disable-warnings ./tests";
scripts.runtests.exec = "uv run -q $PYTEST_COMMAND";
scripts.runtests-multi.exec = ''
UV_PYTHON_DOWNLOADS=automatic # disabled by devenv/Nix
for PYTHON_VERSION in $PYTHON_VERSIONS; do
uv run -q --python $PYTHON_VERSION $PYTEST_COMMAND
done
'';
scripts.pyinstall.exec = ''
uv python install $PYTHON_VERSIONS
'';
# See full reference at https://devenv.sh/reference/options/
}