Skip to content

Commit 1bf97a4

Browse files
authored
tool: Adding support for the uv system (#3125)
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent c5870d0 commit 1bf97a4

File tree

4 files changed

+1933
-8
lines changed

4 files changed

+1933
-8
lines changed

.pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ repos:
5555
rev: v1.22.9
5656
hooks:
5757
- id: typos
58+
- repo: https://github.com/astral-sh/uv-pre-commit
59+
# uv version.
60+
rev: 0.4.10
61+
hooks:
62+
# Update the uv lockfile
63+
- id: uv-lock
5864
- repo: local
5965
hooks:
6066
- id: dont-commit-upstream

docsrc/getting_started/installation.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ Once the WORKSPACE has been configured properly, all that is required to build t
134134
python -m pip install --pre . --extra-index-url https://download.pytorch.org/whl/nightly/cu124
135135
136136
137+
If you use the ``uv`` (`https://docs.astral.sh/uv/ <https://docs.astral.sh/uv/>`_) tool to manage python and your projects, the command is slightly simpler
138+
139+
140+
.. code-block:: sh
141+
142+
uv pip install -e .
143+
144+
137145
To build the wheel file
138146

139147
.. code-block:: sh
@@ -379,4 +387,4 @@ Compile the Python API using the following command from the ``//py`` directory:
379387
380388
If you have a build of PyTorch that uses Pre-CXX11 ABI drop the ``--use-cxx11-abi`` flag
381389

382-
If you are building for Jetpack 4.5 add the ``--jetpack-version 5.0`` flag
390+
If you are building for Jetpack 4.5 add the ``--jetpack-version 5.0`` flag

pyproject.toml

+34-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ requires = [
99
"typing-extensions>=4.7.0",
1010
"future>=0.18.3",
1111
"tensorrt-cu12==10.3.0",
12-
"torch >=2.5.0.dev,<2.6.0",
12+
"torch>=2.5.0.dev,<2.6.0",
1313
"pybind11==2.6.2",
1414
"numpy",
1515
]
@@ -36,7 +36,7 @@ classifiers = [
3636
"Topic :: Software Development :: Libraries",
3737
]
3838
readme = { file = "README.md", content-type = "text/markdown" }
39-
requires-python = ">=3.8"
39+
requires-python = ">=3.9"
4040
keywords = [
4141
"pytorch",
4242
"torch",
@@ -54,7 +54,7 @@ keywords = [
5454
"inference",
5555
]
5656
dependencies = [
57-
"torch >=2.5.0.dev,<2.6.0",
57+
"torch>=2.5.0.dev,<2.6.0",
5858
"tensorrt-cu12==10.3.0",
5959
"tensorrt-cu12-bindings==10.3.0",
6060
"tensorrt-cu12-libs==10.3.0",
@@ -65,10 +65,12 @@ dependencies = [
6565
dynamic = ["version"]
6666

6767
[project.optional-dependencies]
68-
torchvision = ["torchvision >=0.20.dev,<0.21.0"]
68+
torchvision = [
69+
"torchvision",
70+
] #Leaving torchvisions dependency unconstrained so uv can just install something that should work for the torch we have. TV's on PyT makes it hard to put version constrains in
6971
quantization = ["nvidia-modelopt[deploy,hf,torch]~=0.17.0"]
70-
monitoring-tools = ["rich >= 13.7.1"]
71-
jupyter = ["rich[jupyter] >= 13.7.1"]
72+
monitoring-tools = ["rich>=13.7.1"]
73+
jupyter = ["rich[jupyter]>=13.7.1"]
7274

7375
[project.urls]
7476
Homepage = "https://pytorch.org/tensorrt"
@@ -80,6 +82,31 @@ Changelog = "https://github.com/pytorch/tensorrt/releases"
8082
package-dir = { "" = "py" }
8183
include-package-data = false
8284

85+
[tool.uv]
86+
dev-dependencies = [
87+
"pre-commit>=2.20.0",
88+
"black>=22.6.0",
89+
"clang-format==14.0.6",
90+
"typos",
91+
"mypy",
92+
"isort",
93+
"ruff",
94+
"pytest",
95+
"pytest-xdist",
96+
"parameterized>=0.2.0",
97+
"expecttest==0.1.6",
98+
"pyyaml",
99+
]
100+
101+
environments = ["sys_platform == 'linux'", "sys_platform == 'windows'"]
102+
103+
extra-index-url = [
104+
"https://download.pytorch.org/whl/nightly/cu124", # We are going to define the dev enviorment as latest supported CUDA, and allow CI to handle the others, change as needed
105+
]
106+
107+
prerelease = "if-necessary-or-explicit"
108+
index-strategy = "unsafe-best-match"
109+
83110
[tool.ruff]
84111
# NOTE: Synchoronize the ignores with .flake8
85112
lint.ignore = [
@@ -144,7 +171,6 @@ lint.select = [
144171

145172
# Allow unused variables when underscore-prefixed.
146173
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
147-
target-version = "py311"
148174

149175
# Allow autofix for all enabled rules (when `--fix`) is provided.
150176
lint.fixable = [
@@ -194,6 +220,7 @@ lint.fixable = [
194220
"YTT",
195221
]
196222
lint.unfixable = []
223+
target-version = "py311"
197224

198225
# Exclude a variety of commonly ignored directories.
199226
exclude = [

0 commit comments

Comments
 (0)