Skip to content

Commit e1d5fa0

Browse files
committed
Fix with_dev broken by replacing it with no_default_groups
Signed-off-by: Bernát Gábor <[email protected]>
1 parent 41949da commit e1d5fa0

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,11 @@ Therefore, options like `deps` are ignored (and all others
9595

9696
A list of string that selects, which extra groups you want to install with `uv sync`. By default, it is empty.
9797

98-
### `with_dev`
98+
### `no_default_groups`
9999

100-
A boolean flag to toggle installation of the `uv` development dependencies. By default, it is false.
100+
A boolean flag to toggle installation of the `uv`
101+
[default development groups](https://docs.astral.sh/uv/concepts/projects/dependencies/#default-groups). By default, it
102+
is `true`.
101103

102104
### `dependency_groups`
103105

src/tox_uv/_run_lock.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ def register_config(self) -> None:
3939
super().register_config()
4040
add_extras_to_env(self.conf)
4141
self.conf.add_config(
42-
keys=["with_dev"],
42+
keys=["no_default_groups"],
4343
of_type=bool,
44-
default=False,
45-
desc="Install dev dependencies or not",
44+
default=True,
45+
desc="Install default groups or not",
4646
)
4747
self.conf.add_config(
4848
keys=["dependency_groups"],
@@ -70,14 +70,14 @@ def _setup_env(self) -> None:
7070
for extra in cast("set[str]", sorted(self.conf["extras"])):
7171
cmd.extend(("--extra", extra))
7272
groups = sorted(self.conf["dependency_groups"])
73-
if not (self.conf["with_dev"] or "dev" in groups):
74-
cmd.append("--no-dev")
73+
if self.conf["no_default_groups"] and not groups:
74+
cmd.append("--no-default-groups")
7575
install_pkg = getattr(self.options, "install_pkg", None)
7676
if install_pkg is not None:
7777
cmd.append("--no-install-project")
7878
if self.options.verbosity > 3: # noqa: PLR2004
7979
cmd.append("-v")
80-
for group in sorted(groups):
80+
for group in groups:
8181
cmd.extend(("--group", group))
8282
cmd.extend(self.conf["uv_sync_flags"])
8383
cmd.extend(("-p", self.env_version_spec()))

tests/test_tox_uv_lock.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def test_uv_lock_list_dependencies_command(tox_project: ToxProjectCreator) -> No
5757
"dev",
5858
"--extra",
5959
"type",
60-
"--no-dev",
60+
"--no-default-groups",
6161
"-v",
6262
"-p",
6363
sys.executable,
@@ -120,7 +120,7 @@ def test_uv_lock_command(tox_project: ToxProjectCreator, verbose: str) -> None:
120120
"dev",
121121
"--extra",
122122
"type",
123-
"--no-dev",
123+
"--no-default-groups",
124124
*v_args,
125125
"-p",
126126
sys.executable,
@@ -134,12 +134,12 @@ def test_uv_lock_command(tox_project: ToxProjectCreator, verbose: str) -> None:
134134

135135

136136
@pytest.mark.usefixtures("clear_python_preference_env_var")
137-
def test_uv_lock_with_dev(tox_project: ToxProjectCreator) -> None:
137+
def test_uv_lock_with_default_groups(tox_project: ToxProjectCreator) -> None:
138138
project = tox_project({
139139
"tox.ini": """
140140
[testenv]
141141
runner = uv-venv-lock-runner
142-
with_dev = True
142+
no_default_groups = False
143143
"""
144144
})
145145
execute_calls = project.patch_execute(lambda r: 0 if r.run_id != "venv" else None)
@@ -217,7 +217,7 @@ def test_uv_lock_with_install_pkg(tox_project: ToxProjectCreator, name: str) ->
217217
"--frozen",
218218
"--python-preference",
219219
"system",
220-
"--no-dev",
220+
"--no-default-groups",
221221
"--no-install-project",
222222
"-v",
223223
"-p",
@@ -239,7 +239,7 @@ def test_uv_sync_extra_flags(tox_project: ToxProjectCreator) -> None:
239239
"tox.ini": """
240240
[testenv]
241241
runner = uv-venv-lock-runner
242-
with_dev = true
242+
no_default_groups = false
243243
uv_sync_flags = --no-editable, --inexact
244244
commands = python hello
245245
"""
@@ -292,7 +292,7 @@ def test_uv_sync_extra_flags_toml(tox_project: ToxProjectCreator) -> None:
292292
"tox.toml": """
293293
[env_run_base]
294294
runner = "uv-venv-lock-runner"
295-
with_dev = true
295+
no_default_groups = false
296296
uv_sync_flags = ["--no-editable", "--inexact"]
297297
commands = [["python", "hello"]]
298298
"""

0 commit comments

Comments
 (0)