Skip to content

Conversation

@blast-hardcheese
Copy link

@blast-hardcheese blast-hardcheese commented Jan 1, 2025

Hello! Thank you for the tool, I noticed it wasn't possible to fully construct new complex structures.

I figured this could be done incrementally with minimal effort, using {} and [] as literal symbols bound to specific functionality:

$ tomato set    'tool.uv.sources.torch'          '[]'          pyproject.toml
$ tomato append 'tool.uv.sources.torch'          '{}'          pyproject.toml
$ tomato set    'tool.uv.sources.torch[0].index' 'pytorch-cpu' pyproject.toml

when applied to the following toml:

[project]
name = "beep"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = []

[tool.uv.sources]
torchvision = [
    { index = "pytorch-cpu", marker = "platform_system == 'Linux'" },
]

results in

[project]
name = "beep"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "requests>=2.32.3"
]

[tool.uv.sources]
torchvision = [
    { index = "pytorch-cpu", marker = "platform_system == 'Linux'" },
]
torch = [{ index = "pytorch-cpu" }]

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant