Skip to content

Commit b0bf5bc

Browse files
authored
Merge branch 'main' into fk-attrs
2 parents abf0d97 + ffdcb44 commit b0bf5bc

File tree

26 files changed

+613
-223
lines changed

26 files changed

+613
-223
lines changed

.github/workflows/build-docs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ jobs:
6464
with:
6565
key: mkdocs-cards-${{ github.ref }}
6666
path: .cache
67-
- name: Verify README
68-
run: uv run ./scripts/docs.py verify-readme
6967
- name: Build Docs
7068
run: uv run ./scripts/docs.py build
7169
- uses: actions/upload-artifact@v6

.github/workflows/test-redistribute.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ on:
1212
jobs:
1313
test-redistribute:
1414
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
package:
18-
- sqlmodel
19-
- sqlmodel-slim
2015
steps:
2116
- name: Dump GitHub context
2217
env:
@@ -30,8 +25,6 @@ jobs:
3025
- name: Install build dependencies
3126
run: pip install build
3227
- name: Build source distribution
33-
env:
34-
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
3528
run: python -m build --sdist
3629
- name: Decompress source distribution
3730
run: |
@@ -41,8 +34,6 @@ jobs:
4134
run: |
4235
cd dist/sqlmodel*/
4336
pip install --group tests --editable .
44-
env:
45-
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
4637
- name: Run source distribution tests
4738
run: |
4839
cd dist/sqlmodel*/

.github/workflows/test.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,32 @@ jobs:
2727
matrix:
2828
os: [ ubuntu-latest, windows-latest, macos-latest ]
2929
python-version: [ "3.14" ]
30+
uv-resolution:
31+
- highest
3032
include:
3133
- os: windows-latest
3234
python-version: "3.9"
35+
uv-resolution: highest
3336
- os: ubuntu-latest
3437
python-version: "3.10"
38+
uv-resolution: lowest-direct
3539
- os: macos-latest
3640
python-version: "3.11"
41+
uv-resolution: highest
3742
- os: windows-latest
3843
python-version: "3.12"
44+
uv-resolution: lowest-direct
3945
- os: ubuntu-latest
4046
python-version: "3.13"
47+
uv-resolution: highest
4148
- os: macos-latest
4249
python-version: "3.13"
50+
uv-resolution: highest
4351
fail-fast: false
4452
runs-on: ${{ matrix.os }}
4553
env:
4654
UV_PYTHON: ${{ matrix.python-version }}
55+
UV_RESOLUTION: ${{ matrix.uv-resolution }}
4756
steps:
4857
- uses: actions/checkout@v6
4958
- name: Set up Python
@@ -64,7 +73,7 @@ jobs:
6473
with:
6574
limit-access-to-actor: true
6675
- name: Install Dependencies
67-
run: uv sync --locked --no-dev --group tests
76+
run: uv sync --no-dev --group tests
6877
- run: mkdir coverage
6978
- name: Test
7079
run: uv run bash scripts/test.sh

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,22 @@ repos:
2828
language: unsupported
2929
types: [python]
3030

31+
- id: local-mypy
32+
name: mypy check
33+
entry: uv run mypy sqlmodel tests/test_select_typing.py
34+
require_serial: true
35+
language: unsupported
36+
pass_filenames: false
37+
3138
- id: generate-select
3239
language: unsupported
3340
name: generate-select
3441
entry: uv run ./scripts/generate_select.py
3542
files: ^scripts/generate_select\.py|sqlmodel/sql/_expression_select_gen\.py\.jinja2$
43+
44+
- id: generate-readme
45+
language: unsupported
46+
name: generate README.md from index.md
47+
entry: uv run ./scripts/docs.py generate-readme
48+
files: ^docs/index\.md|scripts/docs\.py$
49+
pass_filenames: false

docs/management-tasks.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Make sure you use a supported label from the <a href="https://github.com/tiangol
6868
* `refactor`: Refactors
6969
* This is normally for changes to the internal code that don't change the behavior. Normally it improves maintainability, or enables future features, etc.
7070
* `upgrade`: Upgrades
71-
* This is for upgrades to direct dependencies from the project, or extra optional dependencies, normally in `pyproject.toml`. So, things that would affect final users, they would end up receiving the upgrade in their code base once they update. But this is not for upgrades to internal dependencies used for development, testing, docs, etc. Those internal dependencies, normally in `requirements.txt` files or GitHub Action versions should be marked as `internal`, not `upgrade`.
71+
* This is for upgrades to direct dependencies from the project, or extra optional dependencies, normally in `pyproject.toml`. So, things that would affect final users, they would end up receiving the upgrade in their code base once they update. But this is not for upgrades to internal dependencies used for development, testing, docs, etc. Those internal dependencies or GitHub Action versions should be marked as `internal`, not `upgrade`.
7272
* `docs`: Docs
7373
* Changes in docs. This includes updating the docs, fixing typos. But it doesn't include changes to translations.
7474
* You can normally quickly detect it by going to the "Files changed" tab in the PR and checking if the updated file(s) starts with `docs/en/docs`. The original version of the docs is always in English, so in `docs/en/docs`.
@@ -83,9 +83,13 @@ Some tools like Dependabot, will add some labels, like `dependencies`, but have
8383

8484
## Review PRs
8585

86-
If a PR doesn't explain what it does or why, ask for more information.
86+
* If a PR doesn't explain what it does or why, if it seems like it could be useful, ask for more information. Otherwise, feel free to close it.
8787

88-
A PR should have a specific use case that it is solving.
88+
* If a PR seems to be spam, meaningless, only to change statistics (to appear as "contributor") or similar, you can simply mark it as `invalid`, and it will be automatically closed.
89+
90+
* If a PR seems to be AI generated, and seems like reviewing it would take more time from you than the time it took to write the prompt, mark it as `maybe-ai`, and it will be automatically closed.
91+
92+
* A PR should have a specific use case that it is solving.
8993

9094
* If the PR is for a feature, it should have docs.
9195
* Unless it's a feature we want to discourage, like support for a corner case that we don't want users to use.
@@ -103,13 +107,11 @@ A PR should have a specific use case that it is solving.
103107

104108
Dependabot will create PRs to update dependencies for several things, and those PRs all look similar, but some are way more delicate than others.
105109

106-
* If the PR is for a direct dependency, so, Dependabot is modifying `pyproject.toml`, **don't merge it**. 😱 Let me check it first. There's a good chance that some additional tweaks or updates are needed.
107-
* If the PR updates one of the internal dependencies, for example it's modifying `requirements.txt` files, or GitHub Action versions, if the tests are passing, the release notes (shown in a summary in the PR) don't show any obvious potential breaking change, you can merge it. 😎
110+
* If the PR is for a direct dependency, so, Dependabot is modifying `pyproject.toml` in the main dependencies, **don't merge it**. 😱 Let me check it first. There's a good chance that some additional tweaks or updates are needed.
111+
* If the PR updates one of the internal dependencies, for example the group `dev` in `pyproject.toml`, or GitHub Action versions, if the tests are passing, the release notes (shown in a summary in the PR) don't show any obvious potential breaking change, you can merge it. 😎
108112

109113
## Mark GitHub Discussions Answers
110114

111115
When a question in GitHub Discussions has been answered, mark the answer by clicking "Mark as answer".
112116

113-
Many of the current Discussion Questions were migrated from old issues. Many have the label `answered`, that means they were answered when they were issues, but now in GitHub Discussions, it's not known what is the actual response from the messages.
114-
115117
You can filter discussions by <a href="https://github.com/fastapi/sqlmodel/discussions/categories/questions?discussions_q=category:Questions+is:open+is:unanswered" class="external-link" target="_blank">`Questions` that are `Unanswered`</a>.

docs/release-notes.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,45 @@
22

33
## Latest Changes
44

5+
### Internal
6+
7+
* ⬆ Bump prek from 0.3.2 to 0.3.3. PR [#1761](https://github.com/fastapi/sqlmodel/pull/1761) by [@dependabot[bot]](https://github.com/apps/dependabot).
8+
* ⬆ Bump typer from 0.23.1 to 0.23.2. PR [#1760](https://github.com/fastapi/sqlmodel/pull/1760) by [@dependabot[bot]](https://github.com/apps/dependabot).
9+
10+
## 0.0.34
11+
12+
### Internal
13+
14+
* 👷 Enable tests with lower and upper bound versions. PR [#1735](https://github.com/fastapi/sqlmodel/pull/1735) by [@tiangolo](https://github.com/tiangolo).
15+
* ⬆ Bump ruff from 0.15.0 to 0.15.1. PR [#1758](https://github.com/fastapi/sqlmodel/pull/1758) by [@dependabot[bot]](https://github.com/apps/dependabot).
16+
* ⬆ Bump typer from 0.23.0 to 0.23.1. PR [#1759](https://github.com/fastapi/sqlmodel/pull/1759) by [@dependabot[bot]](https://github.com/apps/dependabot).
17+
* ⬆ Bump typer from 0.21.2 to 0.23.0. PR [#1756](https://github.com/fastapi/sqlmodel/pull/1756) by [@dependabot[bot]](https://github.com/apps/dependabot).
18+
* ⬆ Bump fastapi from 0.128.7 to 0.128.8. PR [#1755](https://github.com/fastapi/sqlmodel/pull/1755) by [@dependabot[bot]](https://github.com/apps/dependabot).
19+
20+
## 0.0.33
21+
22+
### Docs
23+
24+
* ✏️ Fix typos in inline comment in `expression.py`. PR [#1747](https://github.com/fastapi/sqlmodel/pull/1747) by [@veeceey](https://github.com/veeceey).
25+
* 📝 Fix async example in `session.execute()` docstring & deprecation message. PR [#1643](https://github.com/fastapi/sqlmodel/pull/1643) by [@DanielLeviLucas](https://github.com/DanielLeviLucas).
26+
* 📝 Update `management-tasks.md` to be in line with `management-tasks.md` in FastAPI repo. PR [#1743](https://github.com/fastapi/sqlmodel/pull/1743) by [@YuriiMotov](https://github.com/YuriiMotov).
27+
28+
### Internal
29+
30+
* 🔨 Update build script for `sqlmodel-slim`. PR [#1754](https://github.com/fastapi/sqlmodel/pull/1754) by [@tiangolo](https://github.com/tiangolo).
31+
* ⬆ Bump fastapi from 0.128.6 to 0.128.7. PR [#1751](https://github.com/fastapi/sqlmodel/pull/1751) by [@dependabot[bot]](https://github.com/apps/dependabot).
32+
* ⬆ Bump typer from 0.21.1 to 0.21.2. PR [#1752](https://github.com/fastapi/sqlmodel/pull/1752) by [@dependabot[bot]](https://github.com/apps/dependabot).
33+
* 👷 Update build setup for `sqlmodel-slim`, deprecate it, and make it only depend on `sqlmodel`. PR [#1753](https://github.com/fastapi/sqlmodel/pull/1753) by [@tiangolo](https://github.com/tiangolo).
34+
* ⬆ Bump fastapi from 0.128.3 to 0.128.6. PR [#1750](https://github.com/fastapi/sqlmodel/pull/1750) by [@dependabot[bot]](https://github.com/apps/dependabot).
35+
* ⬆ Bump fastapi from 0.128.1 to 0.128.3. PR [#1746](https://github.com/fastapi/sqlmodel/pull/1746) by [@dependabot[bot]](https://github.com/apps/dependabot).
36+
* ⬆ Bump prek from 0.3.1 to 0.3.2. PR [#1745](https://github.com/fastapi/sqlmodel/pull/1745) by [@dependabot[bot]](https://github.com/apps/dependabot).
37+
* ⬆ Bump fastapi from 0.128.0 to 0.128.1. PR [#1742](https://github.com/fastapi/sqlmodel/pull/1742) by [@dependabot[bot]](https://github.com/apps/dependabot).
38+
* ✅ Update `ValidationError` schema in FastAPI-related tests to be compatible with FastAPI 0.128.1+. PR [#1744](https://github.com/fastapi/sqlmodel/pull/1744) by [@YuriiMotov](https://github.com/YuriiMotov).
39+
* ⬆ Bump ruff from 0.14.14 to 0.15.0. PR [#1740](https://github.com/fastapi/sqlmodel/pull/1740) by [@dependabot[bot]](https://github.com/apps/dependabot).
40+
* 👷 Add generate-readme to pre-commit. PR [#1741](https://github.com/fastapi/sqlmodel/pull/1741) by [@tiangolo](https://github.com/tiangolo).
41+
* 👷 Run mypy by pre-commit. PR [#1738](https://github.com/fastapi/sqlmodel/pull/1738) by [@YuriiMotov](https://github.com/YuriiMotov).
42+
* ⬆ Bump prek from 0.3.0 to 0.3.1. PR [#1739](https://github.com/fastapi/sqlmodel/pull/1739) by [@dependabot[bot]](https://github.com/apps/dependabot).
43+
544
## 0.0.32
645

746
### Fixes

pdm_build.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@
33

44
from pdm.backend.hooks import Context
55

6-
TIANGOLO_BUILD_PACKAGE = os.getenv("TIANGOLO_BUILD_PACKAGE", "sqlmodel")
6+
TIANGOLO_BUILD_PACKAGE = os.getenv("TIANGOLO_BUILD_PACKAGE")
77

88

99
def pdm_build_initialize(context: Context) -> None:
1010
metadata = context.config.metadata
11+
# Get main version
12+
version = metadata["version"]
1113
# Get custom config for the current package, from the env var
12-
config: dict[str, Any] = context.config.data["tool"]["tiangolo"][
14+
all_configs_config: dict[str, Any] = context.config.data["tool"]["tiangolo"][
1315
"_internal-slim-build"
14-
]["packages"][TIANGOLO_BUILD_PACKAGE]
16+
]["packages"]
17+
18+
if TIANGOLO_BUILD_PACKAGE not in all_configs_config:
19+
return
20+
21+
config = all_configs_config[TIANGOLO_BUILD_PACKAGE]
1522
project_config: dict[str, Any] = config["project"]
16-
# Get main optional dependencies, extras
17-
optional_dependencies: dict[str, list[str]] = metadata.get(
18-
"optional-dependencies", {}
19-
)
20-
# Get custom optional dependencies name to always include in this (non-slim) package
21-
include_optional_dependencies: list[str] = config.get(
22-
"include-optional-dependencies", []
23-
)
2423
# Override main [project] configs with custom configs for this package
2524
for key, value in project_config.items():
2625
metadata[key] = value
@@ -33,7 +32,9 @@ def pdm_build_initialize(context: Context) -> None:
3332
context.config.build_config[key] = value
3433
# Get main dependencies
3534
dependencies: list[str] = metadata.get("dependencies", [])
36-
# Add optional dependencies to the default dependencies for this (non-slim) package
37-
for include_optional in include_optional_dependencies:
38-
optional_dependencies_group = optional_dependencies.get(include_optional, [])
39-
dependencies.extend(optional_dependencies_group)
35+
# Sync versions in dependencies
36+
new_dependencies = []
37+
for dep in dependencies:
38+
new_dep = f"{dep}>={version}"
39+
new_dependencies.append(new_dep)
40+
metadata["dependencies"] = new_dependencies

pyproject.toml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ classifiers = [
3737

3838
dependencies = [
3939
"SQLAlchemy >=2.0.14,<2.1.0",
40-
"pydantic>=2.7.0",
40+
"pydantic>=2.11.0",
4141
]
4242

4343
[project.urls]
@@ -54,7 +54,7 @@ dev = [
5454
"prek>=0.2.24,<1.0.0",
5555
]
5656
docs = [
57-
"black>=22.10",
57+
"black>=24.1.0",
5858
"cairosvg==2.8.2",
5959
"griffe-typingdoc==0.3.0",
6060
"griffe-warnings-deprecated==1.1.0",
@@ -66,7 +66,7 @@ docs = [
6666
"mkdocstrings[python]==0.30.1",
6767
"pillow==11.3.0",
6868
"pyyaml>=5.3.1,<7.0.0",
69-
"typer==0.21.1",
69+
"typer==0.23.2",
7070
]
7171
github-actions = [
7272
"httpx>=0.27.0,<0.29.0",
@@ -76,16 +76,16 @@ github-actions = [
7676
"smokeshow>=0.5.0",
7777
]
7878
tests = [
79-
"black>=22.10",
79+
"black>=24.1.0",
8080
"coverage[toml]>=6.2,<8.0",
8181
"dirty-equals==0.11",
82-
"fastapi>=0.103.2",
82+
"fastapi>=0.128.0",
8383
"httpx==0.28.1",
8484
"jinja2==3.1.6",
8585
"mypy==1.19.1",
8686
"pre-commit>=2.17.0,<5.0.0",
8787
"pytest>=7.0.1,<9.0.0",
88-
"ruff==0.14.14",
88+
"ruff==0.15.1",
8989
"typing-extensions==4.15.0",
9090
]
9191

@@ -103,15 +103,29 @@ source-includes = [
103103

104104
[tool.tiangolo._internal-slim-build.packages.sqlmodel-slim.project]
105105
name = "sqlmodel-slim"
106-
107-
[tool.tiangolo._internal-slim-build.packages.sqlmodel]
108-
# include-optional-dependencies = ["standard"]
109-
110-
[tool.tiangolo._internal-slim-build.packages.sqlmodel.project]
106+
readme = "sqlmodel-slim/README.md"
107+
dependencies = [
108+
"sqlmodel",
109+
]
111110
optional-dependencies = {}
112-
113-
# [tool.tiangolo._internal-slim-build.packages.sqlmodel.project.scripts]
114-
# sqlmodel = "sqlmodel.cli:main"
111+
scripts = {}
112+
113+
[tool.tiangolo._internal-slim-build.packages.sqlmodel-slim.tool.pdm.build]
114+
# excludes needs to explicitly exclude the top level python packages,
115+
# otherwise PDM includes them by default
116+
# A "*" glob pattern can't be used here because in PDM internals, the patterns are put
117+
# in a set (unordered, order varies) and each excluded file is assigned one of the
118+
# glob patterns that matches, as the set is unordered, the matched pattern could be "*"
119+
# independent of the order here. And then the internal code would give it a lower score
120+
# than the one for a default included file.
121+
# By not using "*" and explicitly excluding the top level packages, they get a higher
122+
# score than the default inclusion
123+
excludes = ["sqlmodel", "docs_src", "tests", "pdm_build.py"]
124+
# source-includes needs to explicitly define some value because PDM will check the
125+
# truthy value of the list, and if empty, will include some defaults, including "tests",
126+
# an empty string doesn't match anything, but makes the list truthy, so that PDM
127+
# doesn't override it during the build.
128+
source-includes = [""]
115129

116130
[tool.coverage.run]
117131
parallel = true

sqlmodel-slim/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<p align="center">
2+
<a href="https://sqlmodel.tiangolo.com"><img src="https://sqlmodel.tiangolo.com/img/logo-margin/logo-margin-vector.svg#only-light" alt="SQLModel"></a>
3+
4+
</p>
5+
<p align="center">
6+
<em>SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.</em>
7+
</p>
8+
<p align="center">
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">
11+
</a>
12+
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3APublish" target="_blank">
13+
<img src="https://github.com/fastapi/sqlmodel/actions/workflows/publish.yml/badge.svg" alt="Publish">
14+
</a>
15+
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/sqlmodel" target="_blank">
16+
<img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/sqlmodel.svg" alt="Coverage">
17+
<a href="https://pypi.org/project/sqlmodel" target="_blank">
18+
<img src="https://img.shields.io/pypi/v/sqlmodel?color=%2334D058&label=pypi%20package" alt="Package version">
19+
</a>
20+
</p>
21+
22+
---
23+
24+
**Documentation**: <a href="https://sqlmodel.tiangolo.com" target="_blank">https://sqlmodel.tiangolo.com</a>
25+
26+
**Source Code**: <a href="https://github.com/fastapi/sqlmodel" target="_blank">https://github.com/fastapi/sqlmodel</a>
27+
28+
---
29+
30+
SQLModel is a library for interacting with <abbr title='Also called "Relational databases"'>SQL databases</abbr> from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust.
31+
32+
**SQLModel** is based on Python type annotations, and powered by <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> and <a href="https://sqlalchemy.org/" class="external-link" target="_blank">SQLAlchemy</a>.
33+
34+
## `sqlmodel-slim`
35+
36+
⚠️ Do not install this package. ⚠️
37+
38+
This package, `sqlmodel-slim`, does nothing other than depend on `sqlmodel`.
39+
40+
You **should not** install this package.
41+
42+
Install instead:
43+
44+
```bash
45+
pip install sqlmodel
46+
```
47+
48+
This package is deprecated and will stop receiving any updates and published versions.
49+
50+
## License
51+
52+
This project is licensed under the terms of the MIT license.

sqlmodel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.0.32"
1+
__version__ = "0.0.34"
22

33
# Re-export from SQLAlchemy
44
from sqlalchemy.engine import create_engine as create_engine

0 commit comments

Comments
 (0)