Skip to content

Upgrade Django and switch to uv #7

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

Merged
merged 9 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
image: postgres:14.9
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -19,30 +19,22 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
- name: Install uv and Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
version: "0.6.12"
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv
pipenv install --dev
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
pipenv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
pipenv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
run: uv sync --dev
- name: Test with pytest
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
run: |
pipenv run tox
uv run tox
13 changes: 0 additions & 13 deletions Pipfile

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Based on [django-add-default-value](https://github.com/3YOURMIND/django-add-defa
[![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)
[![PyPi](https://img.shields.io/pypi/v/django-add-default-value-postgresql.svg?branch=master)](https://pypi.org/project/django-add-default-value-postgresql/)

## Dependencies
## Supported Versions of Python and Django

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

## Installation

`pip install django-add-default-value-postgresql`
`uv add django-add-default-value-postgresql`

You can then use `AddDefaultValue` in your migration file to transfer the default
values to your database. Afterwards, it's just the usual `./manage.py migrate`.
Expand Down Expand Up @@ -75,5 +75,5 @@ django-add-default-value-postgresql is released under the Apache 2.0 License, ba
- removed MySQL-related code
- removed MSSQL-related code
- added allow_migrate_model check on database_forwards and database_backwards
- added support for Python 3.7, 3.8, and 3.9, dropped support for <3.6
- added support for Django 2.2, 3.0, 3.1, 3.2, and 4.0, dropped support for <2.2
- added support for Python 3.10, 3.11, and 3.12, dropped support for <3.10
- added support for Django 4.0, 4.1, 4.2, 5.0, 5.1, and 5.2, dropped support for <4.0
2 changes: 1 addition & 1 deletion django_add_default_value/add_default_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing
# permissions and limitations under the License.
from datetime import date, datetime

import django
from django.db.migrations.operations.base import Operation
from django.db import models
from datetime import date, datetime

NOW = "__NOW__"
TODAY = "__TODAY__"
Expand Down
47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[project]
name = "django-add-default-value-postgresql"
version = "1.1.0"
description = "Add default field value in Django migrations for PostgreSQL"
license = "Apache-2.0"
readme = "README.md"
requires-python = ">=3.10"
authors = [
{name = "Jeremy Carbaugh", email = "[email protected]"},
{name = "Xplor Technologies", email = "[email protected]"},
]
keywords = ["django", "migration", "default", "database backward compatibility"]
classifiers = [
"Intended Audience :: Developers",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Framework :: Django :: 5.2",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"django>=4.0",
]

[project.urls]
Repository = "https://github.com/Mariana-Tek/django-add-default-value-postgresql"

[dependency-groups]
dev = [
"black>=25.1.0",
"flake8>=7.2.0",
"psycopg2-binary==2.9.*",
"tox>=4.25.0",
"tox-uv>=1.25.0",
]

[tool.setuptools]
packages = ["django_add_default_value"]
34 changes: 0 additions & 34 deletions setup.cfg

This file was deleted.

23 changes: 0 additions & 23 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions test_project/test_project/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.contrib import admin
from django.conf.urls import url
from django.urls import re_path

urlpatterns = [url(r"^admin/", admin.site.urls)]
urlpatterns = [re_path(r"^admin/", admin.site.urls)]
13 changes: 7 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
envlist =
format
lint
django{22,30,31,32,40}-postgresql
django{40,41,42,50,51,52}-postgresql

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

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

[testenv:lint]
deps = flake8
Expand Down
Loading