Use uv for pip installs (#13586)

* Update tests to `pip install -e .`

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Auto-format by https://ultralytics.com/actions

* Update pyproject.toml

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Use `setup-uv` and `uv pip` for package management.

Replaced `setup-python` with `setup-uv` and updated pip commands to use the `uv` tool for dependency installation and listing. Simplifies package management and integrates

* Use `setup-uv` and `uv pip` for package management.

Replaced `setup-python` with `setup-uv` and updated pip commands to use the `uv` tool for dependency installation and listing. Simplifies package management and integrates-uv` for improved workflow consistency.

* Use `setup-uv` and `uv pip` for package management.

Replaced `setup-python` with `setup-uv` and updated pip commands to use the `uv` tool for dependency installation and listing. Simplifies package management and integrates-uv` for improved workflow consistency.

* Use `setup-uv` and `uv pip` for package management.

Replaced `setup-python` with `setup-uv` and updated pip commands to use the `uv` tool for dependency installation and listing. Simplifies package management and integrates-uv` for improved workflow consistency.

---------

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn JocherandUltralyticsAssistant authored and GitHub committed 2025-05-10 14:32:18 +02:00
1 parent fe1d4d9947
commit 2ef886370c
10 files changed
+29 -28

No files matched your search

+5 -7
View File
@@ -27,13 +27,12 @@ jobs:
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
cache: "pip" # cache pip dependencies - uses: astral-sh/setup-uv@v6
- name: Install requirements - name: Install requirements
run: | run: |
python -m pip install --upgrade pip wheel uv pip install --system -r requirements.txt coremltools openvino-dev tensorflow --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match
pip install -r requirements.txt coremltools openvino-dev "tensorflow-cpu<2.15.1" --extra-index-url https://download.pytorch.org/whl/cpu
yolo checks yolo checks
pip list uv pip list
- name: Benchmark DetectionModel - name: Benchmark DetectionModel
run: | run: |
python benchmarks.py --data coco128.yaml --weights ${{ matrix.model }}.pt --img 320 --hard-fail 0.29 python benchmarks.py --data coco128.yaml --weights ${{ matrix.model }}.pt --img 320 --hard-fail 0.29
@@ -66,15 +65,14 @@ jobs:
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies - uses: astral-sh/setup-uv@v6
- name: Install requirements - name: Install requirements
run: | run: |
python -m pip install --upgrade pip wheel
torch="" torch=""
if [ "${{ matrix.torch }}" == "1.8.0" ]; then if [ "${{ matrix.torch }}" == "1.8.0" ]; then
torch="torch==1.8.0 torchvision==0.9.0" torch="torch==1.8.0 torchvision==0.9.0"
fi fi
pip install -r requirements.txt $torch --extra-index-url https://download.pytorch.org/whl/cpu uv pip install --system -r requirements.txt $torch --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match
shell: bash # for Windows compatibility shell: bash # for Windows compatibility
- name: Check environment - name: Check environment
run: | run: |
+1 -1
View File
@@ -9,7 +9,7 @@
# ├── yolov5m.pt # ├── yolov5m.pt
# └── ... # └── ...
python - <<EOF python - << EOF
from utils.downloads import attempt_download from utils.downloads import attempt_download
p5 = list('nsmlx') # P5 models p5 = list('nsmlx') # P5 models
+4 -4
View File
@@ -12,10 +12,10 @@
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then
for opt in "$@"; do for opt in "$@"; do
case "${opt}" in case "${opt}" in
--train) train=true ;; --train) train=true ;;
--val) val=true ;; --val) val=true ;;
--test) test=true ;; --test) test=true ;;
--segments) segments=true ;; --segments) segments=true ;;
esac esac
done done
else else
+2 -2
View File
@@ -12,8 +12,8 @@
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then
for opt in "$@"; do for opt in "$@"; do
case "${opt}" in case "${opt}" in
--train) train=true ;; --train) train=true ;;
--val) val=true ;; --val) val=true ;;
esac esac
done done
else else
+2 -2
View File
@@ -12,8 +12,8 @@
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then
for opt in "$@"; do for opt in "$@"; do
case "${opt}" in case "${opt}" in
--train) train=true ;; --train) train=true ;;
--val) val=true ;; --val) val=true ;;
esac esac
done done
else else
+2 -2
View File
@@ -12,8 +12,8 @@
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then
for opt in "$@"; do for opt in "$@"; do
case "${opt}" in case "${opt}" in
--train) train=true ;; --train) train=true ;;
--val) val=true ;; --val) val=true ;;
esac esac
done done
else else
+2 -2
View File
@@ -12,8 +12,8 @@
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then
for opt in "$@"; do for opt in "$@"; do
case "${opt}" in case "${opt}" in
--train) train=true ;; --train) train=true ;;
--val) val=true ;; --val) val=true ;;
esac esac
done done
else else
-2
View File
@@ -86,13 +86,11 @@ dependencies = [
dev = [ dev = [
"ipython", "ipython",
"check-manifest", "check-manifest",
"pre-commit",
"pytest", "pytest",
"pytest-cov", "pytest-cov",
"coverage[toml]", "coverage[toml]",
"mkdocs-material", "mkdocs-material",
"mkdocstrings[python]", "mkdocstrings[python]",
"mkdocs-redirects", # for 301 redirects
"mkdocs-ultralytics-plugin>=0.0.34", # for meta descriptions and images, dates and authors "mkdocs-ultralytics-plugin>=0.0.34", # for meta descriptions and images, dates and authors
] ]
export = [ export = [
+10 -5
View File
@@ -4,24 +4,29 @@
# This script will run on every instance restart, not only on first start # This script will run on every instance restart, not only on first start
# --- DO NOT COPY ABOVE COMMENTS WHEN PASTING INTO USERDATA --- # --- DO NOT COPY ABOVE COMMENTS WHEN PASTING INTO USERDATA ---
Content-Type: multipart/mixed; boundary="//" Content-Type: multipart/mixed
boundary="//"
MIME-Version: 1.0 MIME-Version: 1.0
--// --//
Content-Type: text/cloud-config; charset="us-ascii" Content-Type: text/cloud-config
charset="us-ascii"
MIME-Version: 1.0 MIME-Version: 1.0
Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt" Content-Disposition: attachment
filename="cloud-config.txt"
#cloud-config #cloud-config
cloud_final_modules: cloud_final_modules:
- [scripts-user, always] - [scripts-user, always]
--// --//
Content-Type: text/x-shellscript; charset="us-ascii" Content-Type: text/x-shellscript
charset="us-ascii"
MIME-Version: 1.0 MIME-Version: 1.0
Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt" Content-Disposition: attachment
filename="userdata.txt"
#!/bin/bash #!/bin/bash
# --- paste contents of userdata.sh here --- # --- paste contents of userdata.sh here ---
+1 -1
View File
@@ -25,5 +25,5 @@ else
sudo docker start $id sudo docker start $id
# sudo docker exec -it $id python train.py --resume # single-GPU # sudo docker exec -it $id python train.py --resume # single-GPU
sudo docker exec -d $id python utils/aws/resume.py # multi-scenario sudo docker exec -d $id python utils/aws/resume.py # multi-scenario
done <<<"$list" done <<< "$list"
fi fi