Skip to content

Use lock files and relative dependency cooldowns #1

Open

Description

@ogrisel

I think the use of requirements files with X.Y.Z pinned version constraints is good but not enough to ensure full reproducibility of the builds (there can be .post0 markers after the .Z component for instance). I think we should use an explicit lock file to manage:

The lockfile(s) should be automatically refreshed, e.g. on a monthly basis with a relative dependency cooldown policy of a week to reduce the exposure of the release process to ongoing OSS Supply Chain attacks.

The lockfile(s) in the release repo could either be managed via uv or pixi. I don't think it matters much because we don't need conda-forge for the build and testing process in this repo. All the Python-level builds dependencies are fetched from pypi.org and the rest come from the system image (e.g. manylinux). EDIT: actually we do fetch a fixed binary for libomp on macOS, so maybe we could use pixi and a lock file to do that more automatically.

When the lock files are updated, we should use relative dependency cooldowns such as uv's exclude-newer config or pixi's exlude-newer config).

Ideally, the build dependencies should also be locked explicitly in the repo as for the other dependencies. According to cibuildwheel's doc, the pip wheel command is used under the hood to setup the build env automatically. By default, it will install dependencies from the pyproject.toml file. However, it should be possible to pass an explicit pylock.toml export of a proper uv managed lockfile to pip wheel -r. Alternatively, we configure cibuildwheel's before-build hook to run a script to explicitly prepare the build environment manually using uv or pixi commands and disable build isolation and run pip wheel --no-build-isolation --no-deps.

Activity

  1. agriyakhetarpal commented on Jun 19, 2026

    @agriyakhetarpal

    Ideally, the build dependencies should also be locked explicitly in the repo as for the other dependencies. According to cibuildwheel's doc, the pip wheel command is used under the hood to setup the build env automatically. By default, it will install dependencies from the pyproject.toml file. However, it should be possible to pass an explicit pylock.toml export of a proper uv managed lockfile to pip wheel -r. Alternatively, we configure cibuildwheel's before-build hook to run a script to explicitly prepare the build environment manually using uv or pixi commands and disable build isolation and run pip wheel --no-build-isolation --no-deps.

    Hi! A small note; I think our docs are outdated – we actually have pypa/build as the default build frontend since v2.x, and we run python -m build --wheel across platforms, instead of pip wheel. I think disabling build isolation will be neater indeed, so this would be via build-frontend = { name = "build", args = ["--no-isolation"] } (or build[uv]) and using pip-compile/uv compile to have a lockfile of build-time dependencies exported beforehand and subsequently installed in the before-build stage, like you mention. I'll put together a PR to update that line and reflect this (I caught it thanks to you!).

  2. ogrisel commented on Jun 22, 2026

    @ogrisel
    MemberAuthor

    Thanks very much for the feedback @agriyakhetarpal!

  3. thomasjpfan commented on Jul 9, 2026

    @thomasjpfan
    Member

    For locking the build dependencies from scikit-learn's pyproject.toml, where do you think it should live? In the scikit-learn/scikit-learn-release repo or the scikit-learn/scikit-learn repo?

  4. rgommers commented on Jul 10, 2026

    @rgommers

    I'm looking at adopting this approach for numpy and scipy as well. Quick thought about the question from Thomas: I'd like lock files to live in -release, because an explicit goal is supply chain security through a fully self-contained publishing pipeline, with control over who has access (a smaller group than "all maintainers") and with full reproducibility controlled in a single, easy to audit repo. To me that means that all abstract build/runtime/test/etc. dependencies are defined as project-level metadata in the main repo, and all locking for wheel building happens in the release repo.

  5. ogrisel commented on Jul 13, 2026

    @ogrisel
    MemberAuthor

    For locking the build dependencies from scikit-learn's pyproject.toml, where do you think it should live? In the scikit-learn/scikit-learn-release repo or the scikit-learn/scikit-learn repo?

    I agree, I think anything related to the release process should be done in the release repo.

  6. thomasjpfan commented on Jul 13, 2026

    @thomasjpfan
    Member

    In that case, I think we'll need to create a new branch to release like https://github.com/scipy/scipy-release. Concretely:

    1. Create release branch in scikit-learn/scikit-learn. This may update dependencies in pyproject.toml.
    2. Create release branch in scikit-learn-release and update build lock file that is consistent with the new pyproject.toml.
    3. Trigger release publish workflow from scikit-learn-release on the branch that uses the lock file.
  7. andyfaff commented on Aug 24, 2026

    @andyfaff

    I've put something like this together for scipy, scipy/scipy-release#39.

  8. lesteve commented on Aug 24, 2026

    @lesteve
    Member

    Nice, thanks, I'll try to take a look at one point!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions