Merge pull request #245436 from mweinelt/django-default

python310Packages.django: migrate to django_4
This commit is contained in:
Martin Weinelt
2023-08-04 01:55:19 +02:00
committed by GitHub
21 changed files with 173 additions and 155 deletions
@@ -158,6 +158,18 @@ The module update takes care of the new config syntax and the data itself (user
## Nixpkgs internals {#sec-release-23.11-nixpkgs-internals}
- The `django` alias in the python package set was upgraded to Django 4.x.
Applications that consume Django should always pin their python environment
to a compatible major version, so they can move at their own pace.
```nix
python = python3.override {
packageOverrides = self: super: {
django = super.django_3;
};
};
```
- The `qemu-vm.nix` module by default now identifies block devices via
persistent names available in `/dev/disk/by-*`. Because the rootDevice is
identfied by its filesystem label, it needs to be formatted before the VM is
@@ -9,6 +9,8 @@ let
python3' = python310.override {
packageOverrides = self: super: {
django = super.django_3;
sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec {
version = "1.3.24";
src = fetchPypi {
@@ -6,18 +6,19 @@
, psycopg2
, beautifulsoup4
, python
, pytz
}:
buildPythonPackage rec {
pname = "django-cachalot";
version = "2.5.3";
version = "2.6.1";
format = "setuptools";
src = fetchFromGitHub {
owner = "noripyt";
repo = "django-cachalot";
rev = "v${version}";
hash = "sha256-ayAN+PgK3aIpt4R8aeC6c6mRGTnfObycmkoXPTjx4WI=";
hash = "sha256-bCiIZkh02+7xL6aSWE9by+4dFDsanr0iXuO9QKpLOjw=";
};
patches = [
@@ -34,6 +35,7 @@ buildPythonPackage rec {
beautifulsoup4
django-debug-toolbar
psycopg2
pytz
];
pythonImportsCheck = [ "cachalot" ];
@@ -1,42 +0,0 @@
{ lib, buildPythonPackage, fetchFromGitHub, python,
django, six
}:
buildPythonPackage rec {
pname = "django-compat";
version = "1.0.15";
# the pypi packages don't include everything required for the tests
src = fetchFromGitHub {
owner = "arteria";
repo = "django-compat";
rev = "v${version}";
sha256 = "1pr6v38ahrsvxlgmcx69s4b5q5082f44gzi4h3c32sccdc4pwqxp";
};
patches = [
./fix-tests.diff
];
checkPhase = ''
runHook preCheck
# to convince the tests to run against the installed package, not the source directory, we extract the
# tests directory from it then dispose of the actual source
mv compat/tests .
rm -r compat
substituteInPlace runtests.py --replace compat.tests tests
${python.interpreter} runtests.py
runHook postCheck
'';
propagatedBuildInputs = [ django six ];
meta = with lib; {
description = "Forward and backwards compatibility layer for Django 1.4, 1.7, 1.8, 1.9, 1.10 and 1.11";
homepage = "https://github.com/arteria/django-compat";
license = licenses.mit;
maintainers = with maintainers; [ ris ];
};
}
@@ -1,56 +0,0 @@
diff -ur a/compat/tests/settings.py b/compat/tests/settings.py
--- a/compat/tests/settings.py 2020-03-06 15:32:07.548482597 +0100
+++ b/compat/tests/settings.py 2020-03-06 22:19:25.422934249 +0100
@@ -16,11 +16,12 @@
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
+ 'django.contrib.messages',
'compat',
'compat.tests.test_app',
]
-MIDDLEWARE_CLASSES = (
+MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
@@ -43,6 +44,7 @@
'django.template.context_processors.i18n',
'django.template.context_processors.tz',
'django.template.context_processors.request',
+ 'django.contrib.messages.context_processors.messages',
],
'loaders': [
'django.template.loaders.filesystem.Loader',
diff -ur a/compat/tests/test_compat.py b/compat/tests/test_compat.py
--- a/compat/tests/test_compat.py 2020-03-06 15:32:07.548482597 +0100
+++ b/compat/tests/test_compat.py 2020-03-06 15:37:39.202835075 +0100
@@ -9,7 +9,7 @@
from django.core.serializers.json import DjangoJSONEncoder
from django.test import TestCase, SimpleTestCase
from django.test.client import RequestFactory
-from django.contrib.auth.views import logout
+from django.contrib.auth.views import auth_logout
try:
from django.urls import NoReverseMatch
except ImportError:
@@ -103,7 +103,7 @@
Tests that passing a view name to ``resolve_url`` will result in the
URL path mapping to that view name.
"""
- resolved_url = resolve_url(logout)
+ resolved_url = resolve_url(auth_logout)
self.assertEqual('/accounts/logout/', resolved_url)
'''
diff -ur a/compat/tests/urls.py b/compat/tests/urls.py
--- a/compat/tests/urls.py 2020-03-06 15:32:07.548482597 +0100
+++ b/compat/tests/urls.py 2020-03-06 15:34:25.962377799 +0100
@@ -2,5 +2,5 @@
from django.contrib.auth import views
urlpatterns = [
- url(r'^accounts/logout/$', views.logout, name='logout'),
+ url(r'^accounts/logout/$', views.auth_logout, name='logout'),
]
@@ -4,12 +4,14 @@
, fetchPypi
# build dependencies
, setuptools
, setuptools-scm
# dependencies
, django
# tests
, elasticsearch
, geopy
, nose
, pysolr
@@ -21,7 +23,8 @@
buildPythonPackage rec {
pname = "django-haystack";
version = "3.2.1";
format = "setuptools";
format = "pyproject";
disabled = pythonOlder "3.5";
src = fetchPypi {
@@ -35,13 +38,22 @@ buildPythonPackage rec {
'';
nativeBuildInputs = [
setuptools
setuptools-scm
];
propagatedBuildInputs = [
buildInputs = [
django
];
passthru.optional-dependencies = {
elasticsearch = [
elasticsearch
];
};
doCheck = lib.versionOlder django.version "4";
nativeCheckInputs = [
geopy
nose
@@ -49,7 +61,14 @@ buildPythonPackage rec {
python-dateutil
requests
whoosh
];
]
++ passthru.optional-dependencies.elasticsearch;
checkPhase = ''
runHook preCheck
python test_haystack/run_tests.py
runHook postCheck
'';
meta = with lib; {
description = "Pluggable search for Django";
@@ -11,7 +11,6 @@
# dependencies
, django
, django-compat
# tests
, pytest-django
@@ -54,7 +53,6 @@ buildPythonPackage rec {
propagatedBuildInputs = [
django
django-compat
];
nativeCheckInputs = [
@@ -1,27 +1,50 @@
{ lib, buildPythonPackage, fetchPypi, django-gravatar2, django-compressor
, django-allauth, mailmanclient, django, mock
{ lib
, buildPythonPackage
, fetchPypi
# propagates
, django-gravatar2
, django-allauth
, mailmanclient
, pytz
# tests
, django
, pytest-django
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "django-mailman3";
version = "1.3.9";
format = "setuptools";
src = fetchPypi {
inherit pname version;
hash = "sha256-GpI1W0O9aJpLF/mcS23ktJDZsP69S2zQy7drOiWBnTM=";
};
propagatedBuildInputs = [
django-gravatar2 django-compressor django-allauth mailmanclient
];
nativeCheckInputs = [ django mock ];
checkPhase = ''
cd $NIX_BUILD_TOP/$sourceRoot
PYTHONPATH=.:$PYTHONPATH django-admin.py test --settings=django_mailman3.tests.settings_test
postPatch = ''
substituteInPlace setup.py \
--replace 'django>=3.2,<4.2' 'django>=3.2,<4.3'
'';
pythonImportsCheck = [ "django_mailman3" ];
propagatedBuildInputs = [
django-allauth
django-gravatar2
mailmanclient
pytz
];
nativeCheckInputs = [
django
pytest-django
pytestCheckHook
];
pythonImportsCheck = [
"django_mailman3"
];
meta = with lib; {
description = "Django library for Mailman UIs";
@@ -1,11 +1,18 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, django
, django-taggit
, pytz
, pythonOlder
, python
# dependencies
, django
, pytz
# optionals
, django-taggit
# tests
, pytest-django
, pytestCheckHook
}:
buildPythonPackage rec {
@@ -17,8 +24,8 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "wagtail";
repo = pname;
rev = "v${version}";
repo = "modelcluster";
rev = "refs/tags/v${version}";
hash = "sha256-p6hvOkPWRVJYLHvwyn9nS05wblikRFmlSYZuLiCcuqc=";
};
@@ -31,13 +38,17 @@ buildPythonPackage rec {
django-taggit
];
nativeCheckInputs = passthru.optional-dependencies.taggit;
env.DJANGO_SETTINGS_MODULE = "tests.settings";
checkPhase = ''
runHook preCheck
${python.interpreter} ./runtests.py --noinput
runHook postCheck
'';
nativeCheckInputs = [
pytest-django
pytestCheckHook
] ++ passthru.optional-dependencies.taggit;
# https://github.com/wagtail/django-modelcluster/issues/173
disabledTests = lib.optionals (lib.versionAtLeast django.version "4.2") [
"test_formfield_callback"
];
meta = with lib; {
description = "Django extension to allow working with 'clusters' of models as a single unit, independently of the database";
@@ -51,5 +51,7 @@ buildPythonPackage rec {
changelog = "https://github.com/torchbox/django-pattern-library/blob/v${version}/CHANGELOG.md";
license = licenses.bsd3;
maintainers = with maintainers; [ sephi ];
# https://github.com/torchbox/django-pattern-library/issues/212
broken = lib.versionAtLeast django.version "4.2";
};
}
@@ -2,37 +2,43 @@
, buildPythonPackage
, fetchFromGitHub
# build-system
, poetry-core
# propagates
, django
, python-dateutil
, scim2-filter-parser
, gssapi
, python-ldap
, sssd
# tests
, mock
, pytest-django
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "django-scim2";
version = "0.17.3";
format = "setuptools";
version = "0.19.0";
format = "pyproject";
src = fetchFromGitHub {
owner = "15five";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-5zdGPpjooiFoj+2OoglXhhKsPFB/KOHvrZWZd+1nZqU=";
hash = "sha256-larDh4f9/xVr11/n/WfkJ2Tx45DMQqyK3ZzkWAvzeig=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace "poetry.masonry.api" "poetry.core.masonry.api"
'';
nativeBuildInputs = [
poetry-core
];
propagatedBuildInputs = [
django
python-dateutil
scim2-filter-parser
gssapi
python-ldap
sssd
];
pythonImportsCheck = [
@@ -41,9 +47,12 @@ buildPythonPackage rec {
nativeCheckInputs = [
mock
pytest-django
pytestCheckHook
];
meta = with lib; {
changelog = "https://github.com/15five/django-scim2/blob/${src.rev}/CHANGES.txt";
description = "A SCIM 2.0 Service Provider Implementation (for Django)";
homepage = "https://github.com/15five/django-scim2";
license = licenses.mit;
@@ -37,5 +37,7 @@ buildPythonPackage rec {
description = "Alternative implementation of django sites framework";
homepage = "https://github.com/niwinz/django-sites";
license = lib.licenses.bsd3;
# has not been updated for django>=4.0
broken = lib.versionAtLeast django.version "4";
};
}
@@ -1,6 +1,7 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, django
, django-guardian
, djangorestframework
}:
@@ -37,5 +38,7 @@ buildPythonPackage rec {
homepage = "https://github.com/rpkilby/django-rest-framework-guardian";
license = licenses.bsd3;
maintainers = with maintainers; [ ];
# unmaintained, last compatible version is 3.x, use djangorestframework-guardian2 instead
broken = lib.versionAtLeast django.version "4";
};
}
@@ -1,33 +1,55 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, fetchpatch
, django
, djangorestframework
, pytest
, pytest-cov
, pytestCheckHook
, pytest-django
, ipdb
, python
}:
buildPythonPackage rec {
pname = "drf-nested-routers";
version = "0.93.4";
format = "setuptools";
src = fetchFromGitHub {
owner = "alanjds";
repo = "drf-nested-routers";
rev = "v${version}";
rev = "refs/tags/v${version}";
hash = "sha256-qlXNDydoQJ9FZB6G7yV/pNmx3BEo+lvRqsfjrvlbdNY=";
};
propagatedBuildInputs = [ django djangorestframework setuptools ];
nativeCheckInputs = [ pytest pytest-cov pytest-django ipdb ];
patches = [
# django4 compatibility
(fetchpatch {
url = "https://github.com/alanjds/drf-nested-routers/commit/59764cc356f7f593422b26845a9dfac0ad196120.patch";
hash = "sha256-mq3vLHzQlGl2EReJ5mVVQMMcYgGIVt/T+qi1STtQ0aI=";
})
(fetchpatch {
url = "https://github.com/alanjds/drf-nested-routers/commit/723a5729dd2ffcb66fe315f229789ca454986fa4.patch";
hash = "sha256-UCbBjwlidqsJ9vEEWlGzfqqMOr0xuB2TAaUxHsLzFfU=";
})
(fetchpatch {
url = "https://github.com/alanjds/drf-nested-routers/commit/38e49eb73759bc7dcaaa9166169590f5315e1278.patch";
hash = "sha256-IW4BLhHHhXDUZqHaXg46qWoQ89pMXv0ZxKjOCTnDcI0=";
})
];
checkPhase = ''
${python.interpreter} runtests.py --nolint
'';
buildInputs = [
django
];
propagatedBuildInputs = [
djangorestframework
];
nativeCheckInputs = [
ipdb
pytestCheckHook
pytest-django
];
meta = with lib; {
homepage = "https://github.com/alanjds/drf-nested-routers";
@@ -14,6 +14,7 @@
, pillow
, pyflakes
, pythonOlder
, pytz
, requests
, requests-oauthlib
, tzlocal
@@ -47,6 +48,7 @@ buildPythonPackage rec {
future
grappelli_safe
pillow
pytz
requests
requests-oauthlib
tzlocal
@@ -1,6 +1,7 @@
{ lib
, blinker
, buildPythonPackage
, django
, fetchFromGitHub
, flake8
, flask-sqlalchemy
@@ -79,5 +80,6 @@ buildPythonPackage rec {
homepage = "https://github.com/jmcarp/nplusone";
maintainers = with maintainers; [ cript0nauta ];
license = licenses.mit;
broken = lib.versionAtLeast django.version "4";
};
}
@@ -124,6 +124,11 @@ buildPythonPackage rec {
"--durations=20"
];
disabledTests = [
# timing sensitive
"test_access_channels_by_slice"
];
disabledTestPaths = [
# depends on qcodes-loop, causing a cyclic dependency
"qcodes/tests/dataset/measurement/test_load_legacy_data.py"
+2
View File
@@ -29,6 +29,8 @@ let
doCheck = false;
};
django = super.django_3;
};
};
in
+2
View File
@@ -2,6 +2,8 @@
python3.override {
packageOverrides = self: super: {
django = super.django_3;
# does not find tests
alembic = super.alembic.overridePythonAttrs (oldAttrs: {
doCheck = false;
+1
View File
@@ -93,6 +93,7 @@ mapAliases ({
django_classytags = django-classy-tags; # added 2023-07-25
django_colorful = django-colorful; # added 2023-07-25
django_compat = django-compat; # added 2023-07-25
django-compat = throw "django-compat has been removed. It provided forward/backport compat for django 1.x, which is long end of life."; # added 2023-07-26
django_contrib_comments = django-contrib-comments; # added 2023-07-25
django-discover-runner = throw "django-discover-runner was removed because it is no longer maintained."; # added 2022-11-21
django_environ = django-environ; # added 2021-12-25
+3 -6
View File
@@ -2729,12 +2729,11 @@ self: super: with self; {
distutils_extra = callPackage ../development/python-modules/distutils_extra { };
django = self.django_3;
# Current LTS
# LTS in extended support phase
django_3 = callPackage ../development/python-modules/django/3.nix { };
# Current latest
# LTS with mainsteam support
django = self.django_4;
django_4 = callPackage ../development/python-modules/django/4.nix { };
django-admin-datta = callPackage ../development/python-modules/django-admin-datta { };
@@ -2777,8 +2776,6 @@ self: super: with self; {
django-colorful = callPackage ../development/python-modules/django-colorful { };
django-compat = callPackage ../development/python-modules/django-compat { };
django-compressor = callPackage ../development/python-modules/django-compressor { };
django-compression-middleware = callPackage ../development/python-modules/django-compression-middleware { };