Skip to content

Commit e51101a

Browse files
committed
⬆️ Migrate to uv
1 parent f0d4d4b commit e51101a

17 files changed

+2616
-105
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ updates:
88
commit-message:
99
prefix:
1010
# Python
11-
- package-ecosystem: "pip"
11+
- package-ecosystem: "uv"
1212
directory: "/"
1313
schedule:
1414
interval: "daily"

.github/workflows/build-docs.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ on:
88
- opened
99
- synchronize
1010

11-
env:
12-
UV_SYSTEM_PYTHON: 1
13-
14-
1511
jobs:
1612
changes:
1713
runs-on: ubuntu-latest
@@ -32,8 +28,8 @@ jobs:
3228
- README.md
3329
- docs/**
3430
- docs_src/**
35-
- requirements-docs.txt
3631
- pyproject.toml
32+
- uv.lock
3733
- mkdocs.yml
3834
- mkdocs.env.yml
3935
- .github/workflows/build-docs.yml
@@ -54,25 +50,24 @@ jobs:
5450
- name: Set up Python
5551
uses: actions/setup-python@v6
5652
with:
57-
python-version: "3.11"
53+
python-version-file: ".python-version"
5854
- name: Setup uv
5955
uses: astral-sh/setup-uv@v7
6056
with:
61-
version: "0.4.15"
6257
enable-cache: true
6358
cache-dependency-glob: |
64-
requirements**.txt
6559
pyproject.toml
60+
uv.lock
6661
- name: Install docs extras
67-
run: uv pip install -r requirements-docs.txt
62+
run: uv sync --locked --group docs
6863
- uses: actions/cache@v5
6964
with:
7065
key: mkdocs-cards-${{ github.ref }}
7166
path: .cache
7267
- name: Verify README
73-
run: python ./scripts/docs.py verify-readme
68+
run: uv run ./scripts/docs.py verify-readme
7469
- name: Build Docs
75-
run: python ./scripts/docs.py build
70+
run: uv run ./scripts/docs.py build
7671
- uses: actions/upload-artifact@v6
7772
with:
7873
name: docs-site

.github/workflows/deploy-docs.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ permissions:
1212
pull-requests: write
1313
statuses: write
1414

15-
env:
16-
UV_SYSTEM_PYTHON: 1
17-
1815
jobs:
1916
deploy-docs:
2017
runs-on: ubuntu-latest
@@ -27,19 +24,18 @@ jobs:
2724
- name: Set up Python
2825
uses: actions/setup-python@v6
2926
with:
30-
python-version: "3.11"
27+
python-version-file: ".python-version"
3128
- name: Setup uv
3229
uses: astral-sh/setup-uv@v7
3330
with:
34-
version: "0.4.15"
3531
enable-cache: true
3632
cache-dependency-glob: |
37-
requirements**.txt
3833
pyproject.toml
34+
uv.lock
3935
- name: Install GitHub Actions dependencies
40-
run: uv pip install -r requirements-github-actions.txt
36+
run: uv sync --locked --group github-actions
4137
- name: Deploy Docs Status Pending
42-
run: python ./scripts/deploy_docs_status.py
38+
run: uv run ./scripts/deploy_docs_status.py
4339
env:
4440
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4541
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
@@ -70,14 +66,14 @@ jobs:
7066
command: pages deploy ./site --project-name=${{ env.PROJECT_NAME }} --branch=${{ env.BRANCH }}
7167
- name: Deploy Docs Status Error
7268
if: failure()
73-
run: python ./scripts/deploy_docs_status.py
69+
run: uv run ./scripts/deploy_docs_status.py
7470
env:
7571
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7672
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
7773
RUN_ID: ${{ github.run_id }}
7874
STATE: "error"
7975
- name: Comment Deploy
80-
run: python ./scripts/deploy_docs_status.py
76+
run: uv run ./scripts/deploy_docs_status.py
8177
env:
8278
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8379
DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }}

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,15 @@ jobs:
4040
- name: Set up Python
4141
uses: actions/setup-python@v6
4242
with:
43-
python-version: "3.14"
43+
python-version-file: ".python-version"
4444
- name: Setup uv
4545
uses: astral-sh/setup-uv@v7
4646
with:
4747
cache-dependency-glob: |
48-
requirements**.txt
4948
pyproject.toml
5049
uv.lock
5150
- name: Install Dependencies
52-
run: |
53-
uv venv
54-
uv pip install -r requirements.txt
51+
run: uv sync --locked
5552
- name: Run prek - pre-commit
5653
id: precommit
5754
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure

.github/workflows/publish.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,22 @@ jobs:
2121
- sqlmodel-slim
2222
permissions:
2323
id-token: write
24+
contents: read
2425
steps:
26+
- name: Dump GitHub context
27+
env:
28+
GITHUB_CONTEXT: ${{ toJson(github) }}
29+
run: echo "$GITHUB_CONTEXT"
2530
- uses: actions/checkout@v6
2631
- name: Set up Python
2732
uses: actions/setup-python@v6
2833
with:
29-
python-version: "3.11"
30-
- name: Install build dependencies
31-
run: pip install build
34+
python-version-file: ".python-version"
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v7
3237
- name: Build distribution
38+
run: uv build
3339
env:
3440
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
35-
run: python -m build
3641
- name: Publish
37-
uses: pypa/gh-action-pypi-publish@v1.13.0
42+
run: uv publish

.github/workflows/smokeshow.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,21 @@ on:
88
permissions:
99
statuses: write
1010

11-
env:
12-
UV_SYSTEM_PYTHON: 1
13-
1411
jobs:
1512
smokeshow:
1613
runs-on: ubuntu-latest
1714
steps:
1815
- uses: actions/checkout@v6
1916
- uses: actions/setup-python@v6
2017
with:
21-
python-version: '3.13'
18+
python-version-file: ".python-version"
2219
- name: Setup uv
2320
uses: astral-sh/setup-uv@v7
2421
with:
2522
cache-dependency-glob: |
26-
requirements**.txt
2723
pyproject.toml
28-
- run: uv pip install -r requirements-github-actions.txt
24+
uv.lock
25+
- run: uv sync --locked --group github-actions
2926
- uses: actions/download-artifact@v7
3027
with:
3128
name: coverage-html

.github/workflows/test-redistribute.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up Python
2727
uses: actions/setup-python@v6
2828
with:
29-
python-version: "3.10"
29+
python-version-file: ".python-version"
3030
- name: Install build dependencies
3131
run: pip install build
3232
- name: Build source distribution
@@ -40,7 +40,7 @@ jobs:
4040
- name: Install test dependencies
4141
run: |
4242
cd dist/sqlmodel*/
43-
pip install -r requirements-tests.txt
43+
pip install --group tests --editable .
4444
env:
4545
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
4646
- name: Run source distribution tests

.github/workflows/test.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919
- cron: "0 0 * * 1"
2020

2121
env:
22-
UV_SYSTEM_PYTHON: 1
22+
UV_NO_SYNC: true
2323

2424
jobs:
2525
test:
@@ -42,6 +42,8 @@ jobs:
4242
python-version: "3.13"
4343
fail-fast: false
4444
runs-on: ${{ matrix.os }}
45+
env:
46+
UV_PYTHON: ${{ matrix.python-version }}
4547
steps:
4648
- uses: actions/checkout@v6
4749
- name: Set up Python
@@ -51,22 +53,21 @@ jobs:
5153
- name: Setup uv
5254
uses: astral-sh/setup-uv@v7
5355
with:
54-
version: "0.4.15"
5556
enable-cache: true
5657
cache-dependency-glob: |
57-
requirements**.txt
5858
pyproject.toml
59+
uv.lock
5960
# Allow debugging with tmate
6061
- name: Setup tmate session
6162
uses: mxschmitt/action-tmate@v3
6263
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
6364
with:
6465
limit-access-to-actor: true
6566
- name: Install Dependencies
66-
run: uv pip install -r requirements-tests.txt
67+
run: uv sync --locked --group tests
6768
- run: mkdir coverage
6869
- name: Test
69-
run: bash scripts/test.sh
70+
run: uv run bash scripts/test.sh
7071
env:
7172
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.pydantic-version }}
7273
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
@@ -85,33 +86,32 @@ jobs:
8586
- uses: actions/checkout@v6
8687
- uses: actions/setup-python@v6
8788
with:
88-
python-version: '3.13'
89+
python-version-file: ".python-version"
8990
- name: Setup uv
9091
uses: astral-sh/setup-uv@v7
9192
with:
92-
version: "0.4.15"
9393
enable-cache: true
9494
cache-dependency-glob: |
95-
requirements**.txt
9695
pyproject.toml
96+
uv.lock
9797
- name: Get coverage files
9898
uses: actions/download-artifact@v7
9999
with:
100100
pattern: coverage-*
101101
path: coverage
102102
merge-multiple: true
103103
- name: Install Dependencies
104-
run: uv pip install -r requirements-tests.txt
104+
run: uv sync --locked --group tests
105105
- run: ls -la coverage
106-
- run: coverage combine coverage
107-
- run: coverage html --title "Coverage for ${{ github.sha }}"
106+
- run: uv run coverage combine coverage
107+
- run: uv run coverage html --title "Coverage for ${{ github.sha }}"
108108
- name: Store coverage HTML
109109
uses: actions/upload-artifact@v6
110110
with:
111111
name: coverage-html
112112
path: htmlcov
113113
include-hidden-files: true
114-
- run: coverage report --fail-under=99
114+
- run: uv run coverage report --fail-under=99
115115

116116
# https://github.com/marketplace/actions/alls-green#why
117117
alls-green: # This job does nothing and is only used for the branch protection

.python-version

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

docs/contributing.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ First, you might want to see the basic ways to [help SQLModel and get help](help
66

77
If you already cloned the <a href="https://github.com/fastapi/sqlmodel" class="external-link" target="_blank">sqlmodel repository</a> and you want to deep dive in the code, here are some guidelines to set up your environment.
88

9-
### Virtual Environment
9+
### Install Requirements Using `uv`
1010

11-
Follow the instructions to create and activate a [virtual environment](virtual-environments.md){.internal-link target=_blank} for the internal code of `sqlmodel`.
12-
13-
### Install Requirements Using `pip`
14-
15-
After activating the environment, install the required packages:
11+
Create a virtual environment and install the required packages in one command:
1612

1713
<div class="termy">
1814

1915
```console
20-
$ pip install -r requirements.txt
16+
$ uv sync
2117

2218
---> 100%
2319
```

0 commit comments

Comments
 (0)