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 shell: bash
run: | run: |
python3 -m pip install -U pip 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 - name: Install Specific Python Dependencies
if: ${{ inputs.pip-dependency }} if: ${{ inputs.pip-dependency }}
shell: bash shell: bash

View File

@ -25,16 +25,16 @@ repos:
--fix, --fix,
--preview --preview
] ]
- repo: https://github.com/jazzband/pip-tools - repo: https://github.com/matmair/ruff-pre-commit
rev: 7.4.0 rev: 830893bf46db844d9c99b6c468e285199adf2de6 # uv-018
hooks: hooks:
- id: pip-compile - id: pip-compile
name: pip-compile requirements-dev.in 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)$ files: ^requirements-dev\.(in|txt)$
- id: pip-compile - id: pip-compile
name: pip-compile requirements.txt 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)$ files: ^requirements\.(in|txt)$
- repo: https://github.com/Riverside-Healthcare/djLint - repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.34.1 rev: v1.34.1

View File

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

View File

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