Skip to content

build: move pytest/pytest-cov/pytest-mock from runtime deps to dev group - #29

Merged
sethtroisi merged 1 commit into
googlecolab:mainfrom
teeler:move-pytest-to-dev
May 27, 2026
Merged

sethtroisi merged 1 commit into
googlecolab:mainfrom
teeler:move-pytest-to-dev

Conversation

@teeler

@teeler teeler commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

pytest, pytest-cov, pytest-mock were in [project].dependencies, which forced every pip install google-colab-cli user to install the entire pytest test framework plus its transitive deps (coverage, iniconfig, pluggy). Move them to [dependency-groups].dev (PEP 735) where they belong.

Concrete impact

Measured by installing the resulting wheel into a fresh py3.13 venv:

Before After Delta
Packages installed 57 51 −6
Install size 200 MB 197 MB −3 MB
pytest, pytest-cov, pytest-mock, coverage, iniconfig, pluggy Installed Gone ✓

Why it matters beyond size

Removing pytest from runtime deps stops dependency scanners (pipdeptree, pip-audit, dependabot, snyk) from treating pytest version pins as user-facing constraints. Previously, any downstream environment that pinned pytest 8.x for plugin compat would conflict with our floor of pytest>=9.0.2 even though no user code imports pytest.

What still works

  • uv sync populates both groups by default, so contributors get pytest automatically — no workflow change.
  • uv run pytest tests/ → 201 passed.
  • uv run ruff check . → clean.
  • Built wheel + installed into fresh venv: no pytest/coverage/pluggy in site-packages, colab version works, colab url works (also verifies fix(url): also emit #datalabBackendUrl=<full URL> fragment #27's fragment fix is intact in the install path).

These three packages were declared in [project].dependencies, which
forced every consumer that ran `pip install google-colab-cli` to also
install the entire pytest test framework plus its transitive deps
(coverage, iniconfig, pluggy) -- ~2.5MB of test machinery that user
code never imports.

The correct semantic for test dependencies is [dependency-groups].dev
(PEP 735), which `uv sync` populates by default for contributors but
is NOT advertised in the published wheel's metadata as a runtime
requirement.

Concrete impact measured by installing the resulting wheel into a
fresh py3.13 venv (`uv pip install dist/*.whl`):

  Before:  57 packages, 200 MB site-packages
  After:   51 packages, 197 MB site-packages
  Gone:    pytest, pytest-cov, pytest-mock, coverage, iniconfig, pluggy

Beyond size, removing pytest from runtime deps stops dependency
scanners (pipdeptree, pip-audit, dependabot, snyk) from treating
pytest version pins as user-facing constraints -- previously, any
downstream environment that pinned pytest 8.x for plugin compat
would conflict with our floor of pytest>=9.0.2 even though no
user code imports pytest.

Verified:
- `uv sync` + `uv run pytest tests/` -> 201 passed (dev group still
  installs everything contributors need)
- `uv run ruff check .` -> clean
- Built wheel + installed into fresh venv: no pytest/coverage/pluggy
  in site-packages, `colab version` works, `colab url` works
  (verifies googlecolab#27 fragment fix is intact in the install path).
@sethtroisi
sethtroisi merged commit 9d5f7f8 into googlecolab:main May 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants