Skip to content

Commit

Permalink
switch from poetry to uv, use python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
tiptenbrink committed Dec 1, 2024
1 parent cc17878 commit 7a5b70b
Show file tree
Hide file tree
Showing 41 changed files with 1,943 additions and 3,233 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
working-directory: backend
steps:
- uses: actions/checkout@v4
- run: pipx install poetry==1.7.1
- uses: actions/setup-python@v4
- name: uv
id: setup-uv
uses: astral-sh/setup-uv@v4
with:
python-version: '3.11'
cache: 'poetry'
cache-dependency-path: backend/poetry.lock
- run: |
poetry env use python3.11
poetry install --sync
version: "0.5.5"
enable-cache: true
cache-dependency-glob: "./backend/uv.lock"
- name: uv sync
run: uv sync --frozen --group dev
- uses: actions/setup-node@v4
with:
node-version: '20'
Expand All @@ -42,20 +42,20 @@ jobs:
npm run build
working-directory: ${{ github.workspace }}/authpage
- name: Pytest
run: poetry run pytest
run: uv run pytest
env:
QUERY_TEST: true
- name: Black
run: poetry run black src tests
run: uv run black src tests
- name: Ruff
run: poetry run ruff src tests
run: uv run ruff check src tests
- name: Cache mypy results
uses: actions/cache@v3
with:
key: mypy-${{ hashFiles('backend/poetry.lock') }}
key: mypy-${{ hashFiles('backend/uv.lock') }}
path: backend/.mypy_cache
- name: Mypy
run: poetry run mypy
run: uv run mypy
services:
postgres:
image: ghcr.io/dsav-dodeka/postgres:localdev
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:

jobs:
backend-ci:
uses: DSAV-Dodeka/dodeka/.github/workflows/backend.yml@main
uses: DSAV-Dodeka/dodeka/.github/workflows/backend.yml@uv-312

config-deploy:
runs-on: ubuntu-latest
Expand All @@ -22,13 +22,15 @@ jobs:
working-directory: deploy
steps:
- uses: actions/checkout@v4
- run: pipx install poetry==1.7.1
- uses: actions/setup-python@v4
- name: uv
id: setup-uv
uses: astral-sh/setup-uv@v4
with:
python-version: '3.11'
cache: 'poetry'
cache-dependency-path: deploy/poetry.lock
- run: poetry install
version: "0.5.5"
enable-cache: true
cache-dependency-glob: "./deploy/uv.lock"
- name: uv sync
run: uv sync --frozen
# Build config using tiptenbrink/confspawn
- uses: taiki-e/install-action@v2
with:
Expand All @@ -50,25 +52,25 @@ jobs:
needs: [backend-ci, config-deploy]
strategy:
matrix:
target: ['localdev', 'staging', 'production' ]
uses: DSAV-Dodeka/dodeka/.github/workflows/db.yml@main
target: ['localdev' ]
uses: DSAV-Dodeka/dodeka/.github/workflows/db.yml@uv-312
with:
env: ${{ matrix.target }}

build-server:
needs: [backend-ci, config-deploy]
strategy:
matrix:
target: ['localdev', 'staging', 'production' ]
uses: DSAV-Dodeka/dodeka/.github/workflows/server.yml@main
target: ['localdev' ]
uses: DSAV-Dodeka/dodeka/.github/workflows/server.yml@uv-312
with:
env: ${{ matrix.target }}

build-kv:
needs: [backend-ci, config-deploy]
strategy:
matrix:
target: ['localdev', 'staging', 'production' ]
uses: DSAV-Dodeka/dodeka/.github/workflows/kv.yml@main
target: ['localdev' ]
uses: DSAV-Dodeka/dodeka/.github/workflows/kv.yml@uv-312
with:
env: ${{ matrix.target }}
18 changes: 10 additions & 8 deletions .github/workflows/db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@ jobs:
working-directory: deploy
steps:
- uses: actions/checkout@v4
- run: pipx install poetry==1.7.1
- uses: actions/setup-python@v4
- name: uv
id: setup-uv
uses: astral-sh/setup-uv@v4
with:
python-version: '3.10'
cache: 'poetry'
cache-dependency-path: deploy/poetry.lock
- run: poetry install
version: "0.5.5"
enable-cache: true
cache-dependency-glob: "./deploy/uv.lock"
- name: uv sync
run: uv sync --frozen
- name: Config
run: |
poetry run confspawn -c config.toml -s ./build/container/db -t ./context -e ${{ inputs.env }}
uv run confspawn -c config.toml -s ./build/container/db -t ./context -e ${{ inputs.env }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -51,7 +53,7 @@ jobs:
run: echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# We need to use the image name in each tag, so we set that to an env as well
- name: Image name
run: echo "IMAGE_NM=$(poetry run confenv -c config.toml -v db.image_name -e ${{ inputs.env }})" >> $GITHUB_ENV
run: echo "IMAGE_NM=$(uv run confenv -c config.toml -v db.image_name -e ${{ inputs.env }})" >> $GITHUB_ENV

##### not-production will get :<env> and :<env>-<commit sha>, production only gets :<commit sha>
##### because for production the 'latest' should only be on a release
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/kv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,24 @@ jobs:
working-directory: deploy
steps:
- uses: actions/checkout@v4
- run: pipx install poetry==1.7.1
- uses: actions/setup-python@v4
- name: uv
id: setup-uv
uses: astral-sh/setup-uv@v4
with:
python-version: '3.10'
cache: 'poetry'
cache-dependency-path: deploy/poetry.lock
- run: poetry install
version: "0.5.5"
enable-cache: true
cache-dependency-glob: "./deploy/uv.lock"
- name: uv sync
run: uv sync --frozen
# Build config using tiptenbrink/confspawn
- name: Config
run: |
poetry run confspawn -c config.toml -s ./build/container/kv -t ./context -e ${{ inputs.env }}
poetry run confspawn -c config.toml -s ./build/container/librejson -t ./contextlibrejson -e ${{ inputs.env }}
uv run confspawn -c config.toml -s ./build/container/kv -t ./context -e ${{ inputs.env }}
uv run confspawn -c config.toml -s ./build/container/librejson -t ./contextlibrejson -e ${{ inputs.env }}
# Set env from config.toml
- name: Set env.REJSON_VERSION
run: |
export REJSON_VERSION=$(poetry run confenv -c config.toml -v kv.redisjson_version)
export REJSON_VERSION=$(uv run confenv -c config.toml -v kv.redisjson_version)
echo "REJSON_VERSION=$REJSON_VERSION" >> $GITHUB_ENV
# If librejson was previously built and stored in cache, use it
- name: Load cached librejson.so
Expand Down Expand Up @@ -72,7 +74,7 @@ jobs:
run: echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# We need to use the image name in each tag, so we set that to an env as well
- name: Image name
run: echo "IMAGE_NM=$(poetry run confenv -c config.toml -v kv.image_name -e ${{ inputs.env }})" >> $GITHUB_ENV
run: echo "IMAGE_NM=$(uv run confenv -c config.toml -v kv.image_name -e ${{ inputs.env }})" >> $GITHUB_ENV

##### not-production will get :<env> and :<env>-<commit sha>, production only gets :<commit sha>
##### because for production the 'latest' should only be on a release
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ jobs:
working-directory: deploy
steps:
- uses: actions/checkout@v4
- run: pipx install poetry==1.7.1
- uses: actions/setup-python@v4
- name: uv
id: setup-uv
uses: astral-sh/setup-uv@v4
with:
python-version: '3.10'
cache: 'poetry'
cache-dependency-path: deploy/poetry.lock
- run: poetry install
version: "0.5.5"
enable-cache: true
cache-dependency-glob: "./deploy/uv.lock"
- name: uv sync
run: uv sync --frozen
- name: Config
run: |
poetry run confspawn -c config.toml -s ./build/container/server -t ./context/backend -e ${{ inputs.env }}
poetry run confspawn -c config.toml -s ./build/container/authpage -t ./context/envauthpage -e ${{ inputs.env }}
uv run confspawn -c config.toml -s ./build/container/server -t ./context/backend -e ${{ inputs.env }}
uv run confspawn -c config.toml -s ./build/container/authpage -t ./context/envauthpage -e ${{ inputs.env }}
# First the lock file and project declaration are moved
# Then the source is moved
Expand All @@ -41,7 +43,7 @@ jobs:
- name: Move source
working-directory: ${{ github.workspace }}
run: |
mv backend/poetry.lock deploy/context/backend
mv backend/uv.lock deploy/context/backend
mv backend/pyproject.toml deploy/context/backend
mv backend/src deploy/context/backend/src
mv authpage deploy/context/authpage
Expand Down Expand Up @@ -85,7 +87,7 @@ jobs:
run: echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# We need to use the image name in each tag, so we set that to an env as well
- name: Image name
run: echo "IMAGE_NM=$(poetry run confenv -c config.toml -v server.image_name -e ${{ inputs.env }})" >> $GITHUB_ENV
run: echo "IMAGE_NM=$(uv run confenv -c config.toml -v server.image_name -e ${{ inputs.env }})" >> $GITHUB_ENV

##### not-production will get :<env> and :<env>-<commit sha>, production only gets :<commit sha>
##### because for production the 'latest' should only be on a release
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
*.pyd
.coverage
__pycache__
.python-version
.DS_Store
.vscode
2 changes: 1 addition & 1 deletion actions.nu
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ let backend_dir = root backend_dir

def main [action: string] {
cd $backend_dir
poetry run python actions/actions.py $action
uv run python actions/actions.py $action
}
1 change: 1 addition & 0 deletions backend/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
Empty file added backend/README.md
Empty file.
Loading

0 comments on commit 7a5b70b

Please sign in to comment.