Commit 5dee9c51 authored by Ruben ten Hove's avatar Ruben ten Hove
Browse files

Merge branch 'uv' into 'main'

feat: option to use uv pip to install python packages

Closes #91

See merge request just-ci/templates!217
parents 22f624a0 4f096905
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -140,6 +140,18 @@ jobs:python:custom-image:
    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
      changes: *python_changes

jobs:python:uv:
  stage: test
  variables:
    PIP_ENABLE_UV: "true"
  trigger:
    include:
      - local: tests/jobs/python.yml
    strategy: depend
  rules:
    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
      changes: *python_changes

# child pipelines to test our off-the-shelf pipelines
pipelines:c:
  stage: test
+11 −3
Original line number Diff line number Diff line
@@ -9,8 +9,10 @@ variables:
  PIP_DISABLE_PIP_VERSION_CHECK: "true"
  PIP_ROOT_USER_ACTION: ignore
  PIP_PACKAGE_INSTALL_DEFAULT_ARGS:
    --no-input -qqq --log=${CI_PROJECT_DIR}/pip-log.txt
    --no-input -qqq --progress-bar=off --log=${CI_PROJECT_DIR}/pip-log.txt
    # If PIP_ENABLE_UV is set, then PIP_PACKAGE_INSTALL_DEFAULT_ARGS is overwritten by UV_PIP_PACKAGE_INSTALL_DEFAULT_ARGS
  PIP_PACKAGE_INSTALL_EXTRA_ARGS: ""
  UV_PIP_PACKAGE_INSTALL_DEFAULT_ARGS: -q --system

image:
  name: registry.gitlab.com/just-ci/images/python:$PYVERSION
@@ -23,8 +25,8 @@ image:
  stage: test
  script:
    - pip3 --version
    - pip3 install -q --log=${CI_PROJECT_DIR}/pip-log.txt ${JOB_PACKAGE} && echo
      "[+] ${JOB_PACKAGE} installed."
    - pip3 install -qqq --progress-bar=off --log=${CI_PROJECT_DIR}/pip-log.txt
      ${JOB_PACKAGE} && echo "[+] ${JOB_PACKAGE} installed."
    - |
      echo "[*] Job info:"
      echo "Context path: ${PYTHON_CONTEXT:=.}"
@@ -41,6 +43,12 @@ image:
  stage: test
  script:
    - |
      if [ "${PIP_ENABLE_UV}" != "" ]; then
        pip3 install -qqq --progress-bar=off --log=${CI_PROJECT_DIR}/pip-log.txt uv
        shopt -s expand_aliases  # https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1083
        alias pip3="uv pip"
        export PIP_PACKAGE_INSTALL_DEFAULT_ARGS=${UV_PIP_PACKAGE_INSTALL_DEFAULT_ARGS}
      fi
      pip3 --version
      echo "[*] Installing your package using these arguments: ${PIP_PACKAGE_INSTALL_DEFAULT_ARGS} ${PIP_PACKAGE_INSTALL_EXTRA_ARGS}"