Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Python 3.6-3.7, Django 3.2-4.1 #69

Merged
merged 9 commits into from
Feb 15, 2025
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- name: checkout code
uses: actions/checkout@v2
- name: run checks
run: docker-compose run --rm django-pg-zero-downtime-migrations-tests tox
run: docker compose run --rm django-pg-zero-downtime-migrations-tests tox
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ RUN apt-get install -q -y --no-install-recommends software-properties-common git
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN apt-get install -q -y --no-install-recommends \
python3.6 \
python3.7 python3.7-distutils \
python3.8 python3.8-distutils \
python3.9 python3.9-distutils \
python3.10 python3.10-distutils \
Expand Down
64 changes: 21 additions & 43 deletions django_zero_downtime_migrations/backends/postgres/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,49 +955,27 @@ def _patched_iter_column_sql(
):
yield self.connection.ops.tablespace_sql(tablespace, inline=True)

if django.VERSION >= (4, 1):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was automatable with django-upgrade, unlike the other branches where the version is specified as django.VERSION[:2]

probably one to keep in mind for the future where adding these kind of branches: https://github.com/adamchainz/django-upgrade?tab=readme-ov-file#versioned-blocks

def _iter_column_sql(
self, column_db_type, params, model, field, field_db_params, include_default
):
if not include_default:
yield from super()._iter_column_sql(
column_db_type,
params,
model,
field,
field_db_params,
include_default,
)
else:
yield from self._patched_iter_column_sql(
column_db_type,
params,
model,
field,
field_db_params,
include_default,
)
else:
def _iter_column_sql(
self, column_db_type, params, model, field, include_default
):
if not include_default:
yield from super()._iter_column_sql(
column_db_type,
params,
model,
field,
include_default,
)
else:
yield from self._patched_iter_column_sql(
column_db_type,
params,
model,
field,
{},
include_default,
)
def _iter_column_sql(
self, column_db_type, params, model, field, field_db_params, include_default
):
if not include_default:
yield from super()._iter_column_sql(
column_db_type,
params,
model,
field,
field_db_params,
include_default,
)
else:
yield from self._patched_iter_column_sql(
column_db_type,
params,
model,
field,
field_db_params,
include_default,
)

def _alter_column_set_not_null(self, model, new_field):
self.deferred_sql.append(self._sql_column_not_null % {
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.7"
services:
pg16:
image: postgres:16-alpine
Expand Down
9 changes: 2 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,19 @@ def _get_long_description():
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'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',
'Programming Language :: Python :: 3.12',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
],
keywords='django postgres postgresql migrations',
packages=find_packages(exclude=['manage*', 'tests*']),
python_requires='>=3.6',
python_requires='>=3.8',
install_requires=[
'django>=3.2',
'django>=4.2',
]
)
14 changes: 0 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
envlist =
py{3.10,3.11,3.12}-django{5.0}-psycopg{2,3}
py{3.8,3.9,3.10,3.11,3.12}-django{4.2}-psycopg{2,3}
py{3.8,3.9,3.10,3.11}-django{4.0,4.1}
py{3.6,3.7,3.8,3.9,3.10}-django{3.2}

[testenv]
usedevelop = True
Expand All @@ -15,12 +13,6 @@ commands =
py{3.8,3.9,3.10,3.11,3.12}-django{4.2,5.0}-psycopg{2,3}: bash -c "DB_HOST=pg16 DB_USER=test pytest tests/unit"
py{3.8,3.9,3.10,3.11,3.12}-django{4.2,5.0}-psycopg{2,3}: bash -c "DB_HOST=postgis16 DB_USER=root DB_ENGINE=django_zero_downtime_migrations.backends.postgis pytest tests/unit"

py{3.8,3.9,3.10,3.11}-django{4.0,4.1}: bash -c "DB_HOST=pg16 DB_USER=test pytest tests/unit"
py{3.8,3.9,3.10,3.11}-django{4.0,4.1}: bash -c "DB_HOST=postgis16 DB_USER=root DB_ENGINE=django_zero_downtime_migrations.backends.postgis pytest tests/unit"

py{3.6,3.7,3.8,3.9,3.10}-django{3.2}: bash -c "DB_HOST=pg16 DB_USER=test pytest tests/unit"
py{3.6,3.7,3.8,3.9,3.10}-django{3.2}: bash -c "DB_HOST=postgis16 DB_USER=root DB_ENGINE=django_zero_downtime_migrations.backends.postgis pytest tests/unit"

py{3.12}-django{5.0}-psycopg{3}: bash -c "DB_HOST=pg16 DB_USER=test DB_ENGINE=django.db.backends.postgresql pytest tests/integration"
py{3.12}-django{5.0}-psycopg{3}: bash -c "DB_HOST=pg16 DB_USER=test DB_SUPER_USER=root pytest tests/integration"
py{3.12}-django{5.0}-psycopg{3}: bash -c "DB_HOST=postgis16 DB_USER=root DB_ENGINE=django_zero_downtime_migrations.backends.postgis pytest tests/integration"
Expand All @@ -31,8 +23,6 @@ commands =
py{3.12}-django{5.0}-psycopg{3}: bash -c "DB_HOST=pg12 DB_USER=test DB_SUPER_USER=root pytest tests/integration"

py{3.12}-django{4.2}-psycopg{3}: bash -c "DB_HOST=pg16 DB_USER=test DB_SUPER_USER=root pytest tests/integration"
py{3.11}-django{4.0,4.1}: bash -c "DB_HOST=pg16 DB_USER=test DB_SUPER_USER=root pytest tests/integration"
py{3.10}-django{3.2}: bash -c "DB_HOST=pg16 DB_USER=test DB_SUPER_USER=root pytest tests/integration"

deps =
py{3.12}-django{5.0}-psycopg{3}: flake8
Expand All @@ -42,12 +32,8 @@ deps =
pytest-django
pytest-mock

django{3.2,4.0,4.1}: psycopg2-binary
psycopg2: psycopg2-binary
psycopg3: psycopg[binary]

django3.2: django>=3.2,<4.0
django4.0: django>=4.0,<4.1
django4.1: django>=4.1,<4.2
django4.2: django>=4.2,<5.0
django5.0: django>=5.0,<5.1