Skip to content

Commit e8077b9

Browse files
authored
Merge branch 'main' into main
2 parents a58a2c9 + dcf4f58 commit e8077b9

24 files changed

+275
-154
lines changed

Diff for: .flake8

-5
This file was deleted.

Diff for: .github/workflows/build-docs.yml

+10-14
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 }}
@@ -75,7 +71,7 @@ jobs:
7571
run: python ./scripts/docs.py verify-readme
7672
- name: Build Docs
7773
run: python ./scripts/docs.py build
78-
- uses: actions/upload-artifact@v3
74+
- uses: actions/upload-artifact@v4
7975
with:
8076
name: docs-site
8177
path: ./site/**

Diff for: .github/workflows/deploy-docs.yml

+7-9
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ jobs:
1919
run: |
2020
rm -rf ./site
2121
mkdir ./site
22-
- name: Download Artifact Docs
23-
id: download
24-
uses: dawidd6/[email protected]
22+
- uses: actions/download-artifact@v4
2523
with:
26-
if_no_artifact_found: ignore
27-
github_token: ${{ secrets.GITHUB_TOKEN }}
28-
workflow: build-docs.yml
29-
run_id: ${{ github.event.workflow_run.id }}
30-
name: docs-site
3124
path: ./site/
25+
pattern: docs-site
26+
merge-multiple: true
27+
github-token: ${{ secrets.GITHUB_TOKEN }}
28+
run-id: ${{ github.event.workflow_run.id }}
3229
- name: Deploy to Cloudflare Pages
33-
if: steps.download.outputs.found_artifact == 'true'
30+
# hashFiles returns an empty string if there are no files
31+
if: hashFiles('./site/*')
3432
id: deploy
3533
uses: cloudflare/pages-action@v1
3634
with:

Diff for: .github/workflows/publish.yml

+16-29
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

Diff for: .github/workflows/smokeshow.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@ 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

2121
- run: pip install smokeshow
2222

23-
- uses: dawidd6/action-download-artifact@v2.28.0
23+
- uses: actions/download-artifact@v4
2424
with:
25-
workflow: test.yml
26-
commit: ${{ github.event.workflow_run.head_sha }}
25+
name: coverage-html
26+
path: htmlcov
27+
github-token: ${{ secrets.GITHUB_TOKEN }}
28+
run-id: ${{ github.event.workflow_run.id }}
2729

28-
- run: smokeshow upload coverage-html
30+
- run: smokeshow upload htmlcov
2931
env:
3032
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
3133
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 95

Diff for: .github/workflows/test-redistribute.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
env:
45+
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
46+
- name: Run source distribution tests
47+
run: |
48+
cd dist/sqlmodel*/
49+
bash scripts/test.sh
50+
- name: Build wheel distribution
51+
run: |
52+
cd dist
53+
pip wheel --no-deps sqlmodel*.tar.gz

Diff for: .github/workflows/test.yml

+12-19
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,17 +64,17 @@ 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 }}
8274
- name: Store coverage files
83-
uses: actions/upload-artifact@v3
75+
uses: actions/upload-artifact@v4
8476
with:
85-
name: coverage
77+
name: coverage-${{ matrix.python-version }}-${{ matrix.pydantic-version }}
8678
path: coverage
8779
coverage-combine:
8880
needs:
@@ -92,15 +84,16 @@ 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

9991
- name: Get coverage files
100-
uses: actions/download-artifact@v3
92+
uses: actions/download-artifact@v4
10193
with:
102-
name: coverage
94+
pattern: coverage-*
10395
path: coverage
96+
merge-multiple: true
10497

10598
- run: pip install coverage[toml]
10699

@@ -110,7 +103,7 @@ jobs:
110103
- run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
111104

112105
- name: Store coverage HTML
113-
uses: actions/upload-artifact@v3
106+
uses: actions/upload-artifact@v4
114107
with:
115108
name: coverage-html
116109
path: htmlcov

Diff for: docs/release-notes.md

+24
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,37 @@
22

33
## Latest Changes
44

5+
### Internal
6+
7+
* 👷 Update GitHub Actions to download and upload artifacts. PR [#936](https://github.com/tiangolo/sqlmodel/pull/936) by [@tiangolo](https://github.com/tiangolo).
8+
* 👷 Tweak CI for test-redistribute, add needed env vars for slim. PR [#929](https://github.com/tiangolo/sqlmodel/pull/929) by [@tiangolo](https://github.com/tiangolo).
9+
10+
## 0.0.18
11+
12+
### Internal
13+
14+
* ✨ Add `sqlmodel-slim` setup. PR [#916](https://github.com/tiangolo/sqlmodel/pull/916) by [@tiangolo](https://github.com/tiangolo).
15+
16+
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.
17+
18+
* 🔧 Re-enable MkDocs Material Social plugin. PR [#915](https://github.com/tiangolo/sqlmodel/pull/915) by [@tiangolo](https://github.com/tiangolo).
19+
20+
## 0.0.17
21+
22+
### Refactors
23+
24+
* ♻️ Refactor types to properly support Pydantic 2.7. PR [#913](https://github.com/tiangolo/sqlmodel/pull/913) by [@tiangolo](https://github.com/tiangolo).
25+
526
### Docs
627

728
* 📝 Update ModelRead to ModelPublic documentation and examples. PR [#885](https://github.com/tiangolo/sqlmodel/pull/885) by [@estebanx64](https://github.com/estebanx64).
829
* ✨ 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).
930

1031
### Internal
1132

33+
* ⬆ 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).
34+
* 🔨 Update internal scripts and remove unused ones. PR [#914](https://github.com/tiangolo/sqlmodel/pull/914) by [@tiangolo](https://github.com/tiangolo).
35+
* 🔧 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).
1236
* 🔧 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).
1337
* 👷 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).
1438
* ⬆️ Upgrade Ruff version and configs. PR [#859](https://github.com/tiangolo/sqlmodel/pull/859) by [@tiangolo](https://github.com/tiangolo).

Diff for: mkdocs.insiders.yml

+1-2
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:

Diff for: pdm_build.py

+39
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)

0 commit comments

Comments
 (0)