Skip to content

Commit a72e284

Browse files
committed
Remove support for python 3.6 (eol)
1 parent 3ac39b2 commit a72e284

File tree

8 files changed

+15
-37
lines changed

8 files changed

+15
-37
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-20.04
1919
strategy:
2020
matrix:
21-
python-version: ["3.6.15", "3.7", "3.8", "3.9", "3.10"]
21+
python-version: ["3.7", "3.8", "3.9", "3.10"]
2222
fail-fast: false
2323

2424
steps:
@@ -52,7 +52,6 @@ jobs:
5252
if: steps.cache.outputs.cache-hit != 'true'
5353
run: python -m poetry install
5454
- name: Lint
55-
if: ${{ matrix.python-version != '3.6.15' }}
5655
run: python -m poetry run bash scripts/lint.sh
5756
- run: mkdir coverage
5857
- name: Test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ It combines SQLAlchemy and Pydantic and tries to simplify the code you write as
5050

5151
## Requirements
5252

53-
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>).
53+
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.7 and above</a>).
5454

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

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ If you already cloned the repository and you know that you need to deep dive in
88

99
### Python
1010

11-
SQLModel supports Python 3.6 and above, but for development you should have at least **Python 3.7**.
11+
SQLModel supports Python 3.7 and above, but for development you should have at least **Python 3.7**.
1212

1313
### Poetry
1414

docs/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Nevertheless, SQLModel is completely **independent** of FastAPI and can be used
1212

1313
## Just Modern Python
1414

15-
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.
15+
It's all based on standard <abbr title="Python currently supported versions, 3.7 and above.">modern **Python**</abbr> type annotations. No new syntax to learn. Just standard modern Python.
1616

1717
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>.
1818

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ It combines SQLAlchemy and Pydantic and tries to simplify the code you write as
5050

5151
## Requirements
5252

53-
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>).
53+
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.7 and above</a>).
5454

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

docs/tutorial/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $ cd sqlmodel-tutorial
6464

6565
Make sure you have an officially supported version of Python.
6666

67-
Currently it is **Python 3.6** and above (Python 3.5 was already deprecated).
67+
Currently it is **Python 3.7** and above.
6868

6969
You can check which version you have with:
7070

@@ -85,7 +85,6 @@ You might want to try with the specific versions, for example with:
8585
* `python3.9`
8686
* `python3.8`
8787
* `python3.7`
88-
* `python3.6`
8988

9089
The code would look like this:
9190

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ classifiers = [
1717
"Intended Audience :: System Administrators",
1818
"License :: OSI Approved :: MIT License",
1919
"Programming Language :: Python :: 3 :: Only",
20-
"Programming Language :: Python :: 3.6",
2120
"Programming Language :: Python :: 3.7",
2221
"Programming Language :: Python :: 3.8",
2322
"Programming Language :: Python :: 3.9",
@@ -30,7 +29,7 @@ classifiers = [
3029
]
3130

3231
[tool.poetry.dependencies]
33-
python = "^3.6.1"
32+
python = "^3.7.0"
3433
SQLAlchemy = ">=1.4.17,<=1.4.41"
3534
pydantic = "^1.8.2"
3635
sqlalchemy2-stubs = {version = "*", allow-prereleases = true}

sqlmodel/sql/expression.py

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,17 @@
2424

2525
_TSelect = TypeVar("_TSelect")
2626

27-
# Workaround Generics incompatibility in Python 3.6
28-
# Ref: https://github.com/python/typing/issues/449#issuecomment-316061322
29-
if sys.version_info.minor >= 7:
3027

31-
class Select(_Select, Generic[_TSelect]):
32-
inherit_cache = True
28+
class Select(_Select, Generic[_TSelect]):
29+
inherit_cache = True
3330

34-
# This is not comparable to sqlalchemy.sql.selectable.ScalarSelect, that has a different
35-
# purpose. This is the same as a normal SQLAlchemy Select class where there's only one
36-
# entity, so the result will be converted to a scalar by default. This way writing
37-
# for loops on the results will feel natural.
38-
class SelectOfScalar(_Select, Generic[_TSelect]):
39-
inherit_cache = True
4031

41-
else:
42-
from typing import GenericMeta # type: ignore
43-
44-
class GenericSelectMeta(GenericMeta, _Select.__class__): # type: ignore
45-
pass
46-
47-
class _Py36Select(_Select, Generic[_TSelect], metaclass=GenericSelectMeta):
48-
inherit_cache = True
49-
50-
class _Py36SelectOfScalar(_Select, Generic[_TSelect], metaclass=GenericSelectMeta):
51-
inherit_cache = True
52-
53-
# Cast them for editors to work correctly, from several tricks tried, this works
54-
# for both VS Code and PyCharm
55-
Select = cast("Select", _Py36Select) # type: ignore
56-
SelectOfScalar = cast("SelectOfScalar", _Py36SelectOfScalar) # type: ignore
32+
# This is not comparable to sqlalchemy.sql.selectable.ScalarSelect, that has a different
33+
# purpose. This is the same as a normal SQLAlchemy Select class where there's only one
34+
# entity, so the result will be converted to a scalar by default. This way writing
35+
# for loops on the results will feel natural.
36+
class SelectOfScalar(_Select, Generic[_TSelect]):
37+
inherit_cache = True
5738

5839

5940
if TYPE_CHECKING: # pragma: no cover

0 commit comments

Comments
 (0)