Skip to content

Commit f4ae1b4

Browse files
authored
Merge branch 'fastapi:main' into docs-encrypted-type
2 parents beb184f + a85de91 commit f4ae1b4

15 files changed

+192
-46
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4545
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
4646
RUN_ID: ${{ github.run_id }}
47-
47+
STATE: "pending"
4848
- name: Clean site
4949
run: |
5050
rm -rf ./site
@@ -68,11 +68,19 @@ jobs:
6868
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
6969
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
7070
command: pages deploy ./site --project-name=${{ env.PROJECT_NAME }} --branch=${{ env.BRANCH }}
71+
- name: Deploy Docs Status Error
72+
if: failure()
73+
run: python ./scripts/deploy_docs_status.py
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
77+
RUN_ID: ${{ github.run_id }}
78+
STATE: "error"
7179
- name: Comment Deploy
7280
run: python ./scripts/deploy_docs_status.py
7381
env:
7482
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7583
DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }}
7684
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
7785
RUN_ID: ${{ github.run_id }}
78-
IS_DONE: "true"
86+
STATE: "success"

.github/workflows/issue-manager.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
env:
2828
GITHUB_CONTEXT: ${{ toJson(github) }}
2929
run: echo "$GITHUB_CONTEXT"
30-
- uses: tiangolo/issue-manager@0.5.1
30+
- uses: tiangolo/issue-manager@0.6.0
3131
with:
3232
token: ${{ secrets.GITHUB_TOKEN }}
3333
config: >

.github/workflows/test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ jobs:
2626
strategy:
2727
matrix:
2828
os: [ ubuntu-latest, windows-latest, macos-latest ]
29-
python-version: [ "3.13" ]
29+
python-version: [ "3.14" ]
3030
pydantic-version:
31-
- pydantic-v1
3231
- pydantic-v2
3332
include:
3433
- os: macos-latest
@@ -47,7 +46,10 @@ jobs:
4746
python-version: "3.12"
4847
pydantic-version: pydantic-v1
4948
- os: ubuntu-latest
50-
python-version: "3.12"
49+
python-version: "3.13"
50+
pydantic-version: pydantic-v1
51+
- os: macos-latest
52+
python-version: "3.13"
5153
pydantic-version: pydantic-v2
5254
fail-fast: false
5355
runs-on: ${{ matrix.os }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.13.0
17+
rev: v0.13.3
1818
hooks:
1919
- id: ruff
2020
args:

docs/release-notes.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,36 @@
22

33
## Latest Changes
44

5+
## 0.0.27
6+
7+
### Upgrades
8+
9+
* ⬆️ Add support for Python 3.14. PR [#1578](https://github.com/fastapi/sqlmodel/pull/1578) by [@svlandeg](https://github.com/svlandeg).
10+
11+
## 0.0.26
12+
13+
### Fixes
14+
15+
* 🐛 Fix attribute handling in `model_dump` for compatibility with the latest Pydantic versions. PR [#1595](https://github.com/fastapi/sqlmodel/pull/1595) by [@spazm](https://github.com/spazm).
16+
17+
### Docs
18+
19+
* 📝 Fix typo in `docs/tutorial/fastapi/simple-hero-api.md`. PR [#1583](https://github.com/fastapi/sqlmodel/pull/1583) by [@kofi-kusi](https://github.com/kofi-kusi).
20+
521
### Internal
622

23+
* ⬆ Bump mypy from 1.4.1 to 1.18.2. PR [#1560](https://github.com/fastapi/sqlmodel/pull/1560) by [@dependabot[bot]](https://github.com/apps/dependabot).
24+
* ✅ Add test that runs select with 3 or 4 arguments. PR [#1590](https://github.com/fastapi/sqlmodel/pull/1590) by [@svlandeg](https://github.com/svlandeg).
25+
* ⬆ Bump mkdocs-macros-plugin from 1.3.9 to 1.4.0. PR [#1581](https://github.com/fastapi/sqlmodel/pull/1581) by [@dependabot[bot]](https://github.com/apps/dependabot).
26+
* ⬆ Bump mkdocs-material from 9.6.20 to 9.6.21. PR [#1588](https://github.com/fastapi/sqlmodel/pull/1588) by [@dependabot[bot]](https://github.com/apps/dependabot).
27+
*[pre-commit.ci] pre-commit autoupdate. PR [#1584](https://github.com/fastapi/sqlmodel/pull/1584) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
28+
* ⬆ Bump tiangolo/issue-manager from 0.5.1 to 0.6.0. PR [#1589](https://github.com/fastapi/sqlmodel/pull/1589) by [@dependabot[bot]](https://github.com/apps/dependabot).
29+
* 👷 Update docs previews comment, single comment, add failure status. PR [#1586](https://github.com/fastapi/sqlmodel/pull/1586) by [@tiangolo](https://github.com/tiangolo).
30+
* ⬆ Bump markdown-include-variants from 0.0.4 to 0.0.5. PR [#1582](https://github.com/fastapi/sqlmodel/pull/1582) by [@dependabot[bot]](https://github.com/apps/dependabot).
31+
* ⬆ Bump typing-extensions from 4.13.2 to 4.15.0 for Python 3.9+. PR [#1580](https://github.com/fastapi/sqlmodel/pull/1580) by [@svlandeg](https://github.com/svlandeg).
32+
*[pre-commit.ci] pre-commit autoupdate. PR [#1571](https://github.com/fastapi/sqlmodel/pull/1571) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
33+
* ⬆ Bump typer from 0.17.4 to 0.19.2. PR [#1573](https://github.com/fastapi/sqlmodel/pull/1573) by [@dependabot[bot]](https://github.com/apps/dependabot).
34+
* ⬆ Bump ruff from 0.13.0 to 0.13.2. PR [#1576](https://github.com/fastapi/sqlmodel/pull/1576) by [@dependabot[bot]](https://github.com/apps/dependabot).
735
* 💚 Fix CI test suite for Windows and MacOS. PR [#1307](https://github.com/fastapi/sqlmodel/pull/1307) by [@svlandeg](https://github.com/svlandeg).
836

937
## 0.0.25

docs/tutorial/fastapi/simple-hero-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ And then create an `app` object that is an instance of that `FastAPI` class:
6060

6161
## Create Database and Tables on `startup`
6262

63-
We want to make sure that once the app starts running, the function `create_tables` is called. To create the database and tables.
63+
We want to make sure that once the app starts running, the function `create_db_and_tables` is called. To create the database and tables.
6464

6565
This should be called only once at startup, not before every request, so we put it in the function to handle the `"startup"` event:
6666

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ classifiers = [
2626
"Programming Language :: Python :: 3.11",
2727
"Programming Language :: Python :: 3.12",
2828
"Programming Language :: Python :: 3.13",
29+
"Programming Language :: Python :: 3.14",
2930
"Topic :: Database",
3031
"Topic :: Database :: Database Engines/Servers",
3132
"Topic :: Internet",
@@ -98,10 +99,7 @@ show_contexts = true
9899

99100
[tool.mypy]
100101
strict = true
101-
102-
[[tool.mypy.overrides]]
103-
module = "sqlmodel.sql._expression_select_gen"
104-
warn_unused_ignores = false
102+
exclude = "sqlmodel.sql._expression_select_gen"
105103

106104
[[tool.mypy.overrides]]
107105
module = "docs_src.*"

requirements-docs.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-e .
22
-r requirements-docs-tests.txt
3-
mkdocs-material==9.6.20
3+
mkdocs-material==9.6.21
44
mdx-include >=1.4.1,<2.0.0
55
mkdocs-redirects>=1.2.1,<1.3.0
66
pyyaml >=5.3.1,<7.0.0
@@ -13,6 +13,6 @@ cairosvg==2.8.2
1313
# mkdocstrings[python]==0.25.1
1414
griffe-typingdoc==0.2.9
1515
# For griffe, it formats with black
16-
typer == 0.17.4
17-
mkdocs-macros-plugin==1.3.9
18-
markdown-include-variants==0.0.4
16+
typer == 0.19.2
17+
mkdocs-macros-plugin==1.4.0
18+
markdown-include-variants==0.0.5

requirements-tests.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
-r requirements-docs-tests.txt
33
pytest >=7.0.1,<9.0.0
44
coverage[toml] >=6.2,<8.0
5-
mypy ==1.4.1
6-
ruff ==0.13.0
5+
# Remove when support for Python 3.8 is dropped
6+
mypy ==1.14.1; python_version < "3.9"
7+
mypy ==1.18.2; python_version >= "3.9"
8+
ruff ==0.13.2
79
# For FastAPI tests
810
fastapi >=0.103.2
911
httpx ==0.28.1
1012
dirty-equals ==0.9.0
1113
jinja2 ==3.1.6
12-
typing-extensions ==4.13.2
14+
# Remove when support for Python 3.8 is dropped
15+
typing-extensions ==4.13.2; python_version < "3.9"
16+
typing-extensions ==4.15.0; python_version >= "3.9"

scripts/deploy_docs_status.py

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import logging
22
import re
3+
from typing import Literal
34

4-
from github import Github
5+
from github import Auth, Github
56
from pydantic import BaseModel, SecretStr
67
from pydantic_settings import BaseSettings
78

@@ -14,7 +15,7 @@ class Settings(BaseSettings):
1415
deploy_url: str | None = None
1516
commit_sha: str
1617
run_id: int
17-
is_done: bool = False
18+
state: Literal["pending", "success", "error"] = "pending"
1819

1920

2021
class LinkData(BaseModel):
@@ -27,7 +28,7 @@ def main() -> None:
2728
settings = Settings()
2829

2930
logging.info(f"Using config: {settings.model_dump_json()}")
30-
g = Github(settings.github_token.get_secret_value())
31+
g = Github(auth=Auth.Token(settings.github_token.get_secret_value()))
3132
repo = g.get_repo(settings.github_repository)
3233
use_pr = next(
3334
(pr for pr in repo.get_pulls() if pr.head.sha == settings.commit_sha), None
@@ -38,24 +39,35 @@ def main() -> None:
3839
commits = list(use_pr.get_commits())
3940
current_commit = [c for c in commits if c.sha == settings.commit_sha][0]
4041
run_url = f"https://github.com/{settings.github_repository}/actions/runs/{settings.run_id}"
41-
if settings.is_done and not settings.deploy_url:
42+
if settings.state == "pending":
4243
current_commit.create_status(
43-
state="success",
44-
description="No Docs Changes",
44+
state="pending",
45+
description="Deploying Docs",
4546
context="deploy-docs",
4647
target_url=run_url,
4748
)
48-
logging.info("No docs changes found")
49+
logging.info("No deploy URL available yet")
4950
return
51+
if settings.state == "error":
52+
current_commit.create_status(
53+
state="error",
54+
description="Error Deploying Docs",
55+
context="deploy-docs",
56+
target_url=run_url,
57+
)
58+
logging.info("Error deploying docs")
59+
return
60+
assert settings.state == "success"
5061
if not settings.deploy_url:
5162
current_commit.create_status(
52-
state="pending",
53-
description="Deploying Docs",
63+
state="success",
64+
description="No Docs Changes",
5465
context="deploy-docs",
5566
target_url=run_url,
5667
)
57-
logging.info("No deploy URL available yet")
68+
logging.info("No docs changes found")
5869
return
70+
assert settings.deploy_url
5971
current_commit.create_status(
6072
state="success",
6173
description="Docs Deployed",
@@ -84,7 +96,9 @@ def main() -> None:
8496
links.append(link)
8597
links.sort(key=lambda x: x.preview_link)
8698

87-
message = f"📝 Docs preview for commit {settings.commit_sha} at: {deploy_url}"
99+
header = "## 📝 Docs preview"
100+
message = header
101+
message += f"\n\nLast commit {settings.commit_sha} at: {deploy_url}"
88102

89103
if links:
90104
message += "\n\n### Modified Pages\n\n"
@@ -94,7 +108,17 @@ def main() -> None:
94108
message += "\n"
95109

96110
print(message)
97-
use_pr.as_issue().create_comment(message)
111+
issue = use_pr.as_issue()
112+
comments = list(issue.get_comments())
113+
for comment in comments:
114+
if (
115+
comment.body.startswith(header)
116+
and comment.user.login == "github-actions[bot]"
117+
):
118+
comment.edit(message)
119+
break
120+
else:
121+
issue.create_comment(message)
98122

99123
logging.info("Finished")
100124

0 commit comments

Comments
 (0)