Skip to content

Instantly share code, notes, and snippets.

@KuRRe8
Last active June 4, 2025 21:57
Show Gist options
  • Save KuRRe8/e52007784da8d89f882ea638fa638878 to your computer and use it in GitHub Desktop.
Save KuRRe8/e52007784da8d89f882ea638fa638878 to your computer and use it in GitHub Desktop.
common uv project files

UV

UV now is the popular python project manager.

Here I upload some common pyproject.toml files for quick reference/ copy/ init proj.

You need rename them back to pyproject.toml and use uv sync.

[project]
name = "uv-torch"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
"torch",
"torchvision",
"torchaudio",
"torchtext",
"torchdata",
"torchmetrics"
]
[[tool.uv.index]]
name = "pytorch-cu124"
url = "https://download.pytorch.org/whl/cu124"
explicit = true
[tool.uv.sources]
torch = [
{ index = "pytorch-cu124", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
torchvision = [
{ index = "pytorch-cu124", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
[project]
name = "uv-transformers"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
"torch",
"torchvision",
"torchaudio",
"torchtext",
"torchdata",
"torchmetrics",
"transformers>=4.52.4",
"datasets>=3.6.0",
"evaluate>=0.4.3",
"tokenizers>=0.21.1",
"accelerate>=1.7.0",
"optimum>=1.25.3",
"peft>=0.15.2",
"trl>=0.18.1",
"gradio>=5.32.0",
]
[[tool.uv.index]]
name = "pytorch-cu124"
url = "https://download.pytorch.org/whl/cu124"
explicit = true
[tool.uv.sources]
torch = [
{ index = "pytorch-cu124", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
torchvision = [
{ index = "pytorch-cu124", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
[project]
name = "uv-torch"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
"torch",
"torchvision"
]
[[tool.uv.index]]
name = "pytorch-cu124"
url = "https://download.pytorch.org/whl/cu124"
explicit = true
[tool.uv.sources]
torch = [
{ index = "pytorch-cu124", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
torchvision = [
{ index = "pytorch-cu124", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment