Skip to content

Commit 055b50c

Browse files
authored
Merge branch 'tiangolo:main' into main
2 parents 89d8cbb + c13b710 commit 055b50c

23 files changed

+248
-135
lines changed

.flake8

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/build-docs.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
- README.md
2828
- docs/**
2929
- docs_src/**
30+
- requirements-docs.txt
3031
- pyproject.toml
3132
- mkdocs.yml
3233
- mkdocs.insiders.yml
@@ -45,28 +46,23 @@ jobs:
4546
run: echo "$GITHUB_CONTEXT"
4647
- uses: actions/checkout@v4
4748
- name: Set up Python
48-
uses: actions/setup-python@v4
49+
uses: actions/setup-python@v5
4950
with:
5051
python-version: "3.11"
5152
- uses: actions/cache@v3
5253
id: cache
5354
with:
5455
path: ${{ env.pythonLocation }}
55-
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v01
56-
- name: Install Poetry
56+
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt') }}-v01
57+
- name: Install docs extras
5758
if: steps.cache.outputs.cache-hit != 'true'
58-
run: |
59-
python -m pip install --upgrade pip
60-
python -m pip install "poetry"
61-
python -m poetry self add poetry-version-plugin
62-
- name: Configure poetry
63-
run: python -m poetry config virtualenvs.create false
64-
- name: Install Dependencies
65-
if: steps.cache.outputs.cache-hit != 'true'
66-
run: python -m poetry install
59+
run: pip install -r requirements-docs.txt
6760
- name: Install Material for MkDocs Insiders
6861
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true'
69-
run: python -m poetry run pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git
62+
run: |
63+
pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git
64+
pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/griffe-typing-deprecated.git
65+
pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/mkdocstrings-python.git
7066
- uses: actions/cache@v3
7167
with:
7268
key: mkdocs-cards-${{ github.ref }}

.github/workflows/publish.yml

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,24 @@ on:
1414
jobs:
1515
publish:
1616
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
package:
20+
- sqlmodel
21+
- sqlmodel-slim
22+
permissions:
23+
id-token: write
1724
steps:
1825
- uses: actions/checkout@v4
1926
- name: Set up Python
20-
uses: actions/setup-python@v4
27+
uses: actions/setup-python@v5
2128
with:
22-
python-version: "3.7"
23-
# Allow debugging with tmate
24-
- name: Setup tmate session
25-
uses: mxschmitt/action-tmate@v3
26-
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
27-
with:
28-
limit-access-to-actor: true
29-
- uses: actions/cache@v3
30-
id: cache
31-
with:
32-
path: ${{ env.pythonLocation }}
33-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-v2
34-
- name: Install poetry
35-
if: steps.cache.outputs.cache-hit != 'true'
36-
run: |
37-
python -m pip install --upgrade pip
38-
python -m pip install "poetry"
39-
python -m poetry self add poetry-version-plugin
40-
- name: Configure poetry
41-
run: python -m poetry config virtualenvs.create false
42-
- name: Install Dependencies
43-
if: steps.cache.outputs.cache-hit != 'true'
44-
run: python -m poetry install
45-
- name: Publish
29+
python-version: "3.11"
30+
- name: Install build dependencies
31+
run: pip install build
32+
- name: Build distribution
4633
env:
47-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
48-
run: |
49-
python -m poetry config pypi-token.pypi $PYPI_TOKEN
50-
bash scripts/publish.sh
34+
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
35+
run: python -m build
36+
- name: Publish
37+
uses: pypa/gh-action-pypi-publish@v1.8.11

.github/workflows/smokeshow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/setup-python@v4
17+
- uses: actions/setup-python@v5
1818
with:
1919
python-version: '3.9'
2020

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Test Redistribute
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
12+
jobs:
13+
test-redistribute:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
package:
18+
- sqlmodel
19+
- sqlmodel-slim
20+
steps:
21+
- name: Dump GitHub context
22+
env:
23+
GITHUB_CONTEXT: ${{ toJson(github) }}
24+
run: echo "$GITHUB_CONTEXT"
25+
- uses: actions/checkout@v4
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.10"
30+
- name: Install build dependencies
31+
run: pip install build
32+
- name: Build source distribution
33+
env:
34+
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
35+
run: python -m build --sdist
36+
- name: Decompress source distribution
37+
run: |
38+
cd dist
39+
tar xvf sqlmodel*.tar.gz
40+
- name: Install test dependencies
41+
run: |
42+
cd dist/sqlmodel*/
43+
pip install -r requirements-tests.txt
44+
- name: Run source distribution tests
45+
run: |
46+
cd dist/sqlmodel*/
47+
bash scripts/test.sh
48+
- name: Build wheel distribution
49+
run: |
50+
cd dist
51+
pip wheel --no-deps sqlmodel*.tar.gz

.github/workflows/test.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
steps:
3939
- uses: actions/checkout@v4
4040
- name: Set up Python
41-
uses: actions/setup-python@v4
41+
uses: actions/setup-python@v5
4242
with:
4343
python-version: ${{ matrix.python-version }}
4444
# Allow debugging with tmate
@@ -51,18 +51,10 @@ jobs:
5151
id: cache
5252
with:
5353
path: ${{ env.pythonLocation }}
54-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-v2
55-
- name: Install poetry
56-
if: steps.cache.outputs.cache-hit != 'true'
57-
run: |
58-
python -m pip install --upgrade pip
59-
python -m pip install "poetry"
60-
python -m poetry self add poetry-version-plugin
61-
- name: Configure poetry
62-
run: python -m poetry config virtualenvs.create false
54+
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt') }}
6355
- name: Install Dependencies
6456
if: steps.cache.outputs.cache-hit != 'true'
65-
run: python -m poetry install
57+
run: pip install -r requirements-tests.txt
6658
- name: Install Pydantic v1
6759
if: matrix.pydantic-version == 'pydantic-v1'
6860
run: pip install --upgrade "pydantic>=1.10.0,<2.0.0"
@@ -72,10 +64,10 @@ jobs:
7264
- name: Lint
7365
# Do not run on Python 3.7 as mypy behaves differently
7466
if: matrix.python-version != '3.7' && matrix.pydantic-version == 'pydantic-v2'
75-
run: python -m poetry run bash scripts/lint.sh
67+
run: bash scripts/lint.sh
7668
- run: mkdir coverage
7769
- name: Test
78-
run: python -m poetry run bash scripts/test.sh
70+
run: bash scripts/test.sh
7971
env:
8072
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
8173
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
@@ -92,7 +84,7 @@ jobs:
9284
steps:
9385
- uses: actions/checkout@v4
9486

95-
- uses: actions/setup-python@v4
87+
- uses: actions/setup-python@v5
9688
with:
9789
python-version: '3.8'
9890

docs/release-notes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,32 @@
22

33
## Latest Changes
44

5+
## 0.0.18
6+
7+
### Internal
8+
9+
* ✨ Add `sqlmodel-slim` setup. PR [#916](https://github.com/tiangolo/sqlmodel/pull/916) by [@tiangolo](https://github.com/tiangolo).
10+
11+
In the future SQLModel will include the standard default recommended packages, and `sqlmodel-slim` will come without those recommended standard packages and with a group of optional dependencies `sqlmodel-slim[standard]`, equivalent to `sqlmodel`, for those that want to opt out of those packages.
12+
13+
* 🔧 Re-enable MkDocs Material Social plugin. PR [#915](https://github.com/tiangolo/sqlmodel/pull/915) by [@tiangolo](https://github.com/tiangolo).
14+
15+
## 0.0.17
16+
17+
### Refactors
18+
19+
* ♻️ Refactor types to properly support Pydantic 2.7. PR [#913](https://github.com/tiangolo/sqlmodel/pull/913) by [@tiangolo](https://github.com/tiangolo).
20+
521
### Docs
622

723
* 📝 Update ModelRead to ModelPublic documentation and examples. PR [#885](https://github.com/tiangolo/sqlmodel/pull/885) by [@estebanx64](https://github.com/estebanx64).
824
* ✨ Add source examples for Python 3.10 and 3.9 with updated syntax. PR [#842](https://github.com/tiangolo/sqlmodel/pull/842) by [@tiangolo](https://github.com/tiangolo) and [@estebanx64](https://github.com/estebanx64).
925

1026
### Internal
1127

28+
* ⬆ Bump actions/setup-python from 4 to 5. PR [#733](https://github.com/tiangolo/sqlmodel/pull/733) by [@dependabot[bot]](https://github.com/apps/dependabot).
29+
* 🔨 Update internal scripts and remove unused ones. PR [#914](https://github.com/tiangolo/sqlmodel/pull/914) by [@tiangolo](https://github.com/tiangolo).
30+
* 🔧 Migrate from Poetry to PDM for the internal build config. PR [#912](https://github.com/tiangolo/sqlmodel/pull/912) by [@tiangolo](https://github.com/tiangolo).
1231
* 🔧 Update MkDocs, disable cards while I can upgrade to the latest MkDocs Material, that fixes an issue with social cards. PR [#888](https://github.com/tiangolo/sqlmodel/pull/888) by [@tiangolo](https://github.com/tiangolo).
1332
* 👷 Add cron to run test once a week on monday. PR [#869](https://github.com/tiangolo/sqlmodel/pull/869) by [@estebanx64](https://github.com/estebanx64).
1433
* ⬆️ Upgrade Ruff version and configs. PR [#859](https://github.com/tiangolo/sqlmodel/pull/859) by [@tiangolo](https://github.com/tiangolo).

mkdocs.insiders.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
plugins:
2-
# TODO: Re-enable once this is fixed: https://github.com/squidfunk/mkdocs-material/issues/6983
3-
# social:
2+
social:
43
typeset:

pdm_build.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import os
2+
from typing import Any, Dict, List
3+
4+
from pdm.backend.hooks import Context
5+
6+
TIANGOLO_BUILD_PACKAGE = os.getenv("TIANGOLO_BUILD_PACKAGE", "sqlmodel")
7+
8+
9+
def pdm_build_initialize(context: Context) -> None:
10+
metadata = context.config.metadata
11+
# Get custom config for the current package, from the env var
12+
config: Dict[str, Any] = context.config.data["tool"]["tiangolo"][
13+
"_internal-slim-build"
14+
]["packages"][TIANGOLO_BUILD_PACKAGE]
15+
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+
)
24+
# Override main [project] configs with custom configs for this package
25+
for key, value in project_config.items():
26+
metadata[key] = value
27+
# Get custom build config for the current package
28+
build_config: Dict[str, Any] = (
29+
config.get("tool", {}).get("pdm", {}).get("build", {})
30+
)
31+
# Override PDM build config with custom build config for this package
32+
for key, value in build_config.items():
33+
context.config.build_config[key] = value
34+
# Get main dependencies
35+
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)

pyproject.toml

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
[tool.poetry]
1+
[build-system]
2+
requires = ["pdm-backend"]
3+
build-backend = "pdm.backend"
4+
5+
[project]
26
name = "sqlmodel"
3-
version = "0"
7+
dynamic = ["version"]
48
description = "SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness."
5-
authors = ["Sebastián Ramírez <[email protected]>"]
69
readme = "README.md"
7-
homepage = "https://github.com/tiangolo/sqlmodel"
8-
documentation = "https://sqlmodel.tiangolo.com"
9-
repository = "https://github.com/tiangolo/sqlmodel"
10-
license = "MIT"
11-
exclude = ["sqlmodel/sql/expression.py.jinja2"]
10+
requires-python = ">=3.7"
11+
authors = [
12+
{ name = "Sebastián Ramírez", email = "tiangolo@gmail.com" },
13+
]
14+
1215
classifiers = [
1316
"Development Status :: 4 - Beta",
1417
"Framework :: AsyncIO",
@@ -31,36 +34,40 @@ classifiers = [
3134
"Typing :: Typed",
3235
]
3336

34-
[tool.poetry.dependencies]
35-
python = "^3.7"
36-
SQLAlchemy = ">=2.0.0,<2.1.0"
37-
pydantic = ">=1.10.13,<3.0.0"
38-
39-
[tool.poetry.group.dev.dependencies]
40-
pytest = "^7.0.1"
41-
mypy = "1.4.1"
42-
# Needed by the code generator using templates
43-
black = ">=22.10,<24.0"
44-
mkdocs-material = "9.2.7"
45-
pillow = "^9.3.0"
46-
cairosvg = "^2.5.2"
47-
mdx-include = "^1.4.1"
48-
coverage = {extras = ["toml"], version = ">=6.2,<8.0"}
49-
fastapi = "^0.103.2"
50-
ruff = "0.2.0"
51-
# For FastAPI tests
52-
httpx = "0.24.1"
53-
# TODO: upgrade when deprecating Python 3.7
54-
dirty-equals = "^0.6.0"
55-
typer-cli = "^0.0.13"
56-
mkdocs-markdownextradata-plugin = ">=0.1.7,<0.3.0"
37+
dependencies = [
38+
"SQLAlchemy >=2.0.0,<2.1.0",
39+
"pydantic >=1.10.13,<3.0.0",
40+
]
5741

58-
[build-system]
59-
requires = ["poetry-core"]
60-
build-backend = "poetry.core.masonry.api"
42+
[project.urls]
43+
Homepage = "https://github.com/tiangolo/sqlmodel"
44+
Documentation = "https://sqlmodel.tiangolo.com"
45+
Repository = "https://github.com/tiangolo/sqlmodel"
46+
47+
[tool.pdm]
48+
version = { source = "file", path = "sqlmodel/__init__.py" }
49+
distribution = true
50+
51+
[tool.pdm.build]
52+
source-includes = [
53+
"tests/",
54+
"docs_src/",
55+
"requirements*.txt",
56+
"scripts/",
57+
"sqlmodel/sql/expression.py.jinja2",
58+
]
59+
60+
[tool.tiangolo._internal-slim-build.packages.sqlmodel-slim.project]
61+
name = "sqlmodel-slim"
62+
63+
[tool.tiangolo._internal-slim-build.packages.sqlmodel]
64+
# include-optional-dependencies = ["standard"]
65+
66+
[tool.tiangolo._internal-slim-build.packages.sqlmodel.project]
67+
optional-dependencies = {}
6168

62-
[tool.poetry-version-plugin]
63-
source = "init"
69+
# [tool.tiangolo._internal-slim-build.packages.sqlmodel.project.scripts]
70+
# sqlmodel = "sqlmodel.cli:main"
6471

6572
[tool.coverage.run]
6673
parallel = true

0 commit comments

Comments
 (0)