Skip to content

Commit 3baeee6

Browse files
authored
Upgrade Django and switch to uv (#7)
* support new Django versions and switch to uv * always with the 0s in yaml * remove flake8 * remove deprecated classifier * add lock file * add setuptools config * remove python 3.13 until upgrading to minimum support django version * update README * update README
1 parent 5f5d560 commit 3baeee6

File tree

10 files changed

+514
-100
lines changed

10 files changed

+514
-100
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
services:
99
postgres:
10-
image: postgres:10.8
10+
image: postgres:14.9
1111
env:
1212
POSTGRES_USER: postgres
1313
POSTGRES_PASSWORD: postgres
@@ -19,30 +19,22 @@ jobs:
1919
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
2020
strategy:
2121
matrix:
22-
python-version: [3.6, 3.7, 3.8, 3.9]
22+
python-version: ["3.10", "3.11", "3.12"]
2323

2424
steps:
2525
- uses: actions/checkout@v2
26-
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v1
26+
- name: Install uv and Python ${{ matrix.python-version }}
27+
uses: astral-sh/setup-uv@v5
2828
with:
29+
version: "0.6.12"
2930
python-version: ${{ matrix.python-version }}
3031
- name: Install dependencies
31-
run: |
32-
python -m pip install --upgrade pip
33-
pip install pipenv
34-
pipenv install --dev
35-
- name: Lint with flake8
36-
run: |
37-
# stop the build if there are Python syntax errors or undefined names
38-
pipenv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
39-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
40-
pipenv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
32+
run: uv sync --dev
4133
- name: Test with pytest
4234
env:
4335
POSTGRES_HOST: localhost
4436
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
4537
POSTGRES_USER: postgres
4638
POSTGRES_PASSWORD: postgres
4739
run: |
48-
pipenv run tox
40+
uv run tox

Pipfile

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

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ Based on [django-add-default-value](https://github.com/3YOURMIND/django-add-defa
88
[![CI](https://github.com/Mariana-Tek/django-add-default-value-postgresql/workflows/Python%20package/badge.svg)](https://github.com/Mariana-Tek/django-add-default-value-postgresql/actions?query=workflow%3A%22Python+package%22)
99
[![PyPi](https://img.shields.io/pypi/v/django-add-default-value-postgresql.svg?branch=master)](https://pypi.org/project/django-add-default-value-postgresql/)
1010

11-
## Dependencies
11+
## Supported Versions of Python and Django
1212

13-
- Python 3.6, 3.7, 3.8, or 3.9
14-
- Django 2.2, 3.0, 3.1, 3.2, or 4.0
13+
- Python 3.10, 3.11, and 3.12
14+
- Django 4.0, 4.1, 4.2, 5.0, 5.1, and 5.2
1515

1616
## Installation
1717

18-
`pip install django-add-default-value-postgresql`
18+
`uv add django-add-default-value-postgresql`
1919

2020
You can then use `AddDefaultValue` in your migration file to transfer the default
2121
values to your database. Afterwards, it's just the usual `./manage.py migrate`.
@@ -75,5 +75,5 @@ django-add-default-value-postgresql is released under the Apache 2.0 License, ba
7575
- removed MySQL-related code
7676
- removed MSSQL-related code
7777
- added allow_migrate_model check on database_forwards and database_backwards
78-
- added support for Python 3.7, 3.8, and 3.9, dropped support for <3.6
79-
- added support for Django 2.2, 3.0, 3.1, 3.2, and 4.0, dropped support for <2.2
78+
- added support for Python 3.10, 3.11, and 3.12, dropped support for <3.10
79+
- added support for Django 4.0, 4.1, 4.2, 5.0, 5.1, and 5.2, dropped support for <4.0

django_add_default_value/add_default_value.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
1313
# or implied. See the License for the specific language governing
1414
# permissions and limitations under the License.
15+
from datetime import date, datetime
1516

1617
import django
1718
from django.db.migrations.operations.base import Operation
1819
from django.db import models
19-
from datetime import date, datetime
2020

2121
NOW = "__NOW__"
2222
TODAY = "__TODAY__"

pyproject.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[project]
2+
name = "django-add-default-value-postgresql"
3+
version = "1.1.0"
4+
description = "Add default field value in Django migrations for PostgreSQL"
5+
license = "Apache-2.0"
6+
readme = "README.md"
7+
requires-python = ">=3.10"
8+
authors = [
9+
{name = "Jeremy Carbaugh", email = "[email protected]"},
10+
{name = "Xplor Technologies", email = "[email protected]"},
11+
]
12+
keywords = ["django", "migration", "default", "database backward compatibility"]
13+
classifiers = [
14+
"Intended Audience :: Developers",
15+
"Environment :: Web Environment",
16+
"Framework :: Django",
17+
"Framework :: Django :: 4.0",
18+
"Framework :: Django :: 4.1",
19+
"Framework :: Django :: 4.2",
20+
"Framework :: Django :: 5.0",
21+
"Framework :: Django :: 5.1",
22+
"Framework :: Django :: 5.2",
23+
"Programming Language :: Python",
24+
"Programming Language :: Python :: 3",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
28+
"Topic :: Software Development :: Libraries :: Python Modules",
29+
]
30+
dependencies = [
31+
"django>=4.0",
32+
]
33+
34+
[project.urls]
35+
Repository = "https://github.com/Mariana-Tek/django-add-default-value-postgresql"
36+
37+
[dependency-groups]
38+
dev = [
39+
"black>=25.1.0",
40+
"flake8>=7.2.0",
41+
"psycopg2-binary==2.9.*",
42+
"tox>=4.25.0",
43+
"tox-uv>=1.25.0",
44+
]
45+
46+
[tool.setuptools]
47+
packages = ["django_add_default_value"]

setup.cfg

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

setup.py

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

test_project/test_project/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from django.contrib import admin
2-
from django.conf.urls import url
2+
from django.urls import re_path
33

4-
urlpatterns = [url(r"^admin/", admin.site.urls)]
4+
urlpatterns = [re_path(r"^admin/", admin.site.urls)]

tox.ini

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
envlist =
33
format
44
lint
5-
django{22,30,31,32,40}-postgresql
5+
django{40,41,42,50,51,52}-postgresql
66

77
[flake8]
88
exclude =
@@ -24,12 +24,13 @@ setenv =
2424
commands = {envpython} manage.py test --keepdb --noinput tests
2525

2626
deps =
27-
django22: Django>=2.2,<2.2.99
28-
django30: Django>=3.0,<3.0.99
29-
django31: Django>=3.1,<3.1.99
30-
django32: Django>=3.2,<3.2.99
3127
django40: Django>=4.0,<4.0.99
32-
postgresql: psycopg2-binary==2.8.*
28+
django41: Django>=4.1,<4.1.99
29+
django42: Django>=4.2,<4.2.99
30+
django50: Django>=5.0,<5.0.99
31+
django51: Django>=5.1,<5.1.99
32+
django52: Django>=5.2,<5.2.99
33+
postgresql: psycopg2-binary==2.9.*
3334

3435
[testenv:lint]
3536
deps = flake8

0 commit comments

Comments
 (0)