Skip to content

Commit 35ed1d2

Browse files
committed
Adjust dependencies to work with Python 3.6 all the way to Python 3.13
1 parent b1305a9 commit 35ed1d2

36 files changed

+293
-290
lines changed

.circleci/config.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
steps:
5656
- checkout
5757
- install-dependencies:
58-
extra: test
58+
extra: dev, test
5959
- run-tests:
6060
pyversion: 36
6161

@@ -67,7 +67,7 @@ jobs:
6767
steps:
6868
- checkout
6969
- install-dependencies:
70-
extra: test
70+
extra: dev, test
7171
- run-tests:
7272
pyversion: 37
7373

@@ -79,7 +79,7 @@ jobs:
7979
steps:
8080
- checkout
8181
- install-dependencies:
82-
extra: test
82+
extra: dev, test
8383
- run-tests:
8484
pyversion: 38
8585

@@ -91,7 +91,7 @@ jobs:
9191
steps:
9292
- checkout
9393
- install-dependencies:
94-
extra: test
94+
extra: dev, test
9595
- run-tests:
9696
pyversion: 39
9797

@@ -103,7 +103,7 @@ jobs:
103103
steps:
104104
- checkout
105105
- install-dependencies:
106-
extra: test
106+
extra: dev, test
107107
- run-tests:
108108
pyversion: 310
109109

@@ -115,9 +115,14 @@ jobs:
115115
steps:
116116
- checkout
117117
- install-dependencies:
118-
extra: test
118+
extra: dev, test, test-report
119119
- run-tests:
120120
pyversion: 311
121+
- store_test_results:
122+
path: reports
123+
- run:
124+
name: Upload coverage report
125+
command: coveralls
121126

122127
test-python312:
123128
executor:
@@ -128,7 +133,7 @@ jobs:
128133
steps:
129134
- checkout
130135
- install-dependencies:
131-
extra: test
136+
extra: dev, test
132137
- run-tests:
133138
pyversion: 312
134139

@@ -141,14 +146,9 @@ jobs:
141146
steps:
142147
- checkout
143148
- install-dependencies:
144-
extra: test
149+
extra: dev, test
145150
- run-tests:
146151
pyversion: 313
147-
- store_test_results:
148-
path: reports
149-
- run:
150-
name: Upload coverage report
151-
command: coveralls
152152

153153
analysis:
154154
executor:
@@ -157,10 +157,10 @@ jobs:
157157
steps:
158158
- checkout
159159
- install-dependencies:
160-
extra: analysis, test
160+
extra: dev, analysis, test
161161
- run:
162162
name: Verify
163-
command: python setup.py verify
163+
command: poe verify
164164

165165
publish:
166166
executor:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ reports/
1515
*.egg-info/
1616
pip-wheel-metadata/
1717
dist/
18+
build/
1819

1920
# Ignore stupid .DS_Store
2021
.DS_Store

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ With seamless we mean that any features we add will work truly seamlessly. You s
5959
## Working with the code
6060
### Prerequisites
6161

62-
* PostgreSQL 10 or newer.
63-
* Django 2.0 or newer (including 3.x, 4.x).
64-
* Python 3.6 or newer.
62+
* PostgreSQL 14 or newer.
63+
* Django 5.x or newer.
64+
* Python 3.11 or newer.
65+
66+
These are just for local development. CI for code analysis etc runs against these. Tests will pass on all Python, Django and PostgreSQL versions documented. Linting, formatting and type-checking the code might not work on other Python and/or Django versions.
6567

6668
### Getting started
6769

@@ -86,16 +88,16 @@ With seamless we mean that any features we add will work truly seamlessly. You s
8688

8789
4. Install the development/test dependencies:
8890

89-
λ pip install .[test] .[analysis]
91+
λ pip install -r requirements-test.txt
9092

9193
5. Run the tests:
9294

93-
λ tox
95+
λ poe test
9496

9597
6. Run the benchmarks:
9698

97-
λ py.test -c pytest-benchmark.ini
99+
λ poe benchmark
98100

99101
7. Auto-format code, sort imports and auto-fix linting errors:
100102

101-
λ python setup.py fix
103+
λ poe fix

psqlextra/backend/migrations/patched_autodetector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
class AddOperationHandler:
3838
"""Handler for when operations are being added to a new migration.
3939
40-
This is where we intercept operations such as
41-
:see:CreateModel to replace it with our own.
40+
This is where we intercept operations such as :see:CreateModel to
41+
replace it with our own.
4242
"""
4343

4444
def __init__(self, autodetector, app_label, args, kwargs):

psqlextra/backend/schema.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,9 +558,9 @@ def replace_materialized_view_model(self, model: Type[Model]) -> None:
558558
559559
This is used to alter the backing query of a materialized view.
560560
561-
Replacing a materialized view is a lot trickier than a normal view.
562-
For normal views we can use `CREATE OR REPLACE VIEW`, but for
563-
materialized views, we have to create the new view, copy all
561+
Replacing a materialized view is a lot trickier than a normal
562+
view. For normal views we can use `CREATE OR REPLACE VIEW`, but
563+
for materialized views, we have to create the new view, copy all
564564
indexes and constraints and drop the old one.
565565
566566
This operation is atomic as it runs in a transaction.

psqlextra/models/view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def _view_query_as_sql_with_params(
5454
5555
When copying the meta options from the model, we convert any
5656
from the above to a raw SQL query with bind parameters. We do
57-
this is because it is what the SQL driver understands and
58-
we can easily serialize it into a migration.
57+
this is because it is what the SQL driver understands and we can
58+
easily serialize it into a migration.
5959
"""
6060

6161
# might be a callable to support delayed imports

psqlextra/partitioning/plan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def apply(self, using: Optional[str]) -> None:
5454
def print(self) -> None:
5555
"""Prints this model plan to the terminal in a readable format."""
5656

57-
print(f"{self.config.model.__name__}:")
57+
print(f"{self.config.model.__name__}: ")
5858

5959
for partition in self.deletions:
6060
print(" - %s" % partition.name())

psqlextra/query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def annotate(self, **annotations) -> "Self": # type: ignore[valid-type, overrid
7373
name of an existing field on the model as the alias name. This
7474
version of the function does allow that.
7575
76-
This is done by temporarily renaming the fields in order to avoid the
77-
check for conflicts that the base class does.
78-
We rename all fields instead of the ones that already exist because
76+
This is done by temporarily renaming the fields in order to
77+
avoid the check for conflicts that the base class does. We
78+
rename all fields instead of the ones that already exist because
7979
the annotations are stored in an OrderedDict. Renaming only the
8080
conflicts will mess up the order.
8181
"""

psqlextra/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ def postgres_set_local(
1616
1717
The effect is undone when the context manager exits.
1818
19-
See https://www.postgresql.org/docs/current/runtime-config-client.html
19+
See
20+
https://www.postgresql.org/docs/current/runtime-config-client.html
2021
for an overview of all available options.
2122
"""
2223

pyproject.toml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ exclude = '''
66
| .env
77
| env
88
| venv
9-
| tests/snapshots
9+
| tests/__snapshots__
1010
)/
1111
)
1212
'''
@@ -25,3 +25,61 @@ ignore_missing_imports = true
2525

2626
[tool.django-stubs]
2727
django_settings_module = "settings"
28+
29+
[tool.poe.tasks]
30+
_autoflake = "python3 -m autoflake --remove-all -i -r setup.py psqlextra tests"
31+
_autopep8 = "autopep8 -i -r setup.py psqlextra tests"
32+
_isort_setup_py = "isort setup.py"
33+
_isort_psqlextra = "isort psqlextra"
34+
_isort_tests = "isort tests"
35+
_isort_verify_setup_py = "isort -c setup.py"
36+
_isort_verify_psqlextra = "isort -c psqlextra"
37+
_isort_verify_tests = "isort -c tests"
38+
39+
[tool.poe.tasks.lint]
40+
cmd = "python3 -m flake8 --builtin=__version__ setup.py psqlextra tests"
41+
help = "Lints all the code."
42+
43+
[tool.poe.tasks.lint_fix]
44+
sequence = ["_autoflake", "_autopep8"]
45+
help = "Auto-fixes linter errors."
46+
47+
[tool.poe.tasks.lint_types]
48+
cmd = "mypy --package psqlextra --pretty --show-error-codes"
49+
help = "Type-checks the code."
50+
51+
[tool.poe.tasks.format]
52+
cmd = "black setup.py psqlextra tests"
53+
help = "Auto-formats the code."
54+
55+
[tool.poe.tasks.format_verify]
56+
cmd = "black --check setup.py psqlextra tests"
57+
help = "Verifies that the code was formatted properly."
58+
59+
[tool.poe.tasks.format_docstrings]
60+
cmd = "docformatter -r -i ."
61+
help = "Auto-formats doc strings."
62+
63+
[tool.poe.tasks.format_docstrings_verify]
64+
cmd = "docformatter -r -c ."
65+
help = "Verifies all doc strings are properly formatted."
66+
67+
[tool.poe.tasks.sort_imports]
68+
sequence = ["_isort_setup_py", "_isort_psqlextra", "_isort_tests"]
69+
help = "Auto-sorts the imports."
70+
71+
[tool.poe.tasks.sort_imports_verify]
72+
sequence = ["_isort_verify_setup_py", "_isort_verify_psqlextra", "_isort_verify_tests"]
73+
help = "Verifies that the imports are properly sorted."
74+
75+
[tool.poe.tasks.fix]
76+
sequence = ["format", "format_docstrings", "sort_imports", "lint_fix", "lint", "lint_types"]
77+
help = "Automatically format code and fix linting errors."
78+
79+
[tool.poe.tasks.verify]
80+
sequence = ["format_verify", "format_docstrings_verify", "sort_imports_verify", "lint", "lint_types"]
81+
help = "Automatically format code and fix linting errors."
82+
83+
[tool.poe.tasks.test]
84+
cmd = "pytest --cov=psqlextra --cov-report=term --cov-report=xml:reports/xml --cov-report=html:reports/html --junitxml=reports/junit/tests.xml --reuse-db -vv"
85+
help = "Runs all the tests."

0 commit comments

Comments
 (0)