Skip to content

Commit 02bd7eb

Browse files
authored
🗑️ Deprecate Python 3.6 and upgrade Poetry and Poetry Version Plugin (#627)
1 parent 43a689d commit 02bd7eb

File tree

14 files changed

+77
-124
lines changed

14 files changed

+77
-124
lines changed

.github/workflows/build-docs.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,28 @@ on:
44
branches:
55
- main
66
pull_request:
7-
types: [opened, synchronize]
7+
types:
8+
- opened
9+
- synchronize
810
workflow_dispatch:
911
inputs:
1012
debug_enabled:
11-
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
13+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
1214
required: false
1315
default: false
1416
jobs:
1517
build-docs:
16-
runs-on: ubuntu-20.04
18+
runs-on: ubuntu-latest
1719
steps:
1820
- name: Dump GitHub context
1921
env:
2022
GITHUB_CONTEXT: ${{ toJson(github) }}
2123
run: echo "$GITHUB_CONTEXT"
22-
- uses: actions/checkout@v3.1.0
24+
- uses: actions/checkout@v3
2325
- name: Set up Python
2426
uses: actions/setup-python@v4
2527
with:
26-
python-version: "3.7"
28+
python-version: "3.11"
2729
# Allow debugging with tmate
2830
- name: Setup tmate session
2931
uses: mxschmitt/action-tmate@v3
@@ -34,34 +36,30 @@ jobs:
3436
id: cache
3537
with:
3638
path: ${{ env.pythonLocation }}
37-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-docs
39+
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-docs-v2
3840
- name: Install poetry
3941
if: steps.cache.outputs.cache-hit != 'true'
40-
# TODO: remove python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2
41-
# once there's a release of Poetry 1.2.x including poetry-core > 1.1.0a6
42-
# Ref: https://github.com/python-poetry/poetry-core/pull/188
4342
run: |
4443
python -m pip install --upgrade pip
45-
python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2
46-
python -m pip install "poetry==1.2.0a2"
47-
python -m poetry plugin add poetry-version-plugin
44+
python -m pip install "poetry"
45+
python -m poetry self add poetry-version-plugin
4846
- name: Configure poetry
4947
run: python -m poetry config virtualenvs.create false
5048
- name: Install Dependencies
5149
if: steps.cache.outputs.cache-hit != 'true'
5250
run: python -m poetry install
5351
- name: Install Material for MkDocs Insiders
54-
if: github.event.pull_request.head.repo.fork == false && steps.cache.outputs.cache-hit != 'true'
55-
run: python -m poetry run pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
52+
if: ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false ) && steps.cache.outputs.cache-hit != 'true'
53+
run: python -m poetry run pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git
5654
- uses: actions/cache@v3
5755
with:
5856
key: mkdocs-cards-${{ github.ref }}
5957
path: .cache
6058
- name: Build Docs
61-
if: github.event.pull_request.head.repo.fork == true
59+
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true
6260
run: python -m poetry run mkdocs build
6361
- name: Build Docs with Insiders
64-
if: github.event.pull_request.head.repo.fork == false
62+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
6563
run: python -m poetry run mkdocs build --config-file mkdocs.insiders.yml
6664
- name: Zip docs
6765
run: python -m poetry run bash ./scripts/zip-docs.sh
@@ -70,7 +68,7 @@ jobs:
7068
name: docs-zip
7169
path: ./site/docs.zip
7270
- name: Deploy to Netlify
73-
uses: nwtgck/actions-netlify@v1.1.5
71+
uses: nwtgck/actions-netlify@v2.0.0
7472
with:
7573
publish-dir: './site'
7674
production-branch: main

.github/workflows/publish.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ on:
77
workflow_dispatch:
88
inputs:
99
debug_enabled:
10-
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
10+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
1111
required: false
1212
default: false
1313

1414
jobs:
1515
publish:
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3.1.0
18+
- uses: actions/checkout@v3
1919
- name: Set up Python
2020
uses: actions/setup-python@v4
2121
with:
@@ -30,17 +30,13 @@ jobs:
3030
id: cache
3131
with:
3232
path: ${{ env.pythonLocation }}
33-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root
33+
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-v2
3434
- name: Install poetry
3535
if: steps.cache.outputs.cache-hit != 'true'
36-
# TODO: remove python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2
37-
# once there's a release of Poetry 1.2.x including poetry-core > 1.1.0a6
38-
# Ref: https://github.com/python-poetry/poetry-core/pull/188
3936
run: |
4037
python -m pip install --upgrade pip
41-
python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2
42-
python -m pip install "poetry==1.2.0a2"
43-
python -m poetry plugin add poetry-version-plugin
38+
python -m pip install "poetry"
39+
python -m poetry self add poetry-version-plugin
4440
- name: Configure poetry
4541
run: python -m poetry config virtualenvs.create false
4642
- name: Install Dependencies

.github/workflows/test.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,30 @@ on:
55
branches:
66
- main
77
pull_request:
8-
types: [opened, synchronize]
8+
types:
9+
- opened
10+
- synchronize
911
workflow_dispatch:
1012
inputs:
1113
debug_enabled:
12-
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
14+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
1315
required: false
1416
default: false
1517

1618
jobs:
1719
test:
18-
runs-on: ubuntu-20.04
20+
runs-on: ubuntu-latest
1921
strategy:
2022
matrix:
21-
python-version: ["3.6.15", "3.7", "3.8", "3.9", "3.10"]
23+
python-version:
24+
- "3.7"
25+
- "3.8"
26+
- "3.9"
27+
- "3.10"
2228
fail-fast: false
2329

2430
steps:
25-
- uses: actions/checkout@v3.1.0
31+
- uses: actions/checkout@v3
2632
- name: Set up Python
2733
uses: actions/setup-python@v4
2834
with:
@@ -37,24 +43,19 @@ jobs:
3743
id: cache
3844
with:
3945
path: ${{ env.pythonLocation }}
40-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root
46+
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-v2
4147
- name: Install poetry
4248
if: steps.cache.outputs.cache-hit != 'true'
43-
# TODO: remove python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2
44-
# once there's a release of Poetry 1.2.x including poetry-core > 1.1.0a6
45-
# Ref: https://github.com/python-poetry/poetry-core/pull/188
4649
run: |
4750
python -m pip install --upgrade pip
48-
python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2
49-
python -m pip install "poetry==1.2.0a2"
50-
python -m poetry plugin add poetry-version-plugin
51+
python -m pip install "poetry"
52+
python -m poetry self add poetry-version-plugin
5153
- name: Configure poetry
5254
run: python -m poetry config virtualenvs.create false
5355
- name: Install Dependencies
5456
if: steps.cache.outputs.cache-hit != 'true'
5557
run: python -m poetry install
5658
- name: Lint
57-
if: ${{ matrix.python-version != '3.6.15' }}
5859
run: python -m poetry run bash scripts/lint.sh
5960
- run: mkdir coverage
6061
- name: Test
@@ -68,7 +69,8 @@ jobs:
6869
name: coverage
6970
path: coverage
7071
coverage-combine:
71-
needs: [test]
72+
needs:
73+
- test
7274
runs-on: ubuntu-latest
7375

7476
steps:
@@ -96,3 +98,15 @@ jobs:
9698
with:
9799
name: coverage-html
98100
path: htmlcov
101+
102+
# https://github.com/marketplace/actions/alls-green#why
103+
alls-green: # This job does nothing and is only used for the branch protection
104+
if: always()
105+
needs:
106+
- coverage-combine
107+
runs-on: ubuntu-latest
108+
steps:
109+
- name: Decide whether the needed jobs succeeded or failed
110+
uses: re-actors/alls-green@release/v1
111+
with:
112+
jobs: ${{ toJSON(needs) }}

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 <a href="https://www.python.org/downloads/" class="external-link" target="_blank">version of Python Python</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: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ First, you might want to see the basic ways to [help SQLModel and get help](help
66

77
If you already cloned the repository and you know that you need to deep dive in the code, here are some guidelines to set up your environment.
88

9-
### Python
10-
11-
SQLModel supports Python 3.6 and above, but for development you should have at least **Python 3.7**.
12-
139
### Poetry
1410

1511
**SQLModel** uses <a href="https://python-poetry.org/" class="external-link" target="_blank">Poetry</a> to build, package, and publish the project.

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="Currently supported versions of Python">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 <a href="https://www.python.org/downloads/" class="external-link" target="_blank">version of Python Python</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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,13 @@ $ 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).
68-
6967
You can check which version you have with:
7068

7169
<div class="termy">
7270

7371
```console
7472
$ python3 --version
75-
Python 3.6.9
73+
Python 3.11
7674
```
7775

7876
</div>
@@ -84,8 +82,6 @@ You might want to try with the specific versions, for example with:
8482
* `python3.10`
8583
* `python3.9`
8684
* `python3.8`
87-
* `python3.7`
88-
* `python3.6`
8985

9086
The code would look like this:
9187

pyproject.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ 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",
23+
"Programming Language :: Python :: 3.10",
2424
"Topic :: Database",
2525
"Topic :: Database :: Database Engines/Servers",
2626
"Topic :: Internet",
@@ -30,7 +30,7 @@ classifiers = [
3030
]
3131

3232
[tool.poetry.dependencies]
33-
python = "^3.6.1"
33+
python = "^3.7"
3434
SQLAlchemy = ">=1.4.17,<=1.4.41"
3535
pydantic = "^1.8.2"
3636
sqlalchemy2-stubs = {version = "*", allow-prereleases = true}
@@ -39,19 +39,17 @@ sqlalchemy2-stubs = {version = "*", allow-prereleases = true}
3939
pytest = "^7.0.1"
4040
mypy = "0.971"
4141
flake8 = "^5.0.4"
42-
black = {version = "^22.10.0", python = "^3.7"}
42+
black = "^22.10.0"
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"}
45+
pillow = "^9.3.0"
46+
cairosvg = "^2.5.2"
4747
mdx-include = "^1.4.1"
4848
coverage = {extras = ["toml"], version = "^6.2"}
4949
fastapi = "^0.68.1"
5050
requests = "^2.26.0"
5151
autoflake = "^1.4"
5252
isort = "^5.9.3"
53-
async_generator = {version = "*", python = "~3.6"}
54-
async-exit-stack = {version = "*", python = "~3.6"}
5553

5654
[build-system]
5755
requires = ["poetry-core"]

scripts/lint.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@ mypy sqlmodel
77
flake8 sqlmodel tests docs_src
88
black sqlmodel tests docs_src --check
99
isort sqlmodel tests docs_src scripts --check-only
10-
# TODO: move this to test.sh after deprecating Python 3.6
11-
CHECK_JINJA=1 python scripts/generate_select.py

0 commit comments

Comments
 (0)