Skip to content

Commit 6e94e6f

Browse files
authored
Merge branch 'main' into main
2 parents 804c693 + 990f8f4 commit 6e94e6f

Some content is hidden

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

68 files changed

+421
-10776
lines changed

.github/workflows/build-docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
- mkdocs.no-insiders.yml
4242
- .github/workflows/build-docs.yml
4343
- .github/workflows/deploy-docs.yml
44+
- data/**
4445
4546
build-docs:
4647
needs:
@@ -58,7 +59,7 @@ jobs:
5859
with:
5960
python-version: "3.11"
6061
- name: Setup uv
61-
uses: astral-sh/setup-uv@v3
62+
uses: astral-sh/setup-uv@v6
6263
with:
6364
version: "0.4.15"
6465
enable-cache: true

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
with:
3030
python-version: "3.11"
3131
- name: Setup uv
32-
uses: astral-sh/setup-uv@v3
32+
uses: astral-sh/setup-uv@v6
3333
with:
3434
version: "0.4.15"
3535
enable-cache: true

.github/workflows/latest-changes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
3131
with:
3232
limit-access-to-actor: true
33-
- uses: tiangolo/[email protected].1
33+
- uses: tiangolo/[email protected].2
3434
with:
3535
token: ${{ secrets.GITHUB_TOKEN }}
3636
latest_changes_file: docs/release-notes.md

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
3535
run: python -m build
3636
- name: Publish
37-
uses: pypa/gh-action-pypi-publish@v1.9.0
37+
uses: pypa/gh-action-pypi-publish@v1.12.4

.github/workflows/smokeshow.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
python-version: '3.9'
2323
- name: Setup uv
24-
uses: astral-sh/setup-uv@v3
24+
uses: astral-sh/setup-uv@v6
2525
with:
2626
version: "0.4.15"
2727
enable-cache: true
@@ -35,7 +35,17 @@ jobs:
3535
path: htmlcov
3636
github-token: ${{ secrets.GITHUB_TOKEN }}
3737
run-id: ${{ github.event.workflow_run.id }}
38-
- run: smokeshow upload htmlcov
38+
# Try 5 times to upload coverage to smokeshow
39+
- name: Upload coverage to Smokeshow
40+
run: |
41+
for i in 1 2 3 4 5; do
42+
if smokeshow upload htmlcov; then
43+
echo "Smokeshow upload success!"
44+
break
45+
fi
46+
echo "Smokeshow upload error, sleep 1 sec and try again."
47+
sleep 1
48+
done
3949
env:
4050
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
4151
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 95

.github/workflows/test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,29 @@ env:
2323

2424
jobs:
2525
test:
26-
runs-on: ubuntu-latest
2726
strategy:
2827
matrix:
28+
os: [ ubuntu-latest ]
2929
python-version:
30-
- "3.7"
3130
- "3.8"
3231
- "3.9"
3332
- "3.10"
3433
- "3.11"
3534
- "3.12"
35+
- "3.13"
3636
pydantic-version:
3737
- pydantic-v1
3838
- pydantic-v2
3939
fail-fast: false
40+
runs-on: ${{ matrix.os }}
4041
steps:
4142
- uses: actions/checkout@v4
4243
- name: Set up Python
4344
uses: actions/setup-python@v5
4445
with:
4546
python-version: ${{ matrix.python-version }}
4647
- name: Setup uv
47-
uses: astral-sh/setup-uv@v3
48+
uses: astral-sh/setup-uv@v6
4849
with:
4950
version: "0.4.15"
5051
enable-cache: true
@@ -64,10 +65,9 @@ jobs:
6465
run: uv pip install --upgrade "pydantic>=1.10.0,<2.0.0"
6566
- name: Install Pydantic v2
6667
if: matrix.pydantic-version == 'pydantic-v2'
67-
run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0" "typing-extensions==4.6.1"
68+
run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0"
6869
- name: Lint
69-
# Do not run on Python 3.7 as mypy behaves differently
70-
if: matrix.python-version != '3.7' && matrix.pydantic-version == 'pydantic-v2'
70+
if: matrix.pydantic-version == 'pydantic-v2' && matrix.python-version != '3.8'
7171
run: bash scripts/lint.sh
7272
- run: mkdir coverage
7373
- name: Test
@@ -90,9 +90,9 @@ jobs:
9090
- uses: actions/checkout@v4
9191
- uses: actions/setup-python@v5
9292
with:
93-
python-version: '3.12'
93+
python-version: '3.13'
9494
- name: Setup uv
95-
uses: astral-sh/setup-uv@v3
95+
uses: astral-sh/setup-uv@v6
9696
with:
9797
version: "0.4.15"
9898
enable-cache: true

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default_language_version:
44
python: python3.10
55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.6.0
7+
rev: v5.0.0
88
hooks:
99
- id: check-added-large-files
1010
- id: check-toml
@@ -14,7 +14,7 @@ repos:
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace
1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.6.5
17+
rev: v0.11.2
1818
hooks:
1919
- id: ruff
2020
args:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<em>SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.</em>
77
</p>
88
<p align="center">
9-
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3ATest" target="_blank">
10-
<img src="https://github.com/fastapi/sqlmodel/workflows/Test/badge.svg" alt="Test">
9+
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3ATest+event%3Apush+branch%3Amain" target="_blank">
10+
<img src="https://github.com/fastapi/sqlmodel/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test">
1111
</a>
1212
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3APublish" target="_blank">
13-
<img src="https://github.com/fastapi/sqlmodel/workflows/Publish/badge.svg" alt="Publish">
13+
<img src="https://github.com/fastapi/sqlmodel/actions/workflows/publish.yml/badge.svg" alt="Publish">
1414
</a>
1515
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/sqlmodel" target="_blank">
1616
<img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/sqlmodel.svg" alt="Coverage">

data/members.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
members:
22
- login: tiangolo
3-
- login: estebanx64
43
- login: alejsdev

docs/advanced/decimal.md

Lines changed: 3 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -33,45 +33,7 @@ For the database, **SQLModel** will use <a href="https://docs.sqlalchemy.org/en/
3333

3434
Let's say that each hero in the database will have an amount of money. We could make that field a `Decimal` type using the `condecimal()` function:
3535

36-
//// tab | Python 3.10+
37-
38-
```python hl_lines="11"
39-
{!./docs_src/advanced/decimal/tutorial001_py310.py[ln:1-11]!}
40-
41-
# More code here later 👇
42-
```
43-
44-
////
45-
46-
//// tab | Python 3.7+
47-
48-
```python hl_lines="12"
49-
{!./docs_src/advanced/decimal/tutorial001.py[ln:1-12]!}
50-
51-
# More code here later 👇
52-
```
53-
54-
////
55-
56-
/// details | 👀 Full file preview
57-
58-
//// tab | Python 3.10+
59-
60-
```Python
61-
{!./docs_src/advanced/decimal/tutorial001_py310.py!}
62-
```
63-
64-
////
65-
66-
//// tab | Python 3.7+
67-
68-
```Python
69-
{!./docs_src/advanced/decimal/tutorial001.py!}
70-
```
71-
72-
////
73-
74-
///
36+
{* ./docs_src/advanced/decimal/tutorial001_py310.py ln[1:11] hl[11] *}
7537

7638
Here we are saying that `money` can have at most `5` digits with `max_digits`, **this includes the integers** (to the left of the decimal dot) **and the decimals** (to the right of the decimal dot).
7739

@@ -105,97 +67,13 @@ Make sure you adjust the number of digits and decimal places for your own needs,
10567

10668
When creating new models you can actually pass normal (`float`) numbers, Pydantic will automatically convert them to `Decimal` types, and **SQLModel** will store them as `Decimal` types in the database (using SQLAlchemy).
10769

108-
//// tab | Python 3.10+
109-
110-
```Python hl_lines="4-6"
111-
# Code above omitted 👆
112-
113-
{!./docs_src/advanced/decimal/tutorial001_py310.py[ln:24-34]!}
114-
115-
# Code below omitted 👇
116-
```
117-
118-
////
119-
120-
//// tab | Python 3.7+
121-
122-
```Python hl_lines="4-6"
123-
# Code above omitted 👆
124-
125-
{!./docs_src/advanced/decimal/tutorial001.py[ln:25-35]!}
126-
127-
# Code below omitted 👇
128-
```
129-
130-
////
131-
132-
/// details | 👀 Full file preview
133-
134-
//// tab | Python 3.10+
135-
136-
```Python
137-
{!./docs_src/advanced/decimal/tutorial001_py310.py!}
138-
```
139-
140-
////
141-
142-
//// tab | Python 3.7+
143-
144-
```Python
145-
{!./docs_src/advanced/decimal/tutorial001.py!}
146-
```
147-
148-
////
149-
150-
///
70+
{* ./docs_src/advanced/decimal/tutorial001_py310.py ln[24:34] hl[25:27] *}
15171

15272
## Select Decimal data
15373

15474
Then, when working with Decimal types, you can confirm that they indeed avoid those rounding errors from floats:
15575

156-
//// tab | Python 3.10+
157-
158-
```Python hl_lines="15-16"
159-
# Code above omitted 👆
160-
161-
{!./docs_src/advanced/decimal/tutorial001_py310.py[ln:37-50]!}
162-
163-
# Code below omitted 👇
164-
```
165-
166-
////
167-
168-
//// tab | Python 3.7+
169-
170-
```Python hl_lines="15-16"
171-
# Code above omitted 👆
172-
173-
{!./docs_src/advanced/decimal/tutorial001.py[ln:38-51]!}
174-
175-
# Code below omitted 👇
176-
```
177-
178-
////
179-
180-
/// details | 👀 Full file preview
181-
182-
//// tab | Python 3.10+
183-
184-
```Python
185-
{!./docs_src/advanced/decimal/tutorial001_py310.py!}
186-
```
187-
188-
////
189-
190-
//// tab | Python 3.7+
191-
192-
```Python
193-
{!./docs_src/advanced/decimal/tutorial001.py!}
194-
```
195-
196-
////
197-
198-
///
76+
{* ./docs_src/advanced/decimal/tutorial001_py310.py ln[37:50] hl[49:50] *}
19977

20078
## Review the results
20179

0 commit comments

Comments
 (0)