Skip to content

✨ feat(config): add package = "deps-only" mode#3774

Merged
gaborbernat merged 3 commits intotox-dev:mainfrom
gaborbernat:feat/deps-only-2301
Feb 19, 2026
Merged

✨ feat(config): add package = "deps-only" mode#3774
gaborbernat merged 3 commits intotox-dev:mainfrom
gaborbernat:feat/deps-only-2301

Conversation

@gaborbernat
Copy link
Copy Markdown
Member

@gaborbernat gaborbernat commented Feb 19, 2026

Many tox environments -- coverage combining, doc building, linting -- need a project's dependencies (and extras) but not the project itself. Today the only option is skip_install = true plus manually duplicating every dependency in deps, which drifts out of sync with pyproject.toml. This adds package = "deps-only" so those environments can declare extras = ["docs"] and get the right dependencies automatically, just like a normal test environment, without paying for a build step. 🎯

The implementation uses a two-tier resolution strategy. It first tries to read dependencies statically from a PEP 621 [project] table in pyproject.toml -- no packaging environment needed, same fast path as dependency_groups. If that fails (dynamic deps, no [project] table, setup.cfg-only projects), it falls back to the existing .pkg env and prepare_metadata_for_build_wheel to extract metadata. A new load_deps_for_env abstract method on PythonPackageToxEnv exposes this fallback cleanly to the runner.

The extras config key works identically to other package modes, including validation of unknown extra names. Existing configurations are unaffected -- deps-only is purely opt-in alongside the existing wheel, sdist, sdist-wheel, editable, editable-legacy, skip, and external modes.

Fixes #2301

@gaborbernat gaborbernat changed the title Add package = "deps-only" mode ✨ feat(config): add package = "deps-only" mode Feb 19, 2026
@gaborbernat gaborbernat force-pushed the feat/deps-only-2301 branch 2 times, most recently from 75f4ff8 to 57f0eb9 Compare February 19, 2026 05:23
@gaborbernat gaborbernat enabled auto-merge (squash) February 19, 2026 05:23
@gaborbernat gaborbernat marked this pull request as draft February 19, 2026 07:52
auto-merge was automatically disabled February 19, 2026 07:52

Pull request was converted to draft

Install package dependencies (including extras) without building or
installing the package itself. For PEP-621 projects with static
metadata, reads pyproject.toml directly without a packaging env.
Falls back to the .pkg env for dynamic deps or non-PEP-621 projects.

Fixes tox-dev#2301

Signed-off-by: Bernát Gábor <[email protected]>
The previous change to use the process returncode for FailedToStart
errors caused platform-dependent behavior: Windows returns 1 while
other platforms may differ. Restore the -5 sentinel since FailedToStart
is a tox-internal error, not a backend-reported one.

Also switch test_provision_install_pkg_pep517 from sdist to wheel to
eliminate the devpi mirror dependency on setuptools, removing the
flakiness entirely rather than masking it with retries.
@gaborbernat gaborbernat marked this pull request as ready for review February 19, 2026 15:59
@gaborbernat gaborbernat enabled auto-merge (squash) February 19, 2026 15:59
test_get_env_reuses_config_across_package_flag creates real virtualenvs
on Windows where virtualenv's symlink seed installation can hang
indefinitely during process.communicate(). Add 60s timeout so it fails
fast instead of blocking the entire CI run.

Also bump --durations from 20 to 30 for better slow test visibility.
@gaborbernat gaborbernat merged commit 82629e5 into tox-dev:main Feb 19, 2026
28 checks passed
@gaborbernat gaborbernat deleted the feat/deps-only-2301 branch February 19, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to skip install, but still install extras

1 participant