pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.26k stars 627 forks source link

Add support for [tool.uv] dev-dependencies #21350

Closed njgrisafi closed 4 days ago

njgrisafi commented 3 weeks ago

Is your feature request related to a problem? Please describe. Not really, Pants just needs to support parsing [tool.uv] section for dev-dependencies

Describe the solution you'd like Have something like uv_requirements similar to poetry_requirements

This should include the dev-dependencies section in pyproject.toml

Describe alternatives you've considered Exporting to a requirements-dev.txt but we lose benefits in uv doing this.

Another approach just duplicate dependencies between pants and uv.

Additional context Here's an example pyproject.toml

[project]
name = "something"
requires-python = ">=3.11.0,<=3.11.8"
version = "0.0.1"
description = "Some project"
authors = []
dependencies = [
    "babel==2.9.1"
]

[tool.uv]
dev-dependencies = [
    "coverage==7.3.2",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
njgrisafi commented 3 weeks ago

Also we should support uv sources

[project]
name = "something"
requires-python = ">=3.11.0,<=3.11.8"
version = "0.0.1"
description = "Some project"
authors = []
dependencies = [
    "babel==2.9.1",
    "local-project",
]

[tool.uv]
dev-dependencies = [
    "coverage==7.3.2",
]

[tool.uv.sources]
local-project = { path = "./local-project" }

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
benjyw commented 2 weeks ago

The dev-dependencies thing should be pretty straightforward if you want to take a crack at it.