Skip to content

Commit 93d9a20

Browse files
authored
Merge pull request #1216 from clowder-framework/uv
Simple uv and ruff setup
2 parents 3b61430 + 5a1d3c0 commit 93d9a20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2248
-2797
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.venv

.github/workflows/backend.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: docker/setup-buildx-action@v2
2929
-
3030
name: Checkout
31-
uses: actions/checkout@v2
31+
uses: actions/checkout@v4
3232
-
3333
name: Login to DockerHub
3434
if: github.event_name != 'pull_request'
@@ -85,7 +85,8 @@ jobs:
8585
name: Build and push
8686
uses: docker/build-push-action@v3
8787
with:
88-
context: ./backend
88+
context: .
89+
file: ./backend/Dockerfile
8990
platforms: linux/amd64,linux/arm64
9091
push: ${{ github.event_name != 'pull_request' }}
9192
tags: ${{ steps.backendMeta.outputs.tags }}
@@ -95,20 +96,20 @@ jobs:
9596
name: Build and push
9697
uses: docker/build-push-action@v3
9798
with:
98-
context: ./backend
99+
context: .
100+
file: ./backend/heartbeat.Dockerfile
99101
platforms: linux/amd64,linux/arm64
100102
push: ${{ github.event_name != 'pull_request' }}
101103
tags: ${{ steps.heartbeatMeta.outputs.tags }}
102-
file: ./backend/heartbeat.Dockerfile
103104
labels: ${{ steps.heartbeatMeta.outputs.labels }}
104105

105106
-
106107
name: Build and push
107108
uses: docker/build-push-action@v3
108109
with:
109-
context: ./backend
110+
context: .
111+
file: ./backend/messages.Dockerfile
110112
platforms: linux/amd64,linux/arm64
111113
push: ${{ github.event_name != 'pull_request' }}
112114
tags: ${{ steps.messagesMeta.outputs.tags }}
113-
file: ./backend/messages.Dockerfile
114115
labels: ${{ steps.messagesMeta.outputs.labels }}

.github/workflows/codegen.yaml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,26 @@ jobs:
1717
timeout-minutes: 10
1818
runs-on: ubuntu-latest
1919

20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
node:
24-
- "14"
25-
2620
steps:
27-
- name: Set up QEMU
28-
uses: docker/setup-qemu-action@v2
29-
30-
- name: Set up Docker Buildx
31-
uses: docker/setup-buildx-action@v2
32-
3321
- name: Checkout
34-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
3523

3624
- name: Build Backend no push
3725
uses: docker/build-push-action@v3
3826
with:
39-
context: ./backend
27+
context: .
28+
file: ./backend/Dockerfile
4029
platforms: linux/amd64
4130
push: false
4231
tags: github-action
4332

4433
- name: Start containers
45-
run: docker compose -f "docker-compose.test.yml" up -d --build
34+
run: docker compose -f "docker-compose.yml" up -d --build
4635

47-
# setup node
4836
- name: Install node
4937
uses: actions/setup-node@v3
5038
with:
51-
node-version: ${{ matrix.node }}
39+
node-version: 16
5240

5341
- name: Install dependencies
5442
working-directory: frontend
@@ -73,4 +61,4 @@ jobs:
7361
7462
- name: Stop containers
7563
if: always()
76-
run: docker compose -f "docker-compose.test.yml" down
64+
run: docker compose -f "docker-compose.yml" down

.github/workflows/pytest.yml

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,24 @@
11
name: Pytest
2+
23
on: push
34

45
defaults:
56
run:
67
working-directory: backend
78

89
jobs:
9-
test:
10+
uv-example:
11+
name: python
1012
runs-on: ubuntu-latest
11-
timeout-minutes: 10
1213

1314
steps:
14-
- name: Check out repository code
15-
uses: actions/checkout@v2
16-
17-
- name: Setup Python
18-
uses: actions/setup-python@v4
19-
with:
20-
python-version: "3.9"
21-
22-
- name: Install pipenv
23-
run: |
24-
python -m pip install --upgrade pipenv wheel
15+
- uses: actions/checkout@v4
2516

26-
- id: cache-pipenv
27-
uses: actions/cache@v3
28-
with:
29-
path: ~/.local/share/virtualenvs
30-
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v5
3119

32-
- name: Install dependencies
33-
if: steps.cache-pipenv.outputs.cache-hit != 'true'
34-
run: |
35-
pipenv install --deploy --dev
20+
- name: Install the project
21+
run: uv sync --all-extras --dev
3622

3723
- name: Start env
3824
run: docker compose -f ../docker-compose.dev.yml up -d
@@ -42,6 +28,5 @@ jobs:
4228
run: sleep 60s
4329
shell: bash
4430

45-
- name: Run test suite
46-
run: |
47-
pipenv run pytest -v
31+
- name: Run tests
32+
run: uv run pytest app/tests/

.pre-commit-config.yaml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ repos:
33
hooks:
44
- id: extract-openapi
55
name: extract-openapi
6-
entry: pipenv run extract-openapi
6+
entry: python backend/extract-openapi.py app.main:app
77
language: system
88
pass_filenames: false
99
- repo: local
@@ -25,29 +25,21 @@ repos:
2525
name: prettier
2626
entry: bash -c "cd frontend && npx prettier src --write"
2727
language: system
28-
- repo: https://github.com/psf/black
29-
rev: 23.11.0
30-
hooks:
31-
- id: black
32-
- repo: https://github.com/PyCQA/isort
33-
rev: 5.12.0
34-
hooks:
35-
- id: isort
36-
args: [ "--profile=black" ]
3728
- repo: https://github.com/pre-commit/pre-commit-hooks
38-
rev: v4.5.0
29+
rev: v5.0.0
3930
hooks:
4031
- id: check-yaml
4132
exclude: deployments/kubernetes/charts
4233
- id: end-of-file-fixer
4334
exclude: 'openapi.json|frontend/src/openapi/v2/'
4435
- id: trailing-whitespace
4536
exclude: 'openapi.json|frontend/src/openapi/v2/'
46-
- repo: https://github.com/shellcheck-py/shellcheck-py
47-
rev: v0.9.0.6
48-
hooks:
49-
- id: shellcheck
50-
- repo: https://github.com/PyCQA/flake8
51-
rev: 6.1.0
52-
hooks:
53-
- id: flake8
37+
- repo: https://github.com/astral-sh/ruff-pre-commit
38+
# Ruff version.
39+
rev: v0.9.4
40+
hooks:
41+
# Run the linter.
42+
- id: ruff
43+
args: [ --fix ]
44+
# Run the formatter.
45+
- id: ruff-format

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

Pipfile

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)