Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/comment-docs-preview-in-pr/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7
FROM python:3.8

RUN pip install httpx "pydantic==1.5.1" pygithub

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/watch-previews/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7
FROM python:3.8

RUN pip install httpx PyGithub "pydantic==1.5.1"

Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.7"
python-version: "3.8.1"
# Allow debugging with tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
Expand All @@ -42,9 +42,8 @@ jobs:
# Ref: https://github.com/python-poetry/poetry-core/pull/188
run: |
python -m pip install --upgrade pip
python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2
python -m pip install "poetry==1.2.0a2"
python -m poetry plugin add poetry-version-plugin
python -m pip install "poetry==1.4.2"
python -m poetry self add poetry-version-plugin
- name: Configure poetry
run: python -m poetry config virtualenvs.create false
- name: Install Dependencies
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

Expand All @@ -19,7 +19,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.7"
python-version: "3.8.1"
# Allow debugging with tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
Expand All @@ -38,9 +38,8 @@ jobs:
# Ref: https://github.com/python-poetry/poetry-core/pull/188
run: |
python -m pip install --upgrade pip
python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2
python -m pip install "poetry==1.2.0a2"
python -m poetry plugin add poetry-version-plugin
python -m pip install "poetry==1.4.2"
python -m poetry self add poetry-version-plugin
- name: Configure poetry
run: python -m poetry config virtualenvs.create false
- name: Install Dependencies
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

Expand All @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6.15", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8.1", "3.9", "3.10", "3.11"]
fail-fast: false

steps:
Expand All @@ -45,16 +45,14 @@ jobs:
# Ref: https://github.com/python-poetry/poetry-core/pull/188
run: |
python -m pip install --upgrade pip
python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2
python -m pip install "poetry==1.2.0a2"
python -m poetry plugin add poetry-version-plugin
python -m pip install "poetry==1.4.2"
python -m poetry self add poetry-version-plugin
- name: Configure poetry
run: python -m poetry config virtualenvs.create false
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: python -m poetry install
- name: Lint
if: ${{ matrix.python-version != '3.6.15' }}
run: python -m poetry run bash scripts/lint.sh
- run: mkdir coverage
- name: Test
Expand All @@ -76,7 +74,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.8.1'

- name: Get coverage files
uses: actions/download-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ It combines SQLAlchemy and Pydantic and tries to simplify the code you write as

## Requirements

A recent and currently supported version of Python (right now, <a href="https://www.python.org/downloads/" class="external-link" target="_blank">Python supports versions 3.6 and above</a>).
A recent and currently supported version of Python (right now, <a href="https://www.python.org/downloads/" class="external-link" target="_blank">Python supports versions 3.8.1 and above</a>).

As **SQLModel** is based on **Pydantic** and **SQLAlchemy**, it requires them. They will be automatically installed when you install SQLModel.

Expand Down
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If you already cloned the repository and you know that you need to deep dive in

### Python

SQLModel supports Python 3.6 and above, but for development you should have at least **Python 3.7**.
SQLModel supports Python 3.8.1 and above.

### Poetry

Expand Down Expand Up @@ -116,7 +116,7 @@ There is a script that you can run locally to test all the code and generate cov
<div class="termy">

```console
$ bash scripts/test-cov-html.sh
$ bash scripts/test.sh
```

</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Nevertheless, SQLModel is completely **independent** of FastAPI and can be used

## Just Modern Python

It's all based on standard <abbr title="Python currently supported versions, 3.6 and above.">modern **Python**</abbr> type annotations. No new syntax to learn. Just standard modern Python.
It's all based on standard <abbr title="Python currently supported versions, 3.8.1 and above.">modern **Python**</abbr> type annotations. No new syntax to learn. Just standard modern Python.

If you need a 2 minute refresher of how to use Python types (even if you don't use SQLModel or FastAPI), check the FastAPI tutorial section: <a href="https://fastapi.tiangolo.com/python-types/" class="external-link" target="_blank">Python types intro</a>.

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ It combines SQLAlchemy and Pydantic and tries to simplify the code you write as

## Requirements

A recent and currently supported version of Python (right now, <a href="https://www.python.org/downloads/" class="external-link" target="_blank">Python supports versions 3.6 and above</a>).
A recent and currently supported version of Python (right now, <a href="https://www.python.org/downloads/" class="external-link" target="_blank">Python supports versions 3.8.1 and above</a>).

As **SQLModel** is based on **Pydantic** and **SQLAlchemy**, it requires them. They will be automatically installed when you install SQLModel.

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/fastapi/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ Now we can run the tests with `pytest` and see the results:
$ pytest

============= test session starts ==============
platform linux -- Python 3.7.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
platform linux -- Python 3.8.16, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/user/code/sqlmodel-tutorial
<b>collected 7 items </b>

Expand Down
11 changes: 5 additions & 6 deletions docs/tutorial/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ $ cd sqlmodel-tutorial

Make sure you have an officially supported version of Python.

Currently it is **Python 3.6** and above (Python 3.5 was already deprecated).
Currently it is **Python 3.8.1** and above (Python 3.5 was already deprecated).

You can check which version you have with:

<div class="termy">

```console
$ python3 --version
Python 3.6.9
Python 3.8.16
```

</div>
Expand All @@ -81,11 +81,10 @@ There's a chance that you have multiple Python versions installed.

You might want to try with the specific versions, for example with:

* `python3.11`
* `python3.10`
* `python3.9`
* `python3.8`
* `python3.7`
* `python3.6`
* `python3.8.1`

The code would look like this:

Expand Down Expand Up @@ -136,7 +135,7 @@ Here are the commands you could use:
<div class="termy">

```console
// Remember that you might need to use python3.9 or similar 💡
// Remember that you might need to use python3.9 or similar 💡
// Create the virtual environment using the module "venv"
$ python3 -m venv env
// ...here it creates the virtual enviroment in the directory "env"
Expand Down
1 change: 0 additions & 1 deletion docs_src/tutorial/fastapi/app_testing/tutorial001/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def update_hero(

@app.delete("/heroes/{hero_id}")
def delete_hero(*, session: Session = Depends(get_session), hero_id: int):

hero = session.get(Hero, hero_id)
if not hero:
raise HTTPException(status_code=404, detail="Hero not found")
Expand Down
1 change: 0 additions & 1 deletion docs_src/tutorial/fastapi/relationships/tutorial001.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ def update_hero(

@app.delete("/heroes/{hero_id}")
def delete_hero(*, session: Session = Depends(get_session), hero_id: int):

hero = session.get(Hero, hero_id)
if not hero:
raise HTTPException(status_code=404, detail="Hero not found")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def update_hero(

@app.delete("/heroes/{hero_id}")
def delete_hero(*, session: Session = Depends(get_session), hero_id: int):

hero = session.get(Hero, hero_id)
if not hero:
raise HTTPException(status_code=404, detail="Hero not found")
Expand Down
1 change: 0 additions & 1 deletion docs_src/tutorial/fastapi/teams/tutorial001.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def update_hero(

@app.delete("/heroes/{hero_id}")
def delete_hero(*, session: Session = Depends(get_session), hero_id: int):

hero = session.get(Hero, hero_id)
if not hero:
raise HTTPException(status_code=404, detail="Hero not found")
Expand Down
49 changes: 25 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ classifiers = [
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Database",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Internet",
Expand All @@ -30,28 +30,29 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.6.1"
python = "^3.8.1"
SQLAlchemy = ">=1.4.17,<=1.4.41"
pydantic = "^1.8.2"
pydantic = "^1.10.8"
sqlalchemy2-stubs = {version = "*", allow-prereleases = true}

[tool.poetry.dev-dependencies]
pytest = "^7.0.1"
mypy = "0.971"
flake8 = "^5.0.4"
black = {version = "^22.10.0", python = "^3.7"}
mkdocs = "^1.2.1"
mkdocs-material = "^8.1.4"
pillow = {version = "^9.3.0", python = "^3.7"}
cairosvg = {version = "^2.5.2", python = "^3.7"}
mdx-include = "^1.4.1"
coverage = {extras = ["toml"], version = "^6.2"}
fastapi = "^0.68.1"
mypy = "1.3.0"
flake8 = "^6.0.0"
black = {version = "^23.3.0", python = "^3.8.1"}
mkdocs = "^1.4.3"
mkdocs-material = "^9.1.15"
pillow = {version = "^9.3.0", python = "^3.8.1"}
cairosvg = {version = "^2.5.2", python = "^3.8.1"}
mdx-include = "^1.4.2"
coverage = {extras = ["toml"], version = "^7.2"}
fastapi = "^0.95.2"
httpx = "^0.24.0"
requests = "^2.26.0"
autoflake = "^1.4"
autoflake = "^2.1.1"
isort = "^5.9.3"
async_generator = {version = "*", python = "~3.6"}
async-exit-stack = {version = "*", python = "~3.6"}
async_generator = {version = "*", python = "~3.8.1"}
async-exit-stack = {version = "*", python = "~3.8.1"}

[build-system]
requires = ["poetry-core"]
Expand Down Expand Up @@ -88,16 +89,16 @@ skip_glob = [
[tool.mypy]
# --strict
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
warn_return_any = true
implicit_reexport = false
strict_equality = true
# --strict end
Expand Down
2 changes: 0 additions & 2 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ mypy sqlmodel
flake8 sqlmodel tests docs_src
black sqlmodel tests docs_src --check
isort sqlmodel tests docs_src scripts --check-only
# TODO: move this to test.sh after deprecating Python 3.6
CHECK_JINJA=1 python scripts/generate_select.py
2 changes: 2 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
set -e
set -x

CHECK_JINJA=1 python scripts/generate_select.py

coverage run -m pytest tests
coverage combine
coverage report --show-missing
Expand Down
3 changes: 2 additions & 1 deletion sqlmodel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Callable,
ClassVar,
Dict,
ForwardRef,
List,
Mapping,
Optional,
Expand All @@ -29,7 +30,7 @@
from pydantic.fields import FieldInfo as PydanticFieldInfo
from pydantic.fields import ModelField, Undefined, UndefinedType
from pydantic.main import ModelMetaclass, validate_model
from pydantic.typing import ForwardRef, NoArgAnyCallable, resolve_annotations
from pydantic.typing import NoArgAnyCallable, resolve_annotations
from pydantic.utils import ROOT_KEY, Representation
from sqlalchemy import Boolean, Column, Date, DateTime
from sqlalchemy import Enum as sa_Enum
Expand Down
Loading