Switch to uv (#6499)

* test UV performance

* second dummy change

* fix CI

* set version - uv is already proving to be great

* dummy bump

* bump to newer uv

* use uv in more places

* revert uv

* add flag to disable UV

* fix vevn for CI

* bump uv version

* bump to uv-016

* bump

* bump

* switch to uv
This commit is contained in:
Matthias Mair 2024-02-22 22:55:19 +00:00 committed by GitHub
parent 5dbd3030d1
commit f5e02fd292
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 67 additions and 159 deletions

View File

@ -49,7 +49,10 @@ runs:
shell: bash
run: |
python3 -m pip install -U pip
pip3 install invoke wheel
pip3 install invoke wheel uv
- name: Set the VIRTUAL_ENV variable for uv to work
run: echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
shell: bash
- name: Install Specific Python Dependencies
if: ${{ inputs.pip-dependency }}
shell: bash

View File

@ -25,16 +25,16 @@ repos:
--fix,
--preview
]
- repo: https://github.com/jazzband/pip-tools
rev: 7.4.0
- repo: https://github.com/matmair/ruff-pre-commit
rev: 830893bf46db844d9c99b6c468e285199adf2de6 # uv-018
hooks:
- id: pip-compile
name: pip-compile requirements-dev.in
args: [requirements-dev.in, -o, requirements-dev.txt]
args: [requirements-dev.in, -o, requirements-dev.txt, --python-version=3.9]
files: ^requirements-dev\.(in|txt)$
- id: pip-compile
name: pip-compile requirements.txt
args: [requirements.in, -o, requirements.txt]
args: [requirements.in, -o, requirements.txt,--python-version=3.9]
files: ^requirements\.(in|txt)$
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.34.1

View File

@ -1,52 +1,32 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --output-file=requirements-dev.txt requirements-dev.in
#
# This file was autogenerated by uv via the following command:
# uv pip compile requirements-dev.in -o requirements-dev.txt --python-version=3.9
asgiref==3.7.2
# via
# -c requirements.txt
# django
# via django
build==1.0.3
# via pip-tools
certifi==2024.2.2
# via
# -c requirements.txt
# requests
# via requests
cffi==1.16.0
# via
# -c requirements.txt
# cryptography
# via cryptography
cfgv==3.4.0
# via pre-commit
charset-normalizer==3.3.2
# via
# -c requirements.txt
# pdfminer-six
# requests
click==8.1.7
# via pip-tools
coverage[toml]==5.5
# via
# -r requirements-dev.in
# coveralls
coverage==5.5
# via coveralls
coveralls==2.1.2
# via -r requirements-dev.in
cryptography==42.0.4
# via
# -c requirements.txt
# pdfminer-six
# via pdfminer-six
distlib==0.3.8
# via virtualenv
django==4.2.10
# via
# -c requirements.txt
# django-slowtests
# via django-slowtests
django-slowtests==1.1.1
# via -r requirements-dev.in
django-test-migrations==1.3.0
# via -r requirements-dev.in
docopt==0.6.2
# via coveralls
filelock==3.13.1
@ -54,47 +34,35 @@ filelock==3.13.1
identify==2.5.33
# via pre-commit
idna==3.6
# via
# -c requirements.txt
# requests
# via requests
importlib-metadata==6.11.0
# via
# -c requirements.txt
# build
# via build
isort==5.13.2
# via -r requirements-dev.in
nodeenv==1.8.0
# via pre-commit
packaging==23.2
# via
# -c requirements.txt
# build
# via build
pdfminer-six==20231228
# via -r requirements-dev.in
pip==24.0
# via pip-tools
pip-tools==7.3.0
# via -r requirements-dev.in
platformdirs==4.2.0
# via virtualenv
pre-commit==3.6.0
# via -r requirements-dev.in
pycparser==2.21
# via
# -c requirements.txt
# cffi
# via cffi
pyproject-hooks==1.0.0
# via build
pyyaml==6.0.1
# via
# -c requirements.txt
# pre-commit
# via pre-commit
requests==2.31.0
# via coveralls
setuptools==69.1.0
# via
# -c requirements.txt
# coveralls
# nodeenv
# pip-tools
sqlparse==0.4.4
# via
# -c requirements.txt
# django
# via django
toml==0.10.2
# via coverage
tomli==2.0.1
@ -104,22 +72,13 @@ tomli==2.0.1
# pyproject-hooks
typing-extensions==4.9.0
# via
# -c requirements.txt
# asgiref
# django-test-migrations
urllib3==2.2.0
# via
# -c requirements.txt
# requests
# via requests
virtualenv==20.25.0
# via pre-commit
wheel==0.42.0
# via pip-tools
zipp==3.17.0
# via
# -c requirements.txt
# importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
# via importlib-metadata

View File

@ -1,9 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --output-file=requirements.txt requirements.in
#
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.in -o requirements.txt --python-version=3.9
asgiref==3.7.2
# via
# django
@ -21,7 +17,7 @@ backoff==2.2.1
# opentelemetry-exporter-otlp-proto-common
# opentelemetry-exporter-otlp-proto-grpc
# opentelemetry-exporter-otlp-proto-http
bleach[css]==6.1.0
bleach==6.1.0
# via django-markdownify
brotli==1.1.0
# via fonttools
@ -36,12 +32,10 @@ cffi==1.16.0
charset-normalizer==3.3.2
# via requests
coreapi==2.3.3
# via -r requirements.in
coreschema==0.0.4
# via coreapi
cryptography==42.0.4
# via
# -r requirements.in
# djangorestframework-simplejwt
# pyjwt
cssselect2==0.7.0
@ -58,10 +52,8 @@ deprecated==1.2.14
diff-match-patch==20230430
# via django-import-export
dj-rest-auth==5.0.2
# via -r requirements.in
django==4.2.10
# via
# -r requirements.in
# dj-rest-auth
# django-allauth
# django-allauth-2fa
@ -93,86 +85,53 @@ django==4.2.10
# djangorestframework-simplejwt
# drf-spectacular
django-allauth==0.60.1
# via
# -r requirements.in
# django-allauth-2fa
# via django-allauth-2fa
django-allauth-2fa==0.11.1
# via -r requirements.in
django-cleanup==8.1.0
# via -r requirements.in
django-cors-headers==4.3.1
# via -r requirements.in
django-crispy-forms==1.14.0
# via -r requirements.in
django-dbbackup==4.1.0
# via -r requirements.in
django-error-report-2==0.4.2
# via -r requirements.in
django-filter==23.5
# via -r requirements.in
django-flags==5.0.13
# via -r requirements.in
django-formtools==2.5.1
# via -r requirements.in
django-ical==1.9.2
# via -r requirements.in
django-import-export==3.3.7
# via -r requirements.in
django-js-asset==2.2.0
# via django-mptt
django-maintenance-mode==0.21.1
# via -r requirements.in
django-markdownify==0.9.3
# via -r requirements.in
django-money==3.2.0
# via -r requirements.in
django-mptt==0.16.0
# via -r requirements.in
django-otp==1.3.0
# via django-allauth-2fa
django-picklefield==3.1
# via django-q2
django-q-sentry==0.1.6
# via -r requirements.in
django-q2==1.6.1
# via -r requirements.in
django-recurrence==1.11.1
# via django-ical
django-redis==5.4.0
# via -r requirements.in
django-sesame==3.2.2
# via -r requirements.in
django-sql-utils==0.7.0
# via -r requirements.in
django-sslserver==0.22
# via -r requirements.in
django-stdimage==6.0.2
# via -r requirements.in
django-taggit==5.0.1
# via -r requirements.in
django-user-sessions==2.0.0
# via -r requirements.in
django-weasyprint==2.2.2
# via -r requirements.in
django-xforwardedfor-middleware==2.0
# via -r requirements.in
djangorestframework==3.14.0
# via
# -r requirements.in
# dj-rest-auth
# djangorestframework-simplejwt
# drf-spectacular
djangorestframework-simplejwt[crypto]==5.3.1
# via -r requirements.in
djangorestframework-simplejwt==5.3.1
drf-spectacular==0.27.1
# via -r requirements.in
dulwich==0.21.7
# via -r requirements.in
et-xmlfile==1.1.0
# via openpyxl
feedparser==6.0.11
# via -r requirements.in
fonttools[woff]==4.47.2
fonttools==4.47.2
# via weasyprint
googleapis-common-protos==1.62.0
# via
@ -181,7 +140,6 @@ googleapis-common-protos==1.62.0
grpcio==1.60.1
# via opentelemetry-exporter-otlp-proto-grpc
gunicorn==21.2.0
# via -r requirements.in
html5lib==1.1
# via weasyprint
icalendar==5.0.11
@ -217,7 +175,6 @@ openpyxl==3.1.2
# via tablib
opentelemetry-api==1.22.0
# via
# -r requirements.in
# opentelemetry-exporter-otlp-proto-grpc
# opentelemetry-exporter-otlp-proto-http
# opentelemetry-instrumentation
@ -227,7 +184,6 @@ opentelemetry-api==1.22.0
# opentelemetry-instrumentation-wsgi
# opentelemetry-sdk
opentelemetry-exporter-otlp==1.22.0
# via -r requirements.in
opentelemetry-exporter-otlp-proto-common==1.22.0
# via
# opentelemetry-exporter-otlp-proto-grpc
@ -243,11 +199,8 @@ opentelemetry-instrumentation==0.43b0
# opentelemetry-instrumentation-requests
# opentelemetry-instrumentation-wsgi
opentelemetry-instrumentation-django==0.43b0
# via -r requirements.in
opentelemetry-instrumentation-redis==0.43b0
# via -r requirements.in
opentelemetry-instrumentation-requests==0.43b0
# via -r requirements.in
opentelemetry-instrumentation-wsgi==0.43b0
# via opentelemetry-instrumentation-django
opentelemetry-proto==1.22.0
@ -257,7 +210,6 @@ opentelemetry-proto==1.22.0
# opentelemetry-exporter-otlp-proto-http
opentelemetry-sdk==1.22.0
# via
# -r requirements.in
# opentelemetry-exporter-otlp-proto-grpc
# opentelemetry-exporter-otlp-proto-http
opentelemetry-semantic-conventions==0.43b0
@ -275,17 +227,14 @@ opentelemetry-util-http==0.43b0
packaging==23.2
# via gunicorn
pdf2image==1.17.0
# via -r requirements.in
pillow==10.2.0
# via
# -r requirements.in
# django-stdimage
# pdf2image
# python-barcode
# qrcode
# weasyprint
pint==0.21
# via -r requirements.in
protobuf==4.25.2
# via
# googleapis-common-protos
@ -296,7 +245,7 @@ pycparser==2.21
# via cffi
pydyf==0.8.0
# via weasyprint
pyjwt[crypto]==2.8.0
pyjwt==2.8.0
# via
# django-allauth
# djangorestframework-simplejwt
@ -304,14 +253,12 @@ pyphen==0.14.0
# via weasyprint
pypng==0.20220715.0
# via qrcode
python-barcode[images]==0.15.1
# via -r requirements.in
python-barcode==0.15.1
python-dateutil==2.8.2
# via
# django-recurrence
# icalendar
python-dotenv==1.0.1
# via -r requirements.in
python-fsutil==0.13.1
# via django-maintenance-mode
python3-openid==3.2.0
@ -323,15 +270,11 @@ pytz==2024.1
# icalendar
pyyaml==6.0.1
# via
# -r requirements.in
# drf-spectacular
# tablib
qrcode[pil]==7.4.2
# via
# -r requirements.in
# django-allauth-2fa
qrcode==7.4.2
# via django-allauth-2fa
rapidfuzz==0.7.6
# via -r requirements.in
redis==5.0.1
# via django-redis
referencing==0.33.0
@ -339,7 +282,6 @@ referencing==0.33.0
# jsonschema
# jsonschema-specifications
regex==2023.12.25
# via -r requirements.in
requests==2.31.0
# via
# coreapi
@ -353,9 +295,11 @@ rpds-py==0.17.1
# jsonschema
# referencing
sentry-sdk==1.40.0
# via django-q-sentry
setuptools==69.1.0
# via
# -r requirements.in
# django-q-sentry
# django-money
# opentelemetry-instrumentation
sgmllib3k==1.0.0
# via feedparser
six==1.16.0
@ -367,10 +311,8 @@ sqlparse==0.4.4
# via
# django
# django-sql-utils
tablib[html,ods,xls,xlsx,yaml]==3.5.0
# via
# -r requirements.in
# django-import-export
tablib==3.5.0
# via django-import-export
tinycss2==1.2.1
# via
# bleach
@ -393,9 +335,7 @@ urllib3==2.2.0
# requests
# sentry-sdk
weasyprint==60.2
# via
# -r requirements.in
# django-weasyprint
# via django-weasyprint
webencodings==0.5.1
# via
# bleach
@ -415,6 +355,3 @@ zipp==3.17.0
# via importlib-metadata
zopfli==0.2.3
# via fonttools
# The following packages are considered to be unsafe in a requirements file:
# setuptools

View File

@ -207,8 +207,8 @@ def check_file_existance(filename: str, overwrite: bool = False):
# Install tasks
@task
def plugins(c):
@task(help={'nouv': 'Do not use UV'})
def plugins(c, nouv=False):
"""Installs all plugins as specified in 'plugins.txt'."""
from InvenTree.InvenTree.config import get_plugin_file
@ -217,20 +217,29 @@ def plugins(c):
print(f"Installing plugin packages from '{plugin_file}'")
# Install the plugins
c.run(f"pip3 install --disable-pip-version-check -U -r '{plugin_file}'")
if nouv:
c.run(f"pip3 install --disable-pip-version-check -U -r '{plugin_file}'")
else:
c.run('pip3 install --no-cache-dir --disable-pip-version-check uv')
c.run(f"uv pip install -r '{plugin_file}'")
@task(post=[plugins])
def install(c):
@task(post=[plugins], help={'nouv': 'Do not use UV'})
def install(c, nouv=False):
"""Installs required python packages."""
print("Installing required python packages from 'requirements.txt'")
# Install required Python packages with PIP
c.run('pip3 install --upgrade pip')
c.run('pip3 install --upgrade setuptools')
c.run(
'pip3 install --no-cache-dir --disable-pip-version-check -U -r requirements.txt'
)
if nouv:
c.run('pip3 install --upgrade pip')
c.run('pip3 install --upgrade setuptools')
c.run(
'pip3 install --no-cache-dir --disable-pip-version-check -U -r requirements.txt'
)
else:
c.run('pip3 install --upgrade uv')
c.run('uv pip install --upgrade setuptools')
c.run('uv pip install -U -r requirements.txt')
@task(help={'tests': 'Set up test dataset at the end'})