Skip to content

Commit

Permalink
🔨 [maykinmedia/open-api-framework#81] Switch from pip-compile to UV
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Jan 3, 2025
1 parent 2d1abfa commit b579956
Show file tree
Hide file tree
Showing 9 changed files with 610 additions and 231 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/oaf-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ on:

jobs:
open-api-workflow-check-oas:
uses: maykinmedia/open-api-workflows/.github/workflows/oaf-check.yml@v2
# TODO switch to proper version
uses: maykinmedia/open-api-workflows/.github/workflows/oaf-check.yml@feature/switch-to-uv

with:
python-version: '3.11'
Expand Down
30 changes: 14 additions & 16 deletions bin/compile_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
#!/bin/bash

#!/bin/sh
#
# Compile the dependencies for production, CI and development.
#
# Usage, in the root of the project:
#
# ./bin/compile_dependencies.sh
#
# Any extra flags/arguments passed to this wrapper script are passed down to pip-compile.
# Any extra flags/arguments passed to this wrapper script are passed down to uv pip compile.
# E.g. to update a package:
#
# ./bin/compile_dependencies.sh --upgrade-package django

set -ex

command -v uv || (echo "uv not found on PATH. Install it https://astral.sh/uv" >&2 && exit 1)

cwd="${PWD}"
toplevel=$(git rev-parse --show-toplevel)

cd $toplevel
cd "${toplevel}"

export CUSTOM_COMPILE_COMMAND="./bin/compile_dependencies.sh"
export UV_CUSTOM_COMPILE_COMMAND="./bin/compile_dependencies.sh"

# Base (& prod) deps
pip-compile \
--no-emit-index-url \
uv pip compile \
--output-file requirements/base.txt \
"$@" \
requirements/base.in

# Dependencies for testing
pip-compile \
--no-emit-index-url \
uv pip compile \
--output-file requirements/ci.txt \
"$@" \
requirements/base.txt \
requirements/test-tools.in \
requirements/ci.in
requirements/docs.in

# Dev depedencies - exact same set as CI + some extra tooling
pip-compile \
--no-emit-index-url \
uv pip compile \
--output-file requirements/dev.txt \
"$@" \
requirements/base.txt \
requirements/test-tools.in \
requirements/dev.in

cd "${cwd}"
14 changes: 5 additions & 9 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# This file was autogenerated by uv via the following command:
# ./bin/compile_dependencies.sh
#
amqp==5.2.0
# via kombu
annotated-types==0.7.0
Expand Down Expand Up @@ -167,7 +163,7 @@ django-solo==2.3.0
# mozilla-django-oidc-db
# notifications-api-common
# zgw-consumers
django-two-factor-auth[phonenumberslite,webauthn]==1.16.0
django-two-factor-auth==1.16.0
# via maykin-2fa
djangorestframework==3.15.2
# via
Expand All @@ -189,7 +185,7 @@ djangorestframework-inclusions==1.2.0
# via open-api-framework
drf-nested-routers==0.94.1
# via commonground-api-common
drf-spectacular[sidecar]==0.27.2
drf-spectacular==0.27.2
# via open-api-framework
drf-spectacular-sidecar==2024.7.1
# via drf-spectacular
Expand Down Expand Up @@ -237,7 +233,7 @@ maykin-2fa==1.0.1
# via open-api-framework
mozilla-django-oidc==4.0.1
# via mozilla-django-oidc-db
mozilla-django-oidc-db[setup-configuration]==0.21.1
mozilla-django-oidc-db==0.21.1
# via
# -r requirements/base.in
# open-api-framework
Expand Down Expand Up @@ -267,7 +263,7 @@ pydantic==2.10.2
# pydantic-settings
pydantic-core==2.27.1
# via pydantic
pydantic-settings[yaml]==2.6.1
pydantic-settings==2.6.1
# via django-setup-configuration
pyjwt==2.9.0
# via
Expand Down
2 changes: 0 additions & 2 deletions requirements/ci.in

This file was deleted.

Loading

0 comments on commit b579956

Please sign in to comment.