python-poetry / python-poetry/poetry

Add build-system.requires to lock file

Open
#8,752 15 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the FAQ and general documentation and believe that my question is not already covered.

Feature Request

Problem

A notable thing missing from poetry.lock are build-systems used to build from sdists.

This is useful in efforts like poetry2nix that uses Poetry metadata.
Nix build environments are constructed in a much stricter way where we cannot dynamically install/load build-systems.
Currently users of this tool have to resort to manually adding overrides into Nix code to work around this missing metadata.

This issue has been reported many times over the years in various forms:

And has generally been a large source of maintenance that could be completely automated away.

Adding this metadata also has other uses such as building tools that can statically inspect the build-time dependency graph.

Solution

One more possible entries in poetry.lock:

  • build-system.requires

We only need to know build-system.requires & up front when constructing the build environment.
There is no need to add build-system.backend or build-system.backend-path.

The PyPi API does not have this metadata. It would need to be extracted from the sdist.

Note

Do note that this is not a suggestion to lock build systems, merely to add the contents of build-system.requires.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the poetry.lock generation path and how Poetry reads package metadata from sdists; the issue notes that the PyPI API does not provide build-system.requires. Trace where sdist metadata can be extracted without adding backend or backend-path. Done means poetry.lock records build-system.requires for applicable packages and existing lock behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.