Skip to content

Python: deprecate format and default to pyproject #253154

@figsoda

Description

@figsoda

Motivation

Since the introduction of PEP 518 and some following PEPs that expands on the idea, the pyproject.toml format has gained a lot of adoption and became the de facto format for python packages.

However, a more popular option, and the current default format in nixpkgs is setuptools. Luckily, we might still be able to build these packages with format = "pyproject" because pyproject.toml falls back to using setuptools as its build backend as documented by pypa even if the package doesn't have a pyproject.toml. This might actually be preferred, because I ran into issues with format = "setuptools" when trying to package a setup.py package.

Proposal

I am proposing to deprecate the format option and replacing it with a pyproject option for packages that don't work with pyproject. We can do this over a longer period of time:

  1. introduce a pyproject option that conflicts with the existing format option, where true is equivalent to format = "pyproject" and false is equivalent to format = "other"
  2. enforce newly added python packages to use the pyproject option instead of format
  3. convert existing format = "setuptools" and format = "pyproject" to pyproject = true and the rest to pyproject = false
  4. deprecate format with a warning and make the default behavior pyproject = true (instead of format = "setuptools")
  5. remove all pyproject = trues, as this is now the default
  6. remove the format option altogether

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.skill: sprintableA larger issue which is split into distinct actionable tasks5.scope: trackingLong-lived issue tracking long-term fixes or multiple sub-problems6.topic: pythonPython is a high-level, general-purpose programming language.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions