Skip to content

Commit 035ace5

Browse files
refactor: drop sqlalchemy v1 support and modernize repository (#16)
* refactor: drop sqlalchemy v1 support and modernize repository * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * prettier 3.1.0 in pre-commit * only upload benchmark when not in pull request * revert breaking change * remove var name collision in tests * full update * bind mapper exceptions cannot be covered --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 2ec8521 commit 035ace5

17 files changed

Lines changed: 637 additions & 636 deletions

.github/dependabot.yaml

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

.github/renovate.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended",
5+
"group:allNonMajor",
6+
":maintainLockFilesMonthly",
7+
"schedule:weekly",
8+
":automergeMinor"
9+
],
10+
"labels": ["dependencies"],
11+
"rangeStrategy": "bump"
12+
}

.github/workflows/benchmark.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ jobs:
2727
python-version: "3.10"
2828
cache: true
2929
- name: Install dependencies
30-
run: pdm install --no-lock
30+
run: pdm install --frozen-lock
3131
- name: Run tests
3232
run: pdm benchmark
3333
- name: Store benchmark result
34+
if: github.event_name != 'pull_request'
3435
uses: benchmark-action/github-action-benchmark@v1
3536
with:
3637
tool: "pytest"

.github/workflows/publish.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,27 @@ name: Upload Python Package
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
67

78
jobs:
89
deploy:
9-
name: Upload release
10+
name: Upload to PyPI
1011
runs-on: ubuntu-latest
12+
environment:
13+
name: publish
14+
url: https://pypi.org/p/sqlalchemy-sessionload
1115
permissions:
12-
# IMPORTANT: this permission is mandatory for trusted publishing
1316
id-token: write
14-
1517
steps:
1618
- uses: actions/checkout@v4
1719
- name: Setup PDM
1820
uses: pdm-project/setup-pdm@v4
1921
with:
2022
python-version: "3.10"
23+
cache: true
24+
- name: Install dependencies
25+
run: pdm install --frozen-lock
26+
- name: Build
27+
run: pdm build
2128
- name: Publish
22-
run: pdm publish
29+
run: pdm publish --no-build

.github/workflows/test.yaml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
17+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1818
steps:
1919
- uses: actions/checkout@v4
2020
- name: Setup PDM
@@ -23,35 +23,10 @@ jobs:
2323
python-version: ${{ matrix.python-version }}
2424
cache: true
2525
- name: Install dependencies
26-
run: pdm install --no-lock
26+
run: pdm install --frozen-lock
2727
- name: Run tests
28-
run: pdm test_14
28+
run: pdm cov
2929
- name: Upload coverage to Codecov
30-
uses: codecov/codecov-action@v3
30+
uses: codecov/codecov-action@v5
3131
with:
32-
directory: coverage
33-
files: ./coverage/coverage.xml
34-
35-
Test20:
36-
name: Test SA 2.0
37-
runs-on: ubuntu-latest
38-
strategy:
39-
matrix:
40-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
41-
42-
steps:
43-
- uses: actions/checkout@v4
44-
- name: Setup PDM
45-
uses: pdm-project/setup-pdm@v4
46-
with:
47-
python-version: ${{ matrix.python-version }}
48-
cache: true
49-
- name: Install nox
50-
run: pip install nox
51-
- name: Run tests
52-
run: pdm test_20
53-
- name: Upload coverage to Codecov
54-
uses: codecov/codecov-action@v3
55-
with:
56-
directory: coverage
57-
files: ./coverage/coverage_20.xml
32+
token: ${{ secrets.CODECOV_TOKEN }}

.pre-commit-config.yaml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,47 @@
11
repos:
22
- repo: https://github.com/asottile/pyupgrade
3-
rev: v3.15.0
3+
rev: v3.19.0
44
hooks:
55
- id: pyupgrade
66
args:
7-
- --py38-plus
7+
- --py39-plus
88
- repo: https://github.com/hadialqattan/pycln
99
rev: v2.4.0
1010
hooks:
1111
- id: pycln
1212
args:
1313
- "--config=pyproject.toml"
14-
- repo: https://github.com/PyCQA/isort
15-
rev: 5.13.2
16-
hooks:
17-
- id: isort
1814
- repo: https://github.com/jvllmr/pyaphid
1915
rev: v0.3.1
2016
hooks:
2117
- id: pyaphid
22-
- repo: https://github.com/psf/black
23-
rev: 23.12.1
24-
hooks:
25-
- id: black
2618
- repo: https://github.com/adamchainz/blacken-docs
27-
rev: v1.12.1 # replace with latest tag on GitHub
19+
rev: 1.19.1 # replace with latest tag on GitHub
2820
hooks:
2921
- id: blacken-docs
3022
additional_dependencies:
3123
- black
32-
- repo: https://github.com/asottile/yesqa
33-
rev: v1.5.0
34-
hooks:
35-
- id: yesqa
3624
- repo: https://github.com/astral-sh/ruff-pre-commit
37-
rev: "v0.1.9"
25+
rev: "v0.8.0"
3826
hooks:
3927
- id: ruff
28+
args:
29+
- --fix
30+
- id: ruff-format
4031
- repo: https://github.com/pre-commit/mirrors-prettier
4132
rev: v3.1.0
4233
hooks:
4334
- id: prettier
4435
additional_dependencies: [prettier@latest, prettier-plugin-toml@latest]
4536
- repo: https://github.com/pre-commit/mirrors-mypy
46-
rev: "v1.8.0"
37+
rev: "v1.13.0"
4738
hooks:
4839
- id: mypy
4940
exclude: ^tests/.*
5041
additional_dependencies:
51-
- "sqlalchemy<2.0"
52-
- "sqlalchemy2-stubs"
42+
- sqlalchemy>=2.0.0
5343
- repo: https://github.com/pre-commit/pre-commit-hooks
54-
rev: v4.5.0
44+
rev: v5.0.0
5545
hooks:
5646
- id: check-yaml
5747
- id: end-of-file-fixer

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"python.testing.autoTestDiscoverOnSaveEnabled": true,
55
"python.terminal.activateEnvInCurrentTerminal": true,
66
"[python]": {
7-
"editor.defaultFormatter": "ms-python.black-formatter"
7+
"editor.defaultFormatter": "charliermarsh.ruff"
88
},
99
"ruff.enable": true,
1010
"mypy-type-checker.preferDaemon": true,

noxfile.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,8 @@
44

55
os.environ.update({"PDM_IGNORE_SAVED_PYTHON": "1"})
66

7-
lib_path = "src/sqlalchemy_sessionload"
8-
coverage_path = "coverage"
9-
107

118
@nox.session
129
def tests(session: nox.Session):
13-
session.run_always("pdm", "install", "--no-lock", external=True)
14-
session.run(
15-
"pytest", f"--cov={lib_path}", f"--cov-report=xml:{coverage_path}/coverage.xml"
16-
)
17-
18-
19-
@nox.session
20-
def tests_20(session: nox.Session):
21-
session.run_always("pdm", "install", "--no-lock", external=True)
22-
session.install("sqlalchemy>2.0")
23-
session.run(
24-
"pytest",
25-
f"--cov={lib_path}",
26-
f"--cov-report=xml:{coverage_path}/coverage_20.xml",
27-
)
10+
session.run_always("pdm", "install", "--frozen-lock", external=True)
11+
session.run("pytest", "--cov", "--cov-report=xml")

0 commit comments

Comments
 (0)