Skip to content

Commit 7ba67fa

Browse files
authored
Merge branch 'main' into patch-1
2 parents 74008c6 + ce22f2a commit 7ba67fa

Some content is hidden

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

53 files changed

+315
-11223
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@v5
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@v5
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.3

.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@v5
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: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ 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"
@@ -36,15 +35,23 @@ jobs:
3635
pydantic-version:
3736
- pydantic-v1
3837
- pydantic-v2
38+
include:
39+
- os: ubuntu-22.04
40+
python-version: "3.7"
41+
pydantic-version: pydantic-v1
42+
- os: ubuntu-22.04
43+
python-version: "3.7"
44+
pydantic-version: pydantic-v2
3945
fail-fast: false
46+
runs-on: ${{ matrix.os }}
4047
steps:
4148
- uses: actions/checkout@v4
4249
- name: Set up Python
4350
uses: actions/setup-python@v5
4451
with:
4552
python-version: ${{ matrix.python-version }}
4653
- name: Setup uv
47-
uses: astral-sh/setup-uv@v3
54+
uses: astral-sh/setup-uv@v5
4855
with:
4956
version: "0.4.15"
5057
enable-cache: true
@@ -92,7 +99,7 @@ jobs:
9299
with:
93100
python-version: '3.12'
94101
- name: Setup uv
95-
uses: astral-sh/setup-uv@v3
102+
uses: astral-sh/setup-uv@v5
96103
with:
97104
version: "0.4.15"
98105
enable-cache: true

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)