Skip to content

Commit 844e21c

Browse files
authored
Merge branch 'main' into main
2 parents 7a2b7af + 7b3148c commit 844e21c

18 files changed

+143
-46
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ updates:
55
directory: "/"
66
schedule:
77
interval: "daily"
8+
commit-message:
9+
prefix:
810
# Python
911
- package-ecosystem: "pip"
1012
directory: "/"
1113
schedule:
1214
interval: "daily"
15+
commit-message:
16+
prefix:

.github/workflows/build-docs.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
env:
2020
GITHUB_CONTEXT: ${{ toJson(github) }}
2121
run: echo "$GITHUB_CONTEXT"
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v3.1.0
2323
- name: Set up Python
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v4
2525
with:
2626
python-version: "3.7"
2727
# Allow debugging with tmate
@@ -30,7 +30,7 @@ jobs:
3030
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
3131
with:
3232
limit-access-to-actor: true
33-
- uses: actions/cache@v2
33+
- uses: actions/cache@v3
3434
id: cache
3535
with:
3636
path: ${{ env.pythonLocation }}
@@ -53,7 +53,7 @@ jobs:
5353
- name: Install Material for MkDocs Insiders
5454
if: github.event.pull_request.head.repo.fork == false && steps.cache.outputs.cache-hit != 'true'
5555
run: python -m poetry run pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
56-
- uses: actions/cache@v2
56+
- uses: actions/cache@v3
5757
with:
5858
key: mkdocs-cards-${{ github.ref }}
5959
path: .cache
@@ -65,10 +65,10 @@ jobs:
6565
run: python -m poetry run mkdocs build --config-file mkdocs.insiders.yml
6666
- name: Zip docs
6767
run: python -m poetry run bash ./scripts/zip-docs.sh
68-
- uses: actions/upload-artifact@v2
68+
- uses: actions/upload-artifact@v3
6969
with:
7070
name: docs-zip
71-
path: ./docs.zip
71+
path: ./site/docs.zip
7272
- name: Deploy to Netlify
7373
uses: nwtgck/[email protected]
7474
with:

.github/workflows/latest-changes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
latest-changes:
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v3.1.0
2424
with:
2525
# To allow latest-changes to commit to the main branch
2626
token: ${{ secrets.ACTIONS_TOKEN }}

.github/workflows/preview-docs.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@ jobs:
1010
preview-docs:
1111
runs-on: ubuntu-20.04
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/[email protected]
14+
- name: Clean site
15+
run: |
16+
rm -rf ./site
17+
mkdir ./site
1418
- name: Download Artifact Docs
15-
uses: dawidd6/action-download-artifact@v2.9.0
19+
uses: dawidd6/action-download-artifact@v2.24.2
1620
with:
1721
github_token: ${{ secrets.GITHUB_TOKEN }}
1822
workflow: build-docs.yml
1923
run_id: ${{ github.event.workflow_run.id }}
2024
name: docs-zip
25+
path: ./site/
2126
- name: Unzip docs
2227
run: |
23-
rm -rf ./site
28+
cd ./site
2429
unzip docs.zip
2530
rm -f docs.zip
2631
- name: Deploy to Netlify

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
publish:
1616
runs-on: ubuntu-20.04
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3.1.0
1919
- name: Set up Python
20-
uses: actions/setup-python@v2
20+
uses: actions/setup-python@v4
2121
with:
2222
python-version: "3.7"
2323
# Allow debugging with tmate
@@ -26,7 +26,7 @@ jobs:
2626
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
2727
with:
2828
limit-access-to-actor: true
29-
- uses: actions/cache@v2
29+
- uses: actions/cache@v3
3030
id: cache
3131
with:
3232
path: ${{ env.pythonLocation }}

.github/workflows/smokeshow.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Smokeshow
2+
3+
on:
4+
workflow_run:
5+
workflows: [Test]
6+
types: [completed]
7+
8+
permissions:
9+
statuses: write
10+
11+
jobs:
12+
smokeshow:
13+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.9'
20+
21+
- run: pip install smokeshow
22+
23+
- uses: dawidd6/[email protected]
24+
with:
25+
workflow: test.yml
26+
commit: ${{ github.event.workflow_run.head_sha }}
27+
28+
- run: smokeshow upload coverage-html
29+
env:
30+
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
31+
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 95
32+
SMOKESHOW_GITHUB_CONTEXT: coverage
33+
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
35+
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}

.github/workflows/test.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
fail-fast: false
2323

2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3.1.0
2626
- name: Set up Python
27-
uses: actions/setup-python@v2
27+
uses: actions/setup-python@v4
2828
with:
2929
python-version: ${{ matrix.python-version }}
3030
# Allow debugging with tmate
@@ -33,7 +33,7 @@ jobs:
3333
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
3434
with:
3535
limit-access-to-actor: true
36-
- uses: actions/cache@v2
36+
- uses: actions/cache@v3
3737
id: cache
3838
with:
3939
path: ${{ env.pythonLocation }}
@@ -56,7 +56,43 @@ jobs:
5656
- name: Lint
5757
if: ${{ matrix.python-version != '3.6.15' }}
5858
run: python -m poetry run bash scripts/lint.sh
59+
- run: mkdir coverage
5960
- name: Test
6061
run: python -m poetry run bash scripts/test.sh
61-
- name: Upload coverage
62-
uses: codecov/codecov-action@v2
62+
env:
63+
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
64+
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
65+
- name: Store coverage files
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: coverage
69+
path: coverage
70+
coverage-combine:
71+
needs: [test]
72+
runs-on: ubuntu-latest
73+
74+
steps:
75+
- uses: actions/checkout@v3
76+
77+
- uses: actions/setup-python@v4
78+
with:
79+
python-version: '3.8'
80+
81+
- name: Get coverage files
82+
uses: actions/download-artifact@v3
83+
with:
84+
name: coverage
85+
path: coverage
86+
87+
- run: pip install coverage[toml]
88+
89+
- run: ls -la coverage
90+
- run: coverage combine coverage
91+
- run: coverage report
92+
- run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
93+
94+
- name: Store coverage HTML
95+
uses: actions/upload-artifact@v3
96+
with:
97+
name: coverage-html
98+
path: htmlcov

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
<a href="https://github.com/tiangolo/sqlmodel/actions?query=workflow%3APublish" target="_blank">
1212
<img src="https://github.com/tiangolo/sqlmodel/workflows/Publish/badge.svg" alt="Publish">
1313
</a>
14-
<a href="https://codecov.io/gh/tiangolo/sqlmodel" target="_blank">
15-
<img src="https://img.shields.io/codecov/c/github/tiangolo/sqlmodel?color=%2334D058" alt="Coverage">
16-
</a>
14+
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/tiangolo/sqlmodel" target="_blank">
15+
<img src="https://coverage-badge.samuelcolvin.workers.dev/tiangolo/sqlmodel.svg" alt="Coverage">
1716
<a href="https://pypi.org/project/sqlmodel" target="_blank">
1817
<img src="https://img.shields.io/pypi/v/sqlmodel?color=%2334D058&label=pypi%20package" alt="Package version">
1918
</a>

docs/db-to-code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The user is probably, in some way, telling your application:
6262
2
6363
```
6464

65-
And the would be this table (with a single row):
65+
And the result would be this table (with a single row):
6666

6767
<table>
6868
<tr>

docs/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
<a href="https://github.com/tiangolo/sqlmodel/actions?query=workflow%3APublish" target="_blank">
1212
<img src="https://github.com/tiangolo/sqlmodel/workflows/Publish/badge.svg" alt="Publish">
1313
</a>
14-
<a href="https://codecov.io/gh/tiangolo/sqlmodel" target="_blank">
15-
<img src="https://img.shields.io/codecov/c/github/tiangolo/sqlmodel?color=%2334D058" alt="Coverage">
16-
</a>
14+
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/tiangolo/sqlmodel" target="_blank">
15+
<img src="https://coverage-badge.samuelcolvin.workers.dev/tiangolo/sqlmodel.svg" alt="Coverage">
1716
<a href="https://pypi.org/project/sqlmodel" target="_blank">
1817
<img src="https://img.shields.io/pypi/v/sqlmodel?color=%2334D058&label=pypi%20package" alt="Package version">
1918
</a>

docs/release-notes.md

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

33
## Latest Changes
44

5+
* 👷 Refactor CI artifact upload/download for docs previews. PR [#514](https://github.com/tiangolo/sqlmodel/pull/514) by [@tiangolo](https://github.com/tiangolo).
6+
* ✏️ Fix typo in internal function name `get_sqlachemy_type()`. PR [#496](https://github.com/tiangolo/sqlmodel/pull/496) by [@cmarqu](https://github.com/cmarqu).
7+
* ⬆ Bump actions/cache from 2 to 3. PR [#497](https://github.com/tiangolo/sqlmodel/pull/497) by [@dependabot[bot]](https://github.com/apps/dependabot).
8+
* ✏️ Fix typo in docs. PR [#446](https://github.com/tiangolo/sqlmodel/pull/446) by [@davidbrochart](https://github.com/davidbrochart).
9+
* ⬆ Bump dawidd6/action-download-artifact from 2.24.0 to 2.24.2. PR [#493](https://github.com/tiangolo/sqlmodel/pull/493) by [@dependabot[bot]](https://github.com/apps/dependabot).
10+
* ✏️ Fix typo in `docs/tutorial/create-db-and-table.md`. PR [#477](https://github.com/tiangolo/sqlmodel/pull/477) by [@FluffyDietEngine](https://github.com/FluffyDietEngine).
11+
* ✏️ Fix small typos in docs. PR [#481](https://github.com/tiangolo/sqlmodel/pull/481) by [@micuffaro](https://github.com/micuffaro).
12+
* 🔧 Update Smokeshow coverage threshold. PR [#487](https://github.com/tiangolo/sqlmodel/pull/487) by [@tiangolo](https://github.com/tiangolo).
13+
* 👷 Move from Codecov to Smokeshow. PR [#486](https://github.com/tiangolo/sqlmodel/pull/486) by [@tiangolo](https://github.com/tiangolo).
14+
* ⬆ Bump actions/setup-python from 2 to 4. PR [#411](https://github.com/tiangolo/sqlmodel/pull/411) by [@dependabot[bot]](https://github.com/apps/dependabot).
15+
* ⬆ Update black requirement from ^21.5-beta.1 to ^22.10.0. PR [#460](https://github.com/tiangolo/sqlmodel/pull/460) by [@dependabot[bot]](https://github.com/apps/dependabot).
16+
* ➕ Add extra dev dependencies for MkDocs Material. PR [#485](https://github.com/tiangolo/sqlmodel/pull/485) by [@tiangolo](https://github.com/tiangolo).
17+
* ⬆ Update mypy requirement from 0.930 to 0.971. PR [#380](https://github.com/tiangolo/sqlmodel/pull/380) by [@dependabot[bot]](https://github.com/apps/dependabot).
18+
* ⬆ Update coverage requirement from ^5.5 to ^6.2. PR [#171](https://github.com/tiangolo/sqlmodel/pull/171) by [@dependabot[bot]](https://github.com/apps/dependabot).
19+
* ⬆ Bump codecov/codecov-action from 2 to 3. PR [#415](https://github.com/tiangolo/sqlmodel/pull/415) by [@dependabot[bot]](https://github.com/apps/dependabot).
20+
* ⬆ Bump actions/upload-artifact from 2 to 3. PR [#412](https://github.com/tiangolo/sqlmodel/pull/412) by [@dependabot[bot]](https://github.com/apps/dependabot).
21+
* ⬆ Update flake8 requirement from ^3.9.2 to ^5.0.4. PR [#396](https://github.com/tiangolo/sqlmodel/pull/396) by [@dependabot[bot]](https://github.com/apps/dependabot).
22+
* ⬆ Update pytest requirement from ^6.2.4 to ^7.0.1. PR [#242](https://github.com/tiangolo/sqlmodel/pull/242) by [@dependabot[bot]](https://github.com/apps/dependabot).
23+
* ⬆ Bump actions/checkout from 2 to 3.1.0. PR [#458](https://github.com/tiangolo/sqlmodel/pull/458) by [@dependabot[bot]](https://github.com/apps/dependabot).
24+
* ⬆ Bump dawidd6/action-download-artifact from 2.9.0 to 2.24.0. PR [#470](https://github.com/tiangolo/sqlmodel/pull/470) by [@dependabot[bot]](https://github.com/apps/dependabot).
25+
* 👷 Update Dependabot config. PR [#484](https://github.com/tiangolo/sqlmodel/pull/484) by [@tiangolo](https://github.com/tiangolo).
526

627
## 0.0.8
728

docs/tutorial/create-db-and-table.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ Now run the program with Python:
415415
// We set echo=True, so this will show the SQL code
416416
$ python app.py
417417

418-
// First, some boilerplate SQL that we are not that intereted in
418+
// First, some boilerplate SQL that we are not that interested in
419419

420420
INFO Engine BEGIN (implicit)
421421
INFO Engine PRAGMA main.table_info("hero")

docs/tutorial/where.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ Instead, it results in a special type of object. If you tried that in an interac
311311
<sqlalchemy.sql.elements.BinaryExpression object at 0x7f4aec0d6c90>
312312
```
313313

314-
So, that result value is an **expession** object. 💡
314+
So, that result value is an **expression** object. 💡
315315

316316
And `.where()` takes one (or more) of these **expression** objects to update the SQL statement.
317317

@@ -421,7 +421,7 @@ Of course, the keyword arguments would have been a bit shorter.
421421

422422
But with the **expressions** your editor can help you a lot with autocompletion and inline error checks. ✨
423423

424-
Let me give you an example. Let's imagine that keword arguments were supported in SQLModel and you wanted to filter using the secret identity of Spider-Boy.
424+
Let me give you an example. Let's imagine that keyword arguments were supported in SQLModel and you wanted to filter using the secret identity of Spider-Boy.
425425

426426
You could write:
427427

@@ -436,7 +436,7 @@ Maybe your code could even run and seem like it's all fine, and then some months
436436

437437
And maybe finally you would realize that we wrote the code using `secret_identity` which is not a column in the table. We should have written `secret_name` instead.
438438

439-
Now, with the the expressions, your editor would show you an error right away if you tried this:
439+
Now, with the expressions, your editor would show you an error right away if you tried this:
440440

441441
```Python
442442
# Expression ✨
@@ -694,7 +694,7 @@ age=35 id=5 name='Black Lion' secret_name='Trevor Challa'
694694
!!! tip
695695
We get `Black Lion` here too because although the age is not *strictly* less than `35` it is *equal* to `35`.
696696

697-
### Benefits of Expresions
697+
### Benefits of Expressions
698698

699699
Here's a good moment to see that being able to use these pure Python expressions instead of keyword arguments can help a lot. ✨
700700

pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ pydantic = "^1.8.2"
3636
sqlalchemy2-stubs = {version = "*", allow-prereleases = true}
3737

3838
[tool.poetry.dev-dependencies]
39-
pytest = "^6.2.4"
40-
mypy = "0.930"
41-
flake8 = "^3.9.2"
42-
black = {version = "^21.5-beta.1", python = "^3.7"}
39+
pytest = "^7.0.1"
40+
mypy = "0.971"
41+
flake8 = "^5.0.4"
42+
black = {version = "^22.10.0", python = "^3.7"}
4343
mkdocs = "^1.2.1"
4444
mkdocs-material = "^8.1.4"
45+
pillow = {version = "^9.3.0", python = "^3.7"}
46+
cairosvg = {version = "^2.5.2", python = "^3.7"}
4547
mdx-include = "^1.4.1"
46-
coverage = {extras = ["toml"], version = "^5.5"}
48+
coverage = {extras = ["toml"], version = "^6.2"}
4749
fastapi = "^0.68.1"
4850
requests = "^2.26.0"
4951
autoflake = "^1.4"
@@ -65,6 +67,7 @@ source = [
6567
"tests",
6668
"sqlmodel"
6769
]
70+
context = '${CONTEXT}'
6871

6972
[tool.coverage.report]
7073
exclude_lines = [

scripts/test-cov-html.sh

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

scripts/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ set -x
66
coverage run -m pytest tests
77
coverage combine
88
coverage report --show-missing
9-
coverage xml
9+
coverage html

scripts/zip-docs.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
set -x
44
set -e
55

6+
cd ./site
7+
68
if [ -f docs.zip ]; then
79
rm -rf docs.zip
810
fi
9-
zip -r docs.zip ./site
11+
zip -r docs.zip ./

sqlmodel/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def __init__(
371371
ModelMetaclass.__init__(cls, classname, bases, dict_, **kw)
372372

373373

374-
def get_sqlachemy_type(field: ModelField) -> Any:
374+
def get_sqlalchemy_type(field: ModelField) -> Any:
375375
if issubclass(field.type_, str):
376376
if field.field_info.max_length:
377377
return AutoString(length=field.field_info.max_length)
@@ -418,7 +418,7 @@ def get_column_from_field(field: ModelField) -> Column: # type: ignore
418418
sa_column = getattr(field.field_info, "sa_column", Undefined)
419419
if isinstance(sa_column, Column):
420420
return sa_column
421-
sa_type = get_sqlachemy_type(field)
421+
sa_type = get_sqlalchemy_type(field)
422422
primary_key = getattr(field.field_info, "primary_key", False)
423423
index = getattr(field.field_info, "index", Undefined)
424424
if index is Undefined:

0 commit comments

Comments
 (0)