Sfoglia il codice sorgente

Mirgrate from pip to uv (#3285)

In order to improve build time performance, this change switches
usage of pip to uv. The uv command is a pip alternative promising
much faster installs of Python packages.

For more information on uv, see:
https://github.com/astral-sh/uv

Closes: #2748

Signed-off-by: Eric Brown <eric_wade_brown@yahoo.com>
Eric Brown 1 anno fa
parent
commit
bd3df68bef

+ 5 - 0
.github/actions/setup_build_env/action.yml

@@ -106,3 +106,8 @@ runs:
       run: |
         source ${{ inputs.create-venv-at-path }}/*/activate
         poetry install --only-root --no-interaction
+
+    - name: Install uv
+      shell: bash
+      run: |
+        poetry run pip install uv

+ 9 - 4
.github/workflows/benchmarks.yml

@@ -54,7 +54,7 @@ jobs:
 
       - name: Install Requirements for reflex-web
         working-directory: ./reflex-web
-        run: poetry run pip install -r requirements.txt
+        run: poetry run uv pip install -r requirements.txt
       - name: Init Website for reflex-web
         working-directory: ./reflex-web
         run: poetry run reflex init
@@ -117,7 +117,7 @@ jobs:
           run-poetry-install: true
           create-venv-at-path: .venv
       - name: Install additional dependencies for DB access
-        run: poetry run pip install psycopg2-binary
+        run: poetry run uv pip install psycopg2-binary
       - name: Run benchmark tests
         env:
           APP_HARNESS_HEADLESS: 1
@@ -149,7 +149,7 @@ jobs:
           run-poetry-install: true
           create-venv-at-path: .venv
       - name: Install additional dependencies for DB access
-        run: poetry run pip install psycopg2-binary
+        run: poetry run uv pip install psycopg2-binary
       - name: Build reflex
         run: |
           poetry build
@@ -192,8 +192,13 @@ jobs:
           source .venv/*/activate
           poetry install --without dev --no-interaction --no-root
 
+      - name: Install uv
+        shell: bash
+        run: |
+          poetry run pip install uv
+
       - name: Install additional dependencies for DB access
-        run: poetry run pip install psycopg2-binary
+        run: poetry run uv pip install psycopg2-binary
 
       - if: ${{ env.DATABASE_URL }}
         name: calculate and upload size

+ 1 - 1
.github/workflows/integration_app_harness.yml

@@ -45,7 +45,7 @@ jobs:
           python-version: ${{ matrix.python-version }}
           run-poetry-install: true
           create-venv-at-path: .venv
-      - run: poetry run pip install pyvirtualdisplay pillow
+      - run: poetry run uv pip install pyvirtualdisplay pillow
       - name: Run app harness tests
         env:
           SCREENSHOT_DIR: /tmp/screenshots

+ 4 - 4
.github/workflows/integration_tests.yml

@@ -76,9 +76,9 @@ jobs:
       - name: Install requirements for counter example
         working-directory: ./reflex-examples/counter
         run: |
-          poetry run pip install -r requirements.txt
+          poetry run uv pip install -r requirements.txt
       - name: Install additional dependencies for DB access
-        run: poetry run pip install psycopg2-binary
+        run: poetry run uv pip install psycopg2-binary
       - name: Check export --backend-only before init for counter example
         working-directory: ./reflex-examples/counter
         run: |
@@ -154,9 +154,9 @@ jobs:
 
       - name: Install Requirements for reflex-web
         working-directory: ./reflex-web
-        run: poetry run pip install -r requirements.txt
+        run: poetry run uv pip install -r requirements.txt
       - name: Install additional dependencies for DB access
-        run: poetry run pip install psycopg2-binary
+        run: poetry run uv pip install psycopg2-binary
       - name: Init Website for reflex-web
         working-directory: ./reflex-web
         run: poetry run reflex init

+ 6 - 1
.github/workflows/integration_tests_wsl.yml

@@ -56,11 +56,16 @@ jobs:
         run: |
           poetry install
 
+      - name: Install uv
+        shell: wsl-bash {0}
+        run: |
+          poetry run pip install uv
+
       - name: Install requirements for counter example
         working-directory: ./reflex-examples/counter
         shell: wsl-bash {0}
         run: |
-          poetry run pip install -r requirements.txt
+          poetry run uv pip install -r requirements.txt
       - name: Check export --backend-only before init for counter example
         working-directory: ./reflex-examples/counter
         shell: wsl-bash {0}

+ 1 - 1
.github/workflows/pre-commit.yml

@@ -28,7 +28,7 @@ jobs:
           create-venv-at-path: .venv
       # TODO pre-commit related stuff can be cached too (not a bottleneck yet)
       - run: |
-          poetry run pip install pre-commit
+          poetry run uv pip install pre-commit
           poetry run pre-commit run --all-files
         env:
           SKIP: update-pyi-files

+ 1 - 1
.github/workflows/unit_tests.yml

@@ -80,6 +80,6 @@ jobs:
       - name: Run unit tests w/ pydantic v1
         run: |
           export PYTHONUNBUFFERED=1
-          poetry run pip install "pydantic~=1.10"
+          poetry run uv pip install "pydantic~=1.10"
           poetry run pytest tests --cov --no-cov-on-fail --cov-report=
       - run: poetry run coverage html