Skip to content

feat: a Nix build environment#14249

Open
prsteele wants to merge 1 commit intopytest-dev:mainfrom
prsteele:nix-environment
Open

feat: a Nix build environment#14249
prsteele wants to merge 1 commit intopytest-dev:mainfrom
prsteele:nix-environment

Conversation

@prsteele
Copy link

@prsteele prsteele commented Mar 3, 2026

Overview

This commit creates a flake.nix file defining a minimal build environment for Nix users. If you have Nix installed, you can run

nix develop

to enter an environment where

tox -e linting,py310,py311,py312,py313,py314

work as expected.

Details

This change does not impose any changes on existing workflows; it is intended only to make it easier for Nix users to contribute to pytest.

For those Nix users, this change does not even package pytest as a Nix derivation; instead, it provides a minimal build environment that behaves like an "ordinary" Python environment, albeit one with all pytest-supported versions of Python installed.

Testing

The commands

nix develop

followed by

tox -e linting,py310,py311,py312,py313,py314

passes.

Closes #14250.

This commit creates a flake.nix file defining a minimal build
environment for Nix users. If you have Nix, you can run

    nix develop

to enter a FHS-compliant environment with Python 3.10, 3.11, 3.12,
3.13, and 3.14 installed, along with development tools like tox and
pre-commit. From here, ordinary commands like

    tox -e linting,py310,py311,py312,py313,py314

work as expected.

Note that this environment does not provide any Python packages except
tox; all dependencies are installed via tox as if we were not using
Nix.
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Mar 3, 2026
Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this doesn't belong upstream as having it implies an unreasonable amount of maintenance burden for the maintainers. It usually makes sense to maintain what's in the CI and in the expected dev env, which is tox — allowing us to reduce said burdens by using a workflow tool that makes the CI configuration as close as possible to the dev env.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A Nix build environment

2 participants