Skip to content

Commit 4ca8cf2

Browse files
authored
Merge pull request #1945 from cachix/claude/issue-1913-20250623_133810
feat: add groups option for Python uv dependency groups
2 parents 2668b24 + 92b2d57 commit 4ca8cf2

File tree

5 files changed

+76
-0
lines changed

5 files changed

+76
-0
lines changed

docs/reference/options.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14709,6 +14709,27 @@ list of string
1470914709

1471014710

1471114711

14712+
*Default:*
14713+
` [ ] `
14714+
14715+
*Declared by:*
14716+
- [https://github.com/cachix/devenv/blob/main/src/modules/languages/python.nix](https://github.com/cachix/devenv/blob/main/src/modules/languages/python.nix)
14717+
14718+
14719+
14720+
## languages.python.uv.sync.groups
14721+
14722+
14723+
14724+
Which dependency groups to install. See ` --group `.
14725+
14726+
14727+
14728+
*Type:*
14729+
list of string
14730+
14731+
14732+
1471214733
*Default:*
1471314734
` [ ] `
1471414735

docs/supported-languages/python.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,24 @@ list of string
474474

475475

476476

477+
## languages\.python\.uv\.sync\.groups
478+
479+
480+
481+
Which dependency groups to install\. See ` --group `\.
482+
483+
484+
485+
*Type:*
486+
list of string
487+
488+
489+
490+
*Default:*
491+
` [ ] `
492+
493+
494+
477495
## languages\.python\.venv\.enable
478496

479497

src/modules/languages/python.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ let
134134
UV_SYNC_COMMAND+=(--all-extras)
135135
''}
136136
137+
# Add groups if specified
138+
${lib.concatMapStrings (group: ''
139+
UV_SYNC_COMMAND+=(--group "${group}")
140+
'') cfg.uv.sync.groups}
141+
137142
# Avoid running "uv sync" for every shell.
138143
# Only run it when the "pyproject.toml" file or Python interpreter has changed.
139144
local ACTUAL_UV_CHECKSUM="${package.interpreter}:$(${pkgs.nix}/bin/nix-hash --type sha256 pyproject.toml):''${UV_SYNC_COMMAND[@]}"
@@ -333,6 +338,11 @@ in
333338
default = false;
334339
description = "Whether to install all extras. See `--all-extras`.";
335340
};
341+
groups = lib.mkOption {
342+
type = lib.types.listOf lib.types.str;
343+
default = [ ];
344+
description = "Which dependency groups to install. See `--group`.";
345+
};
336346
};
337347
};
338348

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{ pkgs, config, inputs, ... }: {
2+
languages.python = {
3+
enable = true;
4+
venv.enable = true;
5+
uv = {
6+
enable = true;
7+
sync = {
8+
enable = true;
9+
groups = [ "test" "docs" ];
10+
};
11+
};
12+
};
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "python-uv-sync-groups"
7+
version = "0.1.0"
8+
description = "Test project for uv sync with dependency groups"
9+
authors = [{ name = "Claude", email = "[email protected]" }]
10+
dependencies = ["requests"]
11+
12+
[dependency-groups]
13+
test = ["pytest", "pytest-cov"]
14+
docs = ["sphinx", "sphinx-rtd-theme"]

0 commit comments

Comments
 (0)