Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool: Adding support for the uv system #3125

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ repos:
rev: v1.22.9
hooks:
- id: typos
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.4.10
hooks:
# Update the uv lockfile
- id: uv-lock
- repo: local
hooks:
- id: dont-commit-upstream
Expand Down
10 changes: 9 additions & 1 deletion docsrc/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ Once the WORKSPACE has been configured properly, all that is required to build t
python -m pip install --pre . --extra-index-url https://download.pytorch.org/whl/nightly/cu124


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


.. code-block:: sh

uv pip install -e .


To build the wheel file

.. code-block:: sh
Expand Down Expand Up @@ -379,4 +387,4 @@ Compile the Python API using the following command from the ``//py`` directory:

If you have a build of PyTorch that uses Pre-CXX11 ABI drop the ``--use-cxx11-abi`` flag

If you are building for Jetpack 4.5 add the ``--jetpack-version 5.0`` flag
If you are building for Jetpack 4.5 add the ``--jetpack-version 5.0`` flag
41 changes: 34 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ requires = [
"typing-extensions>=4.7.0",
"future>=0.18.3",
"tensorrt-cu12==10.3.0",
"torch >=2.5.0.dev,<2.6.0",
"torch>=2.5.0.dev,<2.6.0",
"pybind11==2.6.2",
"numpy",
]
Expand All @@ -36,7 +36,7 @@ classifiers = [
"Topic :: Software Development :: Libraries",
]
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.8"
requires-python = ">=3.9"
keywords = [
"pytorch",
"torch",
Expand All @@ -54,7 +54,7 @@ keywords = [
"inference",
]
dependencies = [
"torch >=2.5.0.dev,<2.6.0",
"torch>=2.5.0.dev,<2.6.0",
"tensorrt-cu12==10.3.0",
"tensorrt-cu12-bindings==10.3.0",
"tensorrt-cu12-libs==10.3.0",
Expand All @@ -65,10 +65,12 @@ dependencies = [
dynamic = ["version"]

[project.optional-dependencies]
torchvision = ["torchvision >=0.20.dev,<0.21.0"]
torchvision = [
"torchvision",
] #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
quantization = ["nvidia-modelopt[deploy,hf,torch]~=0.17.0"]
monitoring-tools = ["rich >= 13.7.1"]
jupyter = ["rich[jupyter] >= 13.7.1"]
monitoring-tools = ["rich>=13.7.1"]
jupyter = ["rich[jupyter]>=13.7.1"]

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

[tool.uv]
dev-dependencies = [
"pre-commit>=2.20.0",
"black>=22.6.0",
"clang-format==14.0.6",
"typos",
"mypy",
"isort",
"ruff",
"pytest",
"pytest-xdist",
"parameterized>=0.2.0",
"expecttest==0.1.6",
"pyyaml",
]

environments = ["sys_platform == 'linux'", "sys_platform == 'windows'"]

extra-index-url = [
"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
]

prerelease = "if-necessary-or-explicit"
index-strategy = "unsafe-best-match"

[tool.ruff]
# NOTE: Synchoronize the ignores with .flake8
lint.ignore = [
Expand Down Expand Up @@ -144,7 +171,6 @@ lint.select = [

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

# Allow autofix for all enabled rules (when `--fix`) is provided.
lint.fixable = [
Expand Down Expand Up @@ -194,6 +220,7 @@ lint.fixable = [
"YTT",
]
lint.unfixable = []
target-version = "py311"

# Exclude a variety of commonly ignored directories.
exclude = [
Expand Down
Loading
Loading