Skip to content

pyproject.toml

Eric Apgar edited this page Jan 10, 2026 · 2 revisions

The build-system section can also look something like:

[build-system]
requires = ["uv_build>=0.9.7,<0.10.0"]
build-backend = "uv_build"

There are a couple different ways to build the project. You can do it the traditional way with "setuptools" and "wheel" or use "uv_build" which is a faster but python only build method. If your project is pure python and you initialize the project with the uv package manager, then uv will add it's own build package as the method by which it builds the project. This should be fine even if someone doesn't use uv for package management because, as I understand it, the build-system requirements are installed in some temp environment when it comes time to build the project, and one method is just using one set of packages to build while the other method is just using a different package.

[project]
name = "llm"  # The pip install <name>.
version = "0.1.0"
description = "Library for easy use of LLMs."
readme = "README.md"
authors = [
    { name = "Eric Apgar" }
]
urls = { "Homepage" = "https://github.com/EricApgar" }
requires-python = ">=3.12"

dependencies = [
    "transformers>=4.57.1",
    "torch",
    "torchvision",
    "accelerate>=1.12.0",
    "triton>=3.5.0",
    "kernels>=0.11.1",
]

[[tool.uv.index]]
name = "pytorch-cu130"
url = "https://download.pytorch.org/whl/cu130"
explicit = true  # Only used for torch packages explicitly mapped below.

# Route just these packages to the PyTorch index.
[tool.uv.sources]
torch = { index = "pytorch-cu130" }
torchvision = { index = "pytorch-cu130" }

[build-system]
requires = ["uv_build>=0.9.7,<0.10.0"]
build-backend = "uv_build"

[tool.setuptools]
package-dir = {"" = "src"}  # Important that this folder is the name of the folder where all the files sit under.

[tool.setuptools.packages.find]
where = ["src"]
include = ["llm*"]  # The import <name>. Defined by the name of the folder under src.

Clone this wiki locally