Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from poetry to uv, use python 3.12 #45

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,48 @@ 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
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: authpage/package-lock.json
version: "0.5.5"
enable-cache: true
cache-dependency-glob: "./backend/uv.lock"
- name: uv sync
run: uv sync --frozen --group dev
- name: Cache authpage
id: cached-authpage
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: authpage-${{ hashFiles('authpage') }}
path: backend/src/apiserver/resources/static/credentials
- uses: actions/setup-node@v4
if: ${{ steps.cached-authpage.outputs.cache-hit != 'true' }}
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: authpage/package-lock.json
- name: Build credentials
if: ${{ steps.cached-authpage.outputs.cache-hit != 'true' }}
run: |
npm install
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
uses: actions/cache@v4
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
24 changes: 13 additions & 11 deletions .github/workflows/kv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,29 @@ 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
id: cached-librejson
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: deploy/context/librejson.so
key: rejson_module-${{ env.REJSON_VERSION }}
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
24 changes: 13 additions & 11 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,15 +43,15 @@ 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
shopt -s dotglob
mv deploy/context/envauthpage/* deploy/context/authpage
- name: Cache authpage
id: cached-authpage
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: authpage-${{ hashFiles('deploy/context/authpage') }}
path: deploy/context/backend/src/apiserver/resources/static/credentials
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