From 4d3ce6f0478ca2402e92d54b88de8c724857ccdc Mon Sep 17 00:00:00 2001 From: natsukium Date: Tue, 31 Oct 2023 18:36:34 +0900 Subject: [PATCH 01/30] python311Packages.pydantic: 1.10.12 -> 2.3.0 Diff: https://github.com/pydantic/pydantic/compare/refs/tags/v1.10.12...v2.3.0 Changelog: https://github.com/pydantic/pydantic/blob/v2.3.0/HISTORY.md Drops the documentation build, because it is an ever growing, ever changing set of dependencies, that we need to package up, hidnering the upgrade effort. --- .../python-modules/pydantic/default.nix | 110 +++++------------- 1 file changed, 30 insertions(+), 80 deletions(-) diff --git a/pkgs/development/python-modules/pydantic/default.nix b/pkgs/development/python-modules/pydantic/default.nix index 84de5894f5018..1370f5865d879 100644 --- a/pkgs/development/python-modules/pydantic/default.nix +++ b/pkgs/development/python-modules/pydantic/default.nix @@ -1,127 +1,77 @@ { lib -, stdenv , buildPythonPackage -, autoflake -, cython -, devtools -, email-validator , fetchFromGitHub -, pytest-mock -, pytestCheckHook -, python-dotenv -, pythonAtLeast , pythonOlder -, pyupgrade -, typing-extensions -# dependencies for building documentation. -# docs fail to build in Darwin sandbox: https://github.com/samuelcolvin/pydantic/issues/4245 -, withDocs ? (stdenv.hostPlatform == stdenv.buildPlatform && !stdenv.isDarwin && pythonAtLeast "3.10") -, ansi2html -, markdown-include -, mike -, mkdocs -, mkdocs-exclude -, mkdocs-material -, mdx-truly-sane-lists -, sqlalchemy -, ujson -, orjson -, hypothesis +, hatchling +, hatch-fancy-pypi-readme , libxcrypt +, annotated-types +, pydantic-core +, typing-extensions +, email-validator +, dirty-equals +, faker +, pytestCheckHook +, pytest-mock }: buildPythonPackage rec { pname = "pydantic"; - version = "1.10.12"; - format = "setuptools"; - - outputs = [ - "out" - ] ++ lib.optionals withDocs [ - "doc" - ]; + version = "2.3.0"; + pyproject = true; disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "pydantic"; - repo = pname; + repo = "pydantic"; rev = "refs/tags/v${version}"; - hash = "sha256-3XnbPGU90wLCPEryFAOky6Iy73Dvgzzh+GbOKW8hZ4U="; + hash = "sha256-toqrWg8bYzc3UmvG/YmXawfmT8nqaA9fxy24k1cdj+M="; }; - postPatch = '' - sed -i '/flake8/ d' Makefile - - # Disable strict docs build due warnings being treated as errors - substituteInPlace mkdocs.yml \ - --replace "strict: true" "strict: false" - ''; - buildInputs = lib.optionals (pythonOlder "3.9") [ libxcrypt ]; nativeBuildInputs = [ - cython - ] ++ lib.optionals withDocs [ - # dependencies for building documentation - autoflake - ansi2html - markdown-include - mdx-truly-sane-lists - mike - mkdocs - mkdocs-exclude - mkdocs-material - sqlalchemy - ujson - orjson - hypothesis + hatch-fancy-pypi-readme + hatchling ]; propagatedBuildInputs = [ - devtools - pyupgrade + annotated-types + pydantic-core typing-extensions ]; passthru.optional-dependencies = { - dotenv = [ - python-dotenv - ]; email = [ email-validator ]; }; nativeCheckInputs = [ + dirty-equals + faker pytest-mock pytestCheckHook ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); - pytestFlagsArray = [ - # https://github.com/pydantic/pydantic/issues/4817 - "-W" "ignore::pytest.PytestReturnNotNoneWarning" - ]; - preCheck = '' export HOME=$(mktemp -d) + substituteInPlace pyproject.toml \ + --replace "'--benchmark-columns', 'min,mean,stddev,outliers,rounds,iterations'," "" \ + --replace "'--benchmark-group-by', 'group'," "" \ + --replace "'--benchmark-warmup', 'on'," "" \ + --replace "'--benchmark-disable'," "" ''; - # Must include current directory into PYTHONPATH, since documentation - # building process expects "import pydantic" to work. - preBuild = lib.optionalString withDocs '' - PYTHONPATH=$PWD:$PYTHONPATH make docs - ''; + disabledTestPaths = [ + "tests/benchmarks" - # Layout documentation in same way as "sphinxHook" does. - postInstall = lib.optionalString withDocs '' - mkdir -p $out/share/doc/$name - mv ./site $out/share/doc/$name/html - ''; - - enableParallelBuilding = true; + # avoid cyclic dependency + "tests/test_docs.py" + ]; pythonImportsCheck = [ "pydantic" ]; From 62a25b07103690e5cd44a22d6162d7a42c3478fe Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 Nov 2023 10:48:22 +0900 Subject: [PATCH 02/30] python311Packages.pydantic-settings: 2.0.3 -> 2.1.0 Diff: https://github.com/pydantic/pydantic-settings/compare/v2.0.3...v2.1.0 --- .../python-modules/pydantic-settings/default.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/pydantic-settings/default.nix b/pkgs/development/python-modules/pydantic-settings/default.nix index c27bb5f275766..3034b2f927119 100644 --- a/pkgs/development/python-modules/pydantic-settings/default.nix +++ b/pkgs/development/python-modules/pydantic-settings/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonPackage , fetchFromGitHub +, pythonOlder , hatchling , pydantic , python-dotenv @@ -11,14 +12,16 @@ buildPythonPackage rec { pname = "pydantic-settings"; - version = "2.0.3"; - format = "pyproject"; + version = "2.1.0"; + pyproject = true; + + disabled = pythonOlder "3.8"; src = fetchFromGitHub { owner = "pydantic"; repo = "pydantic-settings"; rev = "v${version}"; - hash = "sha256-3V6daCibvVr8RKo2o+vHC++QgIYKAOyRg11ATrCzM5Y="; + hash = "sha256-hU7u/AzaqCHKSUDHybsgXTW8IWi9hzBttPYDmMqdZbI="; }; nativeBuildInputs = [ @@ -38,6 +41,11 @@ buildPythonPackage rec { pytest-mock ]; + disabledTests = [ + # expected to fail + "test_docs_examples[docs/index.md:212-246]" + ]; + preCheck = '' export HOME=$TMPDIR ''; From e9abc0e4d4b6af4567224e09822b040b32ec3404 Mon Sep 17 00:00:00 2001 From: natsukium Date: Tue, 28 Nov 2023 09:29:49 +0900 Subject: [PATCH 03/30] python311Packages.pydantic_1: init at 1.10.3 --- .../development/python-modules/pydantic/1.nix | 76 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 78 insertions(+) create mode 100644 pkgs/development/python-modules/pydantic/1.nix diff --git a/pkgs/development/python-modules/pydantic/1.nix b/pkgs/development/python-modules/pydantic/1.nix new file mode 100644 index 0000000000000..e1fc840f0ee14 --- /dev/null +++ b/pkgs/development/python-modules/pydantic/1.nix @@ -0,0 +1,76 @@ +{ lib +, buildPythonPackage +, cython +, email-validator +, fetchFromGitHub +, pytest-mock +, pytestCheckHook +, python-dotenv +, pythonOlder +, setuptools +, typing-extensions +, libxcrypt +}: + +buildPythonPackage rec { + pname = "pydantic"; + version = "1.10.13"; + pyproject = true; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "pydantic"; + repo = "pydantic"; + rev = "refs/tags/v${version}"; + hash = "sha256-ruDVcCLPVuwIkHOjYVuKOoP3hHHr7ItIY55Y6hUgR74="; + }; + + nativeBuildInputs = [ + setuptools + cython + ]; + + buildInputs = lib.optionals (pythonOlder "3.9") [ + libxcrypt + ]; + + propagatedBuildInputs = [ + typing-extensions + ]; + + passthru.optional-dependencies = { + dotenv = [ + python-dotenv + ]; + email = [ + email-validator + ]; + }; + + nativeCheckInputs = [ + pytest-mock + pytestCheckHook + ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); + + pytestFlagsArray = [ + # https://github.com/pydantic/pydantic/issues/4817 + "-W" "ignore::pytest.PytestReturnNotNoneWarning" + ]; + + preCheck = '' + export HOME=$(mktemp -d) + ''; + + enableParallelBuilding = true; + + pythonImportsCheck = [ "pydantic" ]; + + meta = with lib; { + description = "Data validation and settings management using Python type hinting"; + homepage = "https://github.com/pydantic/pydantic"; + changelog = "https://github.com/pydantic/pydantic/blob/v${version}/HISTORY.md"; + license = licenses.mit; + maintainers = with maintainers; [ wd15 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a56f9a52518ec..9a7977a438deb 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10038,6 +10038,8 @@ self: super: with self; { pydantic = callPackage ../development/python-modules/pydantic { }; + pydantic_1 = callPackage ../development/python-modules/pydantic/1.nix { }; + pydantic-core = callPackage ../development/python-modules/pydantic-core { }; pydantic-extra-types = callPackage ../development/python-modules/pydantic-extra-types { }; From 3b44eb0b9a259f0233f9910874189cfb37317f8f Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 1 Nov 2023 12:17:30 +0900 Subject: [PATCH 04/30] python311Packages.versioningit: 2.2.0 -> 2.2.1 Changelog: https://versioningit.readthedocs.io/en/latest/changelog.html --- pkgs/development/python-modules/versioningit/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/versioningit/default.nix b/pkgs/development/python-modules/versioningit/default.nix index 74a29ae175e9c..5b6eba49aecad 100644 --- a/pkgs/development/python-modules/versioningit/default.nix +++ b/pkgs/development/python-modules/versioningit/default.nix @@ -16,14 +16,14 @@ buildPythonPackage rec { pname = "versioningit"; - version = "2.2.0"; + version = "2.2.1"; format = "pyproject"; disabled = pythonOlder "3.8"; src = fetchPypi { inherit pname version; - hash = "sha256-6xjnunJoqIC/HM/pLlNOlqs04Dl/KNy8s/wNpPaltr0="; + hash = "sha256-DlgkLXq9phrmNZalSUrp7WMayF2Ls8yOF24yU8pLy7U="; }; postPatch = '' From 1dc069527f34589fd973b47c62b162a08320889d Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 Nov 2023 13:42:36 +0900 Subject: [PATCH 05/30] python311Packages.fastapi: add optional-dependencies for pydantic 2 --- pkgs/development/python-modules/fastapi/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/fastapi/default.nix b/pkgs/development/python-modules/fastapi/default.nix index 3397c3bd28828..5aab1ed269c61 100644 --- a/pkgs/development/python-modules/fastapi/default.nix +++ b/pkgs/development/python-modules/fastapi/default.nix @@ -32,6 +32,8 @@ , orjson , email-validator , uvicorn +, pydantic-settings +, pydantic-extra-types }: buildPythonPackage rec { @@ -75,8 +77,9 @@ buildPythonPackage rec { orjson email-validator uvicorn - # pydantic-settings - # pydantic-extra-types + ] ++ lib.optionals (lib.versionAtLeast pydantic.version "2") [ + pydantic-settings + pydantic-extra-types ] ++ uvicorn.optional-dependencies.standard; nativeCheckInputs = [ From cb2e554db49988bb242dbfe75ceee5c112a6b50c Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 Nov 2023 17:54:26 +0900 Subject: [PATCH 06/30] python311Packages.kanidm: 0.0.3 -> 0.0.3-unstable-2023-08-23 --- .../python-modules/kanidm/default.nix | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/kanidm/default.nix b/pkgs/development/python-modules/kanidm/default.nix index eb60f61d5f3c9..fc53fc81ed709 100644 --- a/pkgs/development/python-modules/kanidm/default.nix +++ b/pkgs/development/python-modules/kanidm/default.nix @@ -1,7 +1,6 @@ { lib , buildPythonPackage -, fetchPypi -, fetchpatch +, fetchFromGitHub , pythonOlder # build @@ -9,6 +8,7 @@ # propagates , aiohttp +, authlib , pydantic , toml @@ -20,25 +20,30 @@ let pname = "kanidm"; - version = "0.0.3"; + version = "0.0.3-unstable-2023-08-23"; in buildPythonPackage { inherit pname version; - format = "pyproject"; + pyproject = true; - disabled = pythonOlder "3.8"; + disabled = pythonOlder "3.9"; - src = fetchPypi { - inherit pname version; - hash = "sha256-sTkAKxtJa7CVYKuXC//eMmf3l8ABsrEr2mdf1r2Gf9A="; + src = fetchFromGitHub { + owner = "kanidm"; + repo = "kanidm"; + rev = "def4420c4c5c3ec4f9b02776e1d5fdb07aa3a729"; + hash = "sha256-5qQb+Itguw2v1Wdvc2vp00zglfvNd3LFEDvaweRJcOc="; }; + sourceRoot = "source/pykanidm"; + nativeBuildInputs = [ poetry-core ]; propagatedBuildInputs = [ aiohttp + authlib pydantic toml ]; From 3fcadd4b888b752be93e308f3fd0ea09796890e7 Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 Nov 2023 17:57:51 +0900 Subject: [PATCH 07/30] python311Packages.django-ninja: 0.22.2 -> 1.0.1 Diff: https://github.com/vitalik/django-ninja/compare/v0.22.2...v1.0.1 Changelog: https://github.com/vitalik/django-ninja/releases/tag/v1.0.1 --- pkgs/development/python-modules/django-ninja/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/django-ninja/default.nix b/pkgs/development/python-modules/django-ninja/default.nix index 620960797ea04..2aa349e71bc71 100644 --- a/pkgs/development/python-modules/django-ninja/default.nix +++ b/pkgs/development/python-modules/django-ninja/default.nix @@ -13,15 +13,16 @@ buildPythonPackage rec { pname = "django-ninja"; - version = "0.22.2"; - format = "pyproject"; + version = "1.0.1"; + pyproject = true; + disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "vitalik"; repo = "django-ninja"; rev = "v${version}"; - hash = "sha256-oeisurp9seSn3X/5jFF9DMm9nU6uDYIU1b6/J3o2be0="; + hash = "sha256-hF6Z8i8M4mQtVPIupTSEIkJh0i/oMFFuE9PpODxq4fw="; }; propagatedBuildInputs = [ django pydantic ]; @@ -38,7 +39,7 @@ buildPythonPackage rec { meta = with lib; { changelog = "https://github.com/vitalik/django-ninja/releases/tag/v${version}"; description = "Web framework for building APIs with Django and Python type hints"; - homepage = "https://django-ninja.rest-framework.com/"; + homepage = "https://django-ninja.dev"; license = licenses.mit; maintainers = with maintainers; [ elohmeier ]; }; From 4a22107281a3e5b27d499708b4dd7bba6ad424bb Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 Nov 2023 20:00:36 +0900 Subject: [PATCH 08/30] python311Packages.pythonfinder: 2.0.5 -> 2.0.6 Diff: https://github.com/sarugaku/pythonfinder/compare/refs/tags/2.0.5...2.0.6 Changelog: https://github.com/sarugaku/pythonfinder/blob/v2.0.6/CHANGELOG.rst --- .../python-modules/pythonfinder/default.nix | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/pythonfinder/default.nix b/pkgs/development/python-modules/pythonfinder/default.nix index 25e0484041a70..c9e0ca669c9ad 100644 --- a/pkgs/development/python-modules/pythonfinder/default.nix +++ b/pkgs/development/python-modules/pythonfinder/default.nix @@ -3,6 +3,7 @@ , cached-property , click , fetchFromGitHub +, fetchpatch , packaging , pydantic , pytest-timeout @@ -13,8 +14,8 @@ buildPythonPackage rec { pname = "pythonfinder"; - version = "2.0.5"; - format = "pyproject"; + version = "2.0.6"; + pyproject = true; disabled = pythonOlder "3.7"; @@ -22,11 +23,20 @@ buildPythonPackage rec { owner = "sarugaku"; repo = pname; rev = "refs/tags/${version}"; - hash = "sha256-L/+6w5lLqHO5c9CThoUPOHXRPVxBlOWFDAmfoYxRw5g="; + hash = "sha256-C/Em8Vmv7q030hmH3jU/apBRSSC9QFK9mbBWjBjJHXg="; }; + patches = [ + # https://github.com/sarugaku/pythonfinder/issues/142 + (fetchpatch { + name = "pydantic_2-compatibility.patch"; + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/python-pythonfinder/-/raw/2.0.6-1/python-pythonfinder-2.0.6-pydantic2.patch"; + hash = "sha256-mON1MeA+pj6VTB3zpBjF3LfB30wG0QH9nU4bD1djWwg="; + }) + ]; + postPatch = '' - substituteInPlace setup.cfg \ + substituteInPlace pyproject.toml \ --replace " --cov" "" ''; @@ -35,9 +45,10 @@ buildPythonPackage rec { ]; propagatedBuildInputs = [ - cached-property packaging pydantic + ] ++ lib.optionals (pythonOlder "3.8") [ + cached-property ]; passthru.optional-dependencies = { From 59a1734163a39290b1512ea471957c47a6254304 Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 Nov 2023 21:23:07 +0900 Subject: [PATCH 09/30] python311Packages.pyaussiebb: 0.0.18 -> 0.1.1 Diff: https://github.com/yaleman/aussiebb/compare/refs/tags/v0.0.18...v0.1.1 Changelog: https://github.com/yaleman/pyaussiebb/blob/v0.1.1/CHANGELOG.md --- pkgs/development/python-modules/pyaussiebb/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/pyaussiebb/default.nix b/pkgs/development/python-modules/pyaussiebb/default.nix index 1fcb88c0c77ed..4443dfee6252c 100644 --- a/pkgs/development/python-modules/pyaussiebb/default.nix +++ b/pkgs/development/python-modules/pyaussiebb/default.nix @@ -11,8 +11,8 @@ buildPythonPackage rec { pname = "pyaussiebb"; - version = "0.0.18"; - format = "pyproject"; + version = "0.1.1"; + pyproject = true; disabled = pythonOlder "3.9"; @@ -20,7 +20,7 @@ buildPythonPackage rec { owner = "yaleman"; repo = "aussiebb"; rev = "refs/tags/v${version}"; - hash = "sha256-tEdddVsLFCHRvyLCctDakioiop2xWaJlfGE16P1ukHc="; + hash = "sha256-XNf9vYMlTLqhYIVNw9GjPcXpOm5EYCcC4aGukR8g3zc="; }; nativeBuildInputs = [ From 32de0e585827d29af4e8325ce0357dd9ff6dc9ac Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 25 Nov 2023 00:57:55 +0900 Subject: [PATCH 10/30] python311Packages.demetriek: apply a pydantic>=2 compatible patch --- pkgs/development/python-modules/demetriek/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/python-modules/demetriek/default.nix b/pkgs/development/python-modules/demetriek/default.nix index b553a1b0837a8..4d0f33a138730 100644 --- a/pkgs/development/python-modules/demetriek/default.nix +++ b/pkgs/development/python-modules/demetriek/default.nix @@ -5,6 +5,7 @@ , buildPythonPackage , pydantic , fetchFromGitHub +, fetchpatch , poetry-core , yarl , aresponses @@ -27,6 +28,16 @@ buildPythonPackage rec { hash = "sha256-LCHHBcZgO9gw5jyaJiiS4lKyb0ut+PJvKTylIvIKHhc="; }; + patches = [ + # https://github.com/frenck/python-demetriek/pull/531 + (fetchpatch { + name = "pydantic_2-compatibility.patch"; + url = "https://github.com/frenck/python-demetriek/commit/e677fe5b735b6b28572e3e5fd6aab56fc056f5e6.patch"; + excludes = [ "pyproject.toml" "poetry.lock" ]; + hash = "sha256-oMVR45KHDhcPId/0X9obJXCPE8s1gk5IgsGsgZesdZw="; + }) + ]; + postPatch = '' # Upstream doesn't set a version for the pyproject.toml substituteInPlace pyproject.toml \ From ee583823621c98538cd7eeeae40956651c715ead Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 25 Nov 2023 01:03:39 +0900 Subject: [PATCH 11/30] python311Packages.demetriek: fix darwin sandbox build --- pkgs/development/python-modules/demetriek/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/python-modules/demetriek/default.nix b/pkgs/development/python-modules/demetriek/default.nix index 4d0f33a138730..42205ac652f9a 100644 --- a/pkgs/development/python-modules/demetriek/default.nix +++ b/pkgs/development/python-modules/demetriek/default.nix @@ -67,6 +67,8 @@ buildPythonPackage rec { "demetriek" ]; + __darwinAllowLocalNetworking = true; + meta = with lib; { description = "Python client for LaMetric TIME devices"; homepage = "https://github.com/frenck/python-demetriek"; From 415b748ccee19a047a69a443260f3a5d7e781ee2 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 25 Nov 2023 08:52:14 +0900 Subject: [PATCH 12/30] python311Packages.fastapi-mail: 1.3.1 -> 1.4.1 Diff: https://github.com/sabuhish/fastapi-mail/compare/refs/tags/1.3.1...1.4.1 Changelog: https://github.com/sabuhish/fastapi-mail/releases/tag/1.4.1 --- .../python-modules/fastapi-mail/default.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/fastapi-mail/default.nix b/pkgs/development/python-modules/fastapi-mail/default.nix index 52d3c44357244..258425e35f852 100644 --- a/pkgs/development/python-modules/fastapi-mail/default.nix +++ b/pkgs/development/python-modules/fastapi-mail/default.nix @@ -11,6 +11,7 @@ , jinja2 , poetry-core , pydantic +, pydantic-settings , pytest-asyncio , pytestCheckHook , python-multipart @@ -19,23 +20,23 @@ buildPythonPackage rec { pname = "fastapi-mail"; - version = "1.3.1"; - format = "pyproject"; + version = "1.4.1"; + pyproject = true; disabled = pythonOlder "3.8"; src = fetchFromGitHub { owner = "sabuhish"; - repo = pname; + repo = "fastapi-mail"; rev = "refs/tags/${version}"; - hash = "sha256-m8d4y75+mSh9A+YVaV/yZhN3ckOe2mV1jdtfeNFtU/w="; + hash = "sha256-2iTZqZIxlt1GKhElasTcnys18UbNNDwHoZziHBOIGBo="; }; postPatch = '' substituteInPlace pyproject.toml \ --replace 'version = "1.2.5"' 'version = "${version}"' \ --replace 'aiosmtplib = "^2.0"' 'aiosmtplib = "*"' \ - --replace 'pydantic = "^1.8"' 'pydantic = "*"' \ + --replace 'pydantic = "^2.0"' 'pydantic = "*"' \ ''; nativeBuildInputs = [ @@ -52,6 +53,7 @@ buildPythonPackage rec { httpx jinja2 pydantic + pydantic-settings python-multipart ]; From 6969dcda28e075cd0591cf58670e162fe640f109 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 25 Nov 2023 09:42:27 +0900 Subject: [PATCH 13/30] python311Pacakges.napari-npe2: 0.7.2 -> 0.7.2-unstable-2023-10-20 Diff: https://github.com/napari/npe2/compare/v0.7.2...9d29e4d6dbbec75c2d36273647efd9ddfb59ded0 --- pkgs/development/python-modules/napari-npe2/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/napari-npe2/default.nix b/pkgs/development/python-modules/napari-npe2/default.nix index 53fffeaadcbad..64659858258bf 100644 --- a/pkgs/development/python-modules/napari-npe2/default.nix +++ b/pkgs/development/python-modules/napari-npe2/default.nix @@ -17,7 +17,7 @@ buildPythonPackage rec { pname = "napari-npe2"; - version = "0.7.2"; + version = "0.7.2-unstable-2023-10-20"; pyproject = true; disabled = pythonOlder "3.8"; @@ -25,11 +25,12 @@ buildPythonPackage rec { src = fetchFromGitHub { owner = "napari"; repo = "npe2"; - rev = "refs/tags/v${version}"; - hash = "sha256-PjoLocNTkcAnBNRbPi+MZqZtQ2bjWPIUVz0+k8nIn2A="; + rev = "9d29e4d6dbbec75c2d36273647efd9ddfb59ded0"; + hash = "sha256-JLu/5pXijPdpKY2z2rREtSKPiP33Yy4viegbxUiQg7Y="; }; - env.SETUPTOOLS_SCM_PRETEND_VERSION = version; + # fix this in the next release + env.SETUPTOOLS_SCM_PRETEND_VERSION = "0.7.2"; nativeBuildInputs = [ hatchling From 0ee01ada6bee184004a5d1b85239d0043ff14498 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 25 Nov 2023 10:44:54 +0900 Subject: [PATCH 14/30] python311Packages.rstcheck-core: 1.0.3 -> 1.2.0 Diff: https://github.com/rstcheck/rstcheck-core/compare/refs/tags/v1.0.3...v1.2.0 Changelog: https://github.com/rstcheck/rstcheck-core/blob/v1.2.0/CHANGELOG.md --- .../python-modules/rstcheck-core/default.nix | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/pkgs/development/python-modules/rstcheck-core/default.nix b/pkgs/development/python-modules/rstcheck-core/default.nix index 0a250a83fa5b8..345c08c9681a2 100644 --- a/pkgs/development/python-modules/rstcheck-core/default.nix +++ b/pkgs/development/python-modules/rstcheck-core/default.nix @@ -5,38 +5,46 @@ , fetchFromGitHub , importlib-metadata , mock -, poetry-core , pydantic , pytest-mock , pytestCheckHook , pythonOlder -, types-docutils +, setuptools +, setuptools-scm , typing-extensions +, wheel }: buildPythonPackage rec { pname = "rstcheck-core"; - version = "1.0.3"; - format = "pyproject"; + version = "1.2.0"; + pyproject = true; - disabled = pythonOlder "3.7"; + disabled = pythonOlder "3.8"; src = fetchFromGitHub { owner = "rstcheck"; - repo = pname; + repo = "rstcheck-core"; rev = "refs/tags/v${version}"; - hash = "sha256-9U+GhkwBr+f3yEe7McOxqPRUuTp9vP+3WT5wZ92n32w="; + hash = "sha256-cKJNktIB4vXt1MPRgYrJQ0aksmrVu7Y2uTyUjdx5YdA="; }; nativeBuildInputs = [ - poetry-core + setuptools + setuptools-scm + wheel ]; + env = { + SETUPTOOLS_SCM_PRETEND_VERSION = version; + NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-strict-prototypes"; + }; + propagatedBuildInputs = [ docutils - importlib-metadata pydantic - types-docutils + ] ++ lib.optionals (pythonOlder "3.9") [ + importlib-metadata typing-extensions ]; @@ -46,10 +54,9 @@ buildPythonPackage rec { pytestCheckHook ]; - disabledTests = lib.optionals stdenv.isDarwin [ - # Disabled until https://github.com/rstcheck/rstcheck-core/issues/19 is resolved. - "test_error_without_config_file_macos" - "test_file_1_is_bad_without_config_macos" + disabledTests = [ + # https://github.com/rstcheck/rstcheck-core/issues/84 + "test_check_yaml_returns_error_on_bad_code_block" ]; pythonImportsCheck = [ From ce12f6bc52e950de1819e3d5e55989070ac45e24 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 25 Nov 2023 17:46:27 +0900 Subject: [PATCH 15/30] python311Packages.strawberry-graphql: fix test with pydantic>=2 --- .../python-modules/strawberry-graphql/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/python-modules/strawberry-graphql/default.nix b/pkgs/development/python-modules/strawberry-graphql/default.nix index 8954713338025..70bc33fc16239 100644 --- a/pkgs/development/python-modules/strawberry-graphql/default.nix +++ b/pkgs/development/python-modules/strawberry-graphql/default.nix @@ -61,6 +61,12 @@ buildPythonPackage rec { url = "https://github.com/strawberry-graphql/strawberry/commit/710bb96f47c244e78fc54c921802bcdb48f5f421.patch"; hash = "sha256-ekUZ2hDPCqwXp9n0YjBikwSkhCmVKUzQk7LrPECcD7Y="; }) + (fetchpatch { + # https://github.com/strawberry-graphql/strawberry/pull/3255 + name = "fix-tests-with-pydantic_2.patch"; + url = "https://github.com/strawberry-graphql/strawberry/commit/0a0dc284ee6d31d4e82ac7ff1ed9fea4dff39fa6.patch"; + hash = "sha256-LACWD7XA6YL/apJwhpx3LPCKxKUfa+XWyTLK+Zkxlaw="; + }) ]; postPatch = '' From 4ae5ff6c8a35c7ad291892cdd37aa4bc83fc32a4 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 25 Nov 2023 17:48:28 +0900 Subject: [PATCH 16/30] python311Packages.strawberry-graphql: fix darwin sandbox build --- pkgs/development/python-modules/strawberry-graphql/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/python-modules/strawberry-graphql/default.nix b/pkgs/development/python-modules/strawberry-graphql/default.nix index 70bc33fc16239..194d942669ad6 100644 --- a/pkgs/development/python-modules/strawberry-graphql/default.nix +++ b/pkgs/development/python-modules/strawberry-graphql/default.nix @@ -182,6 +182,8 @@ buildPythonPackage rec { "tests/websockets/test_graphql_transport_ws.py" ]; + __darwinAllowLocalNetworking = true; + meta = with lib; { description = "A GraphQL library for Python that leverages type annotations"; homepage = "https://strawberry.rocks"; From 395e37fbf314444f239a9382442f1e205ef92135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Mon, 27 Nov 2023 09:23:40 -0800 Subject: [PATCH 17/30] python311Packages.xbox-webapi: 2.0.11 -> 2.1.0 Diff: https://github.com/OpenXbox/xbox-webapi-python/compare/v2.0.11...v2.1.0 Changelog: https://github.com/OpenXbox/xbox-webapi-python/blob/v2.1.0/CHANGELOG.md --- .../python-modules/xbox-webapi/default.nix | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/pkgs/development/python-modules/xbox-webapi/default.nix b/pkgs/development/python-modules/xbox-webapi/default.nix index e4701e806d9dd..d8fb2d5b8c35b 100644 --- a/pkgs/development/python-modules/xbox-webapi/default.nix +++ b/pkgs/development/python-modules/xbox-webapi/default.nix @@ -2,53 +2,52 @@ , buildPythonPackage , pythonOlder , fetchFromGitHub -, aiohttp +, setuptools , appdirs , ecdsa +, httpx , ms-cv , pydantic -, aresponses , pytest-asyncio , pytestCheckHook +, respx }: buildPythonPackage rec { pname = "xbox-webapi"; - version = "2.0.11"; + version = "2.1.0"; - disabled = pythonOlder "3.6"; + disabled = pythonOlder "3.8"; + + pyproject = true; src = fetchFromGitHub { owner = "OpenXbox"; repo = "xbox-webapi-python"; rev = "v${version}"; - sha256 = "0li0bq914xizx9fj49s1iwfrv4bpzvl74bwsi5a34r9yizw02cvz"; + hash = "sha256-9A3gdSlRjBCx5fBW+jkaSWsFuGieXQKvbEbZzGzLf94="; }; - postPatch = '' - substituteInPlace setup.py \ - --replace "pytest-runner" "" - ''; + nativeBuildInputs = [ + setuptools + ]; propagatedBuildInputs = [ - aiohttp appdirs ecdsa + httpx ms-cv pydantic ]; nativeCheckInputs = [ - aresponses pytest-asyncio pytestCheckHook - ]; - - pytestFlagsArray = [ - "--asyncio-mode=auto" + respx ]; meta = with lib; { + changelog = "https://github.com/OpenXbox/xbox-webapi-python/blob/${src.rev}/CHANGELOG.md"; description = "Library to authenticate with Windows Live/Xbox Live and use their API"; homepage = "https://github.com/OpenXbox/xbox-webapi-python"; license = licenses.mit; From cf3b67614389761d4573e82936c067f9a47b6b8b Mon Sep 17 00:00:00 2001 From: natsukium Date: Tue, 28 Nov 2023 09:33:11 +0900 Subject: [PATCH 18/30] cloudflare-dyndns: pin pydantic_1 --- pkgs/applications/networking/cloudflare-dyndns/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/networking/cloudflare-dyndns/default.nix b/pkgs/applications/networking/cloudflare-dyndns/default.nix index 2be03621a016f..087b3c66f00dd 100644 --- a/pkgs/applications/networking/cloudflare-dyndns/default.nix +++ b/pkgs/applications/networking/cloudflare-dyndns/default.nix @@ -24,7 +24,7 @@ python3.pkgs.buildPythonApplication rec { attrs click cloudflare - pydantic + pydantic_1 requests ]; From 44dfa420084e1704d474dba268a8eee14e87f25f Mon Sep 17 00:00:00 2001 From: natsukium Date: Tue, 28 Nov 2023 09:36:43 +0900 Subject: [PATCH 19/30] flare-floss: pin pydantic_1 --- pkgs/tools/security/flare-floss/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/security/flare-floss/default.nix b/pkgs/tools/security/flare-floss/default.nix index b049ea1661083..49de8f68ed97e 100644 --- a/pkgs/tools/security/flare-floss/default.nix +++ b/pkgs/tools/security/flare-floss/default.nix @@ -28,7 +28,7 @@ python3.pkgs.buildPythonPackage rec { halo networkx pefile - pydantic + pydantic_1 rich tabulate tqdm From 152eb420a11de2aa0c5ed943c9a52b90d36e651c Mon Sep 17 00:00:00 2001 From: natsukium Date: Tue, 28 Nov 2023 09:45:31 +0900 Subject: [PATCH 20/30] khoj: 0.3.0 -> 1.0.1 Diff: https://github.com/debanjum/khoj/compare/refs/tags/0.3.0...1.0.1 Changelog: https://github.com/debanjum/khoj/releases/tag/1.0.1 --- pkgs/servers/search/khoj/default.nix | 129 ++++++++++++++++----------- 1 file changed, 79 insertions(+), 50 deletions(-) diff --git a/pkgs/servers/search/khoj/default.nix b/pkgs/servers/search/khoj/default.nix index 058fe91ab7653..8bd07e9a1c6c1 100644 --- a/pkgs/servers/search/khoj/default.nix +++ b/pkgs/servers/search/khoj/default.nix @@ -2,74 +2,84 @@ , stdenv , fetchFromGitHub , python3 -, qt6 +, postgresql +, postgresqlTestHook }: python3.pkgs.buildPythonApplication rec { pname = "khoj"; - version = "0.3.0"; - format = "pyproject"; + version = "1.0.1"; + pyproject = true; src = fetchFromGitHub { owner = "debanjum"; repo = "khoj"; rev = "refs/tags/${version}"; - hash = "sha256-9kKK0DXpLfPB2LMnYcC6BKgZaoRsNHBZVe4thI7b9tk="; + hash = "sha256-lvOeYTrvW5MfhuJ3lj9n9TRlvpRwVP2vFeaEeJdqIec="; }; - SETUPTOOLS_SCM_PRETEND_VERSION = version; - - postPatch = '' - substituteInPlace pyproject.toml \ - --replace "dateparser == 1.1.1" "dateparser" \ - --replace "defusedxml == 0.7.1" ""defusedxml"" \ - --replace "fastapi == 0.77.1" "fastapi" \ - --replace "jinja2 == 3.1.2" "jinja2" \ - --replace "openai == 0.20.0" "openai" \ - --replace "pillow == 9.3.0" "pillow" \ - --replace "pydantic == 1.9.1" "pydantic" \ - --replace "pyyaml == 6.0" "pyyaml" \ - --replace "pyqt6 == 6.3.1" "pyqt6" \ - --replace "rich >= 13.3.1" "rich" \ - --replace "schedule == 1.1.0" "schedule" \ - --replace "sentence-transformers == 2.2.2" "sentence-transformers" \ - --replace "torch == 1.13.1" "torch" \ - --replace "uvicorn == 0.17.6" "uvicorn" - ''; + env = { + SETUPTOOLS_SCM_PRETEND_VERSION = version; + DJANGO_SETTINGS_MODULE = "khoj.app.settings"; + postgresqlEnableTCP = 1; + }; nativeBuildInputs = with python3.pkgs; [ hatch-vcs hatchling - ] ++ (with qt6; [ - wrapQtAppsHook - ]); - - buildInputs = lib.optionals stdenv.isLinux [ - qt6.qtwayland - ] ++ lib.optionals stdenv.isDarwin [ - qt6.qtbase ]; propagatedBuildInputs = with python3.pkgs; [ + aiohttp + anyio + authlib + beautifulsoup4 dateparser defusedxml + django fastapi + google-auth + # gpt4all + gunicorn + httpx + itsdangerous jinja2 - numpy + langchain + lxml openai + openai-whisper + pgvector pillow + psycopg2 pydantic - pyqt6 + pymupdf + python-multipart pyyaml + # rapidocr-onnxruntime + requests rich schedule sentence-transformers + stripe + tenacity + tiktoken torch + transformers + tzdata uvicorn ]; nativeCheckInputs = with python3.pkgs; [ + freezegun + factory-boy + pytest-xdist + trio + psutil + pytest-django pytestCheckHook + ] ++ [ + (postgresql.withPackages (p: with p; [ pgvector ])) + postgresqlTestHook ]; preCheck = '' @@ -82,32 +92,51 @@ python3.pkgs.buildPythonApplication rec { disabledTests = [ # Tests require network access - "test_search_with_valid_content_type" - "test_update_with_valid_content_type" - "test_regenerate_with_valid_content_type" - "test_image_search" - "test_notes_search" - "test_notes_search_with_only_filters" - "test_notes_search_with_include_filter" - "test_notes_search_with_exclude_filter" + "test_different_user_data_not_accessed" + "test_get_api_config_types" + "test_get_configured_types_via_api" "test_image_metadata" "test_image_search" - "test_image_search_query_truncated" "test_image_search_by_filepath" - "test_asymmetric_setup_with_missing_file_raises_error" - "test_asymmetric_setup_with_empty_file_raises_error" - "test_asymmetric_reload" - "test_asymmetric_setup" - "test_asymmetric_search" - "test_entry_chunking_by_max_tokens" - "test_incremental_update" + "test_image_search_query_truncated" + "test_index_update" + "test_index_update_with_no_auth_key" + "test_notes_search" + "test_notes_search_with_exclude_filter" + "test_notes_search_with_include_filter" + "test_parse_html_plaintext_file" + "test_regenerate_index_with_new_entry" + "test_regenerate_with_github_fails_without_pat" + "test_regenerate_with_invalid_content_type" + "test_regenerate_with_valid_content_type" + "test_search_for_user2_returns_empty" + "test_search_with_invalid_auth_key" + "test_search_with_invalid_content_type" + "test_search_with_no_auth_key" + "test_search_with_valid_content_type" + "test_text_index_same_if_content_unchanged" + "test_text_indexer_deletes_embedding_before_regenerate" + "test_text_search" + "test_text_search_setup_batch_processes" + "test_update_with_invalid_content_type" + "test_user_no_data_returns_empty" + + # Tests require rapidocr-onnxruntime + "test_multi_page_pdf_to_jsonl" + "test_single_page_pdf_to_jsonl" + "test_ocr_page_pdf_to_jsonl" + ]; + + disabledTestPaths = [ + # Tests require network access + "tests/test_conversation_utils.py" ]; meta = with lib; { description = "Natural Language Search Assistant for your Org-Mode and Markdown notes, Beancount transactions and Photos"; homepage = "https://github.com/debanjum/khoj"; changelog = "https://github.com/debanjum/khoj/releases/tag/${version}"; - license = licenses.gpl3Only; + license = licenses.agpl3Plus; maintainers = with maintainers; [ dit7ya ]; # src/tcmalloc.cc:333] Attempt to free invalid pointer broken = stdenv.isDarwin; From e94028890fa0c209d7c0af9dca029bff113f8dad Mon Sep 17 00:00:00 2001 From: natsukium Date: Tue, 28 Nov 2023 20:55:42 +0900 Subject: [PATCH 21/30] octoprint: pin pydantic_1 --- pkgs/applications/misc/octoprint/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/misc/octoprint/default.nix b/pkgs/applications/misc/octoprint/default.nix index e7daa60198d11..5b42f1d08c3cf 100644 --- a/pkgs/applications/misc/octoprint/default.nix +++ b/pkgs/applications/misc/octoprint/default.nix @@ -163,7 +163,7 @@ let zeroconf zipstream-ng class-doc - pydantic + pydantic_1 ] ++ lib.optionals stdenv.isDarwin [ py.pkgs.appdirs ] ++ lib.optionals (!stdenv.isDarwin) [ From f2417e3573e799f664a2ad461770570d9eebd195 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 25 Nov 2023 19:11:42 +0900 Subject: [PATCH 22/30] remote-exec: pin pydantic_1 --- pkgs/tools/misc/remote-exec/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/misc/remote-exec/default.nix b/pkgs/tools/misc/remote-exec/default.nix index afedab81cbd6e..557bde26c4650 100644 --- a/pkgs/tools/misc/remote-exec/default.nix +++ b/pkgs/tools/misc/remote-exec/default.nix @@ -3,7 +3,7 @@ , fetchFromGitHub , buildPythonApplication , click -, pydantic +, pydantic_1 , toml , watchdog , pytestCheckHook @@ -29,7 +29,7 @@ buildPythonApplication rec { propagatedBuildInputs = [ click - pydantic + pydantic_1 toml watchdog ]; From 01fc3051548b4ca610c589f61356a3025117a963 Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 24 Nov 2023 21:12:08 +0900 Subject: [PATCH 23/30] stacs: pin pydantic_1 --- pkgs/tools/security/stacs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/security/stacs/default.nix b/pkgs/tools/security/stacs/default.nix index 672cd082849cf..205d85f0622e9 100644 --- a/pkgs/tools/security/stacs/default.nix +++ b/pkgs/tools/security/stacs/default.nix @@ -20,7 +20,7 @@ python3.pkgs.buildPythonApplication rec { propagatedBuildInputs = with python3.pkgs; [ click - pydantic + pydantic_1 typing-extensions yara-python ]; From d305cd4265cc3e2b061b76eb5ae1366502552456 Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 29 Nov 2023 14:19:33 +0900 Subject: [PATCH 24/30] python311Packages.aiopurpleair: apply patch for pydantic>=2 --- .../python-modules/aiopurpleair/default.nix | 3 + .../pydantic_2-compatibility.patch | 111 ++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 pkgs/development/python-modules/aiopurpleair/pydantic_2-compatibility.patch diff --git a/pkgs/development/python-modules/aiopurpleair/default.nix b/pkgs/development/python-modules/aiopurpleair/default.nix index bdbc83fd2ab3e..cc958823735d7 100644 --- a/pkgs/development/python-modules/aiopurpleair/default.nix +++ b/pkgs/development/python-modules/aiopurpleair/default.nix @@ -38,6 +38,9 @@ buildPythonPackage rec { url = "https://github.com/bachya/aiopurpleair/commit/8c704c51ea50da266f52a7f53198d29d643b30c5.patch"; hash = "sha256-RLRbHmaR2A8MNc96WHx0L8ccyygoBUaOulAuRJkFuUM="; }) + + # based on https://github.com/bachya/aiopurpleair/pull/176 + ./pydantic_2-compatibility.patch ]; postPatch = '' diff --git a/pkgs/development/python-modules/aiopurpleair/pydantic_2-compatibility.patch b/pkgs/development/python-modules/aiopurpleair/pydantic_2-compatibility.patch new file mode 100644 index 0000000000000..090014778fa62 --- /dev/null +++ b/pkgs/development/python-modules/aiopurpleair/pydantic_2-compatibility.patch @@ -0,0 +1,111 @@ +diff --git a/aiopurpleair/api.py b/aiopurpleair/api.py +index d3b276b..c557015 100644 +--- a/aiopurpleair/api.py ++++ b/aiopurpleair/api.py +@@ -5,7 +5,10 @@ from typing import Any, cast + + from aiohttp import ClientSession, ClientTimeout + from aiohttp.client_exceptions import ClientError +-from pydantic import BaseModel, ValidationError ++try: ++ from pydantic.v1 import BaseModel, ValidationError ++except ModuleNotFoundError: ++ from pydantic import BaseModel, ValidationError + + from aiopurpleair.const import LOGGER + from aiopurpleair.endpoints.sensors import SensorsEndpoints +diff --git a/aiopurpleair/endpoints/__init__.py b/aiopurpleair/endpoints/__init__.py +index 4d263e1..6632310 100644 +--- a/aiopurpleair/endpoints/__init__.py ++++ b/aiopurpleair/endpoints/__init__.py +@@ -4,7 +4,10 @@ from __future__ import annotations + from collections.abc import Awaitable, Callable, Iterable + from typing import Any + +-from pydantic import BaseModel, ValidationError ++try: ++ from pydantic.v1 import BaseModel, ValidationError ++except ModuleNotFoundError: ++ from pydantic import BaseModel, ValidationError + + from aiopurpleair.errors import InvalidRequestError + from aiopurpleair.helpers.typing import ModelT +diff --git a/aiopurpleair/helpers/typing.py b/aiopurpleair/helpers/typing.py +index 4ae01e6..49f59e6 100644 +--- a/aiopurpleair/helpers/typing.py ++++ b/aiopurpleair/helpers/typing.py +@@ -1,6 +1,9 @@ + """Define typing helpers.""" + from typing import TypeVar + +-from pydantic import BaseModel ++try: ++ from pydantic.v1 import BaseModel ++except ModuleNotFoundError: ++ from pydantic import BaseModel + + ModelT = TypeVar("ModelT", bound=BaseModel) +diff --git a/aiopurpleair/models/keys.py b/aiopurpleair/models/keys.py +index 591ae01..ffadbcc 100644 +--- a/aiopurpleair/models/keys.py ++++ b/aiopurpleair/models/keys.py +@@ -3,7 +3,10 @@ from __future__ import annotations + + from datetime import datetime + +-from pydantic import BaseModel, validator ++try: ++ from pydantic.v1 import BaseModel, validator ++except ModuleNotFoundError: ++ from pydantic import BaseModel, validator + + from aiopurpleair.backports.enum import StrEnum + from aiopurpleair.helpers.validators import validate_timestamp +diff --git a/aiopurpleair/models/sensors.py b/aiopurpleair/models/sensors.py +index 5b99b51..d435996 100644 +--- a/aiopurpleair/models/sensors.py ++++ b/aiopurpleair/models/sensors.py +@@ -5,7 +5,10 @@ from __future__ import annotations + from datetime import datetime + from typing import Any, Optional + +-from pydantic import BaseModel, root_validator, validator ++try: ++ from pydantic.v1 import BaseModel, root_validator, validator ++except ModuleNotFoundError: ++ from pydantic import BaseModel, root_validator, validator + + from aiopurpleair.const import SENSOR_FIELDS, ChannelFlag, ChannelState, LocationType + from aiopurpleair.helpers.validators import validate_timestamp +diff --git a/tests/models/test_keys.py b/tests/models/test_keys.py +index 0d7d7c8..b2e30c1 100644 +--- a/tests/models/test_keys.py ++++ b/tests/models/test_keys.py +@@ -5,7 +5,10 @@ from datetime import datetime + from typing import Any + + import pytest +-from pydantic import ValidationError ++try: ++ from pydantic.v1 import ValidationError ++except ModuleNotFoundError: ++ from pydantic import ValidationError + + from aiopurpleair.models.keys import ApiKeyType, GetKeysResponse + +diff --git a/tests/models/test_sensors.py b/tests/models/test_sensors.py +index a984b36..7b2c84f 100644 +--- a/tests/models/test_sensors.py ++++ b/tests/models/test_sensors.py +@@ -5,7 +5,10 @@ from datetime import datetime + from typing import Any + + import pytest +-from pydantic import ValidationError ++try: ++ from pydantic.v1 import ValidationError ++except ModuleNotFoundError: ++ from pydantic import ValidationError + + from aiopurpleair.models.sensors import ( + GetSensorsRequest, From cc85f241d107b38428db36409cc14b075aa4e622 Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 29 Nov 2023 14:23:20 +0900 Subject: [PATCH 25/30] python311Packages.aionotion: apply patch for pydantic>=2 --- .../python-modules/aionotion/default.nix | 3 + .../aionotion/pydantic_2-compatibility.patch | 111 ++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 pkgs/development/python-modules/aionotion/pydantic_2-compatibility.patch diff --git a/pkgs/development/python-modules/aionotion/default.nix b/pkgs/development/python-modules/aionotion/default.nix index c99a317d2ca1b..3368880c7140f 100644 --- a/pkgs/development/python-modules/aionotion/default.nix +++ b/pkgs/development/python-modules/aionotion/default.nix @@ -39,6 +39,9 @@ buildPythonPackage rec { url = "https://github.com/bachya/aionotion/commit/53c7285110d12810f9b43284295f71d052a81b83.patch"; hash = "sha256-RLRbHmaR2A8MNc96WHx0L8ccyygoBUaOulAuRJkFuUM="; }) + + # based on https://github.com/bachya/aionotion/pull/235 + ./pydantic_2-compatibility.patch ]; nativeBuildInputs = [ diff --git a/pkgs/development/python-modules/aionotion/pydantic_2-compatibility.patch b/pkgs/development/python-modules/aionotion/pydantic_2-compatibility.patch new file mode 100644 index 0000000000000..44c34b664f641 --- /dev/null +++ b/pkgs/development/python-modules/aionotion/pydantic_2-compatibility.patch @@ -0,0 +1,111 @@ +diff --git a/aionotion/bridge/models.py b/aionotion/bridge/models.py +index 260566d..f2e640c 100644 +--- a/aionotion/bridge/models.py ++++ b/aionotion/bridge/models.py +@@ -5,7 +5,10 @@ from __future__ import annotations + from datetime import datetime + from typing import Optional, Union + +-from pydantic import BaseModel, validator ++try: ++ from pydantic.v1 import BaseModel, validator ++except ModuleNotFoundError: ++ from pydantic import BaseModel, validator + + from aionotion.helpers.validators import validate_timestamp + +diff --git a/aionotion/client.py b/aionotion/client.py +index 5332334..e2f9035 100644 +--- a/aionotion/client.py ++++ b/aionotion/client.py +@@ -5,7 +5,10 @@ from typing import Any, cast + + from aiohttp import ClientSession, ClientTimeout + from aiohttp.client_exceptions import ClientError +-from pydantic import BaseModel, ValidationError ++try: ++ from pydantic.v1 import BaseModel, ValidationError ++except ModuleNotFoundError: ++ from pydantic import BaseModel, ValidationError + + from aionotion.bridge import Bridge + from aionotion.const import LOGGER +diff --git a/aionotion/device/models.py b/aionotion/device/models.py +index c19bc3e..ea7f577 100644 +--- a/aionotion/device/models.py ++++ b/aionotion/device/models.py +@@ -4,7 +4,10 @@ from __future__ import annotations + + from datetime import datetime + +-from pydantic import BaseModel, validator ++try: ++ from pydantic.v1 import BaseModel, validator ++except ModuleNotFoundError: ++ from pydantic import BaseModel, validator + + from aionotion.helpers.validators import validate_timestamp + +diff --git a/aionotion/helpers/typing.py b/aionotion/helpers/typing.py +index 130c5ab..b2c3726 100644 +--- a/aionotion/helpers/typing.py ++++ b/aionotion/helpers/typing.py +@@ -1,6 +1,9 @@ + """Define typing helpers.""" + from typing import TypeVar + +-from pydantic import BaseModel ++try: ++ from pydantic.v1 import BaseModel ++except ModuleNotFoundError: ++ from pydantic import BaseModel + + BaseModelT = TypeVar("BaseModelT", bound=BaseModel) +diff --git a/aionotion/sensor/models.py b/aionotion/sensor/models.py +index 3bcfb12..643a282 100644 +--- a/aionotion/sensor/models.py ++++ b/aionotion/sensor/models.py +@@ -6,7 +6,10 @@ from datetime import datetime + from enum import Enum + from typing import Any, Literal, Optional + +-from pydantic import BaseModel, Extra, validator ++try: ++ from pydantic.v1 import BaseModel, Extra, validator ++except ModuleNotFoundError: ++ from pydantic import BaseModel, Extra, validator + + from aionotion.const import LOGGER + from aionotion.helpers.validators import validate_timestamp +diff --git a/aionotion/system/models.py b/aionotion/system/models.py +index d5b27d3..7931959 100644 +--- a/aionotion/system/models.py ++++ b/aionotion/system/models.py +@@ -5,7 +5,10 @@ from __future__ import annotations + from datetime import datetime + from typing import Optional + +-from pydantic import BaseModel, validator ++try: ++ from pydantic.v1 import BaseModel, validator ++except ModuleNotFoundError: ++ from pydantic import BaseModel, validator + + from aionotion.helpers.validators import validate_timestamp + +diff --git a/aionotion/user/models.py b/aionotion/user/models.py +index 856fbc3..723041e 100644 +--- a/aionotion/user/models.py ++++ b/aionotion/user/models.py +@@ -2,7 +2,10 @@ + # pylint: disable=too-few-public-methods + from __future__ import annotations + +-from pydantic import BaseModel ++try: ++ from pydantic.v1 import BaseModel ++except ModuleNotFoundError: ++ from pydantic import BaseModel + + + class UserPreferences(BaseModel): From 1f5eb9350fea51dce451c3d8b47a8cee98228e1d Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 25 Nov 2023 08:50:10 +0900 Subject: [PATCH 26/30] python311Packages.aionotion: add meta.changelog --- pkgs/development/python-modules/aionotion/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/python-modules/aionotion/default.nix b/pkgs/development/python-modules/aionotion/default.nix index 3368880c7140f..794b4d8098eed 100644 --- a/pkgs/development/python-modules/aionotion/default.nix +++ b/pkgs/development/python-modules/aionotion/default.nix @@ -74,6 +74,7 @@ buildPythonPackage rec { meta = with lib; { description = "Python library for Notion Home Monitoring"; homepage = "https://github.com/bachya/aionotion"; + changelog = "https://github.com/bachya/aionotion/releases/tag/${src.rev}"; license = with licenses; [ mit ]; maintainers = with maintainers; [ fab ]; }; From 1a4f5254608a41fd69db47f82fece5f385469244 Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 29 Nov 2023 15:07:49 +0900 Subject: [PATCH 27/30] frigate: pin pydantic_1 --- pkgs/applications/video/frigate/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/applications/video/frigate/default.nix b/pkgs/applications/video/frigate/default.nix index 5414193640f0e..81798df47f27a 100644 --- a/pkgs/applications/video/frigate/default.nix +++ b/pkgs/applications/video/frigate/default.nix @@ -25,6 +25,12 @@ let python = python3.override { packageOverrides = self: super: { + pydantic = super.pydantic_1; + + versioningit = super.versioningit.overridePythonAttrs { + # checkPhase requires pydantic>=2 + doCheck = false; + }; }; }; From a2ae17c55a2239b27d2f8ee5c29d2ac4a5339b78 Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 29 Nov 2023 15:04:44 +0900 Subject: [PATCH 28/30] home-assistant: pin pydantic_1 --- pkgs/servers/home-assistant/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index ee4171df924fb..1fdf52489a658 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -258,6 +258,8 @@ let }; }); + pydantic = super.pydantic_1; + pydexcom = super.pydexcom.overridePythonAttrs (oldAttrs: rec { version = "0.2.3"; src = fetchFromGitHub { From 8b4922fc4207527f57214f0904c1cc30ff54542d Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Fri, 1 Dec 2023 03:39:11 +0100 Subject: [PATCH 29/30] home-assistant: pin versioningit at 2.2.0 The last version to support pydantic 1.x. --- pkgs/servers/home-assistant/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index 1fdf52489a658..d4ed78f32ddac 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -318,6 +318,15 @@ let }; }); + versioningit = super.versioningit.overridePythonAttrs (oldAttrs: rec { + version = "2.2.0"; + src = fetchPypi { + inherit (oldAttrs) pname; + inherit version; + hash = "sha256-6xjnunJoqIC/HM/pLlNOlqs04Dl/KNy8s/wNpPaltr0="; + }; + }); + # Pinned due to API changes ~1.0 vultr = super.vultr.overridePythonAttrs (oldAttrs: rec { version = "0.1.2"; From 5395d9c3f86443421bf703cc473385fb039eb220 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 2 Dec 2023 14:05:10 +0900 Subject: [PATCH 30/30] treewide: marke as broken due to incompatibility with pydantic>=2 --- pkgs/development/python-modules/bentoml/default.nix | 2 ++ pkgs/development/python-modules/correctionlib/default.nix | 1 + .../python-modules/dbt-semantic-interfaces/default.nix | 2 ++ pkgs/development/python-modules/dependency-injector/default.nix | 2 ++ pkgs/development/python-modules/farm-haystack/default.nix | 2 ++ pkgs/development/python-modules/flask-security-too/default.nix | 2 ++ .../development/python-modules/ha-mqtt-discoverable/default.nix | 1 + pkgs/development/python-modules/huum/default.nix | 1 + pkgs/development/python-modules/labelbox/default.nix | 2 ++ pkgs/development/python-modules/maison/default.nix | 1 + pkgs/development/python-modules/pycfmodel/default.nix | 1 + pkgs/development/python-modules/pyngo/default.nix | 2 ++ pkgs/development/python-modules/pytradfri/default.nix | 2 ++ pkgs/development/python-modules/shazamio/default.nix | 1 + pkgs/development/python-modules/steamship/default.nix | 2 ++ pkgs/development/python-modules/withings-api/default.nix | 1 + 16 files changed, 25 insertions(+) diff --git a/pkgs/development/python-modules/bentoml/default.nix b/pkgs/development/python-modules/bentoml/default.nix index e65af66ba4497..04c6fe1444528 100644 --- a/pkgs/development/python-modules/bentoml/default.nix +++ b/pkgs/development/python-modules/bentoml/default.nix @@ -204,5 +204,7 @@ buildPythonPackage { changelog = "https://github.com/bentoml/BentoML/releases/tag/v${version}"; license = licenses.asl20; maintainers = with maintainers; [ happysalada natsukium ]; + # https://github.com/bentoml/BentoML/issues/3885 + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/correctionlib/default.nix b/pkgs/development/python-modules/correctionlib/default.nix index 7a79c38554782..f881202f13e54 100644 --- a/pkgs/development/python-modules/correctionlib/default.nix +++ b/pkgs/development/python-modules/correctionlib/default.nix @@ -64,5 +64,6 @@ buildPythonPackage rec { homepage = "https://cms-nanoaod.github.io/correctionlib/"; license = with licenses; [ bsd3 ]; maintainers = with maintainers; [ veprbl ]; + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/dbt-semantic-interfaces/default.nix b/pkgs/development/python-modules/dbt-semantic-interfaces/default.nix index 694b2c7f73729..78485a49b669b 100644 --- a/pkgs/development/python-modules/dbt-semantic-interfaces/default.nix +++ b/pkgs/development/python-modules/dbt-semantic-interfaces/default.nix @@ -58,5 +58,7 @@ buildPythonPackage rec { homepage = "https://github.com/dbt-labs/dbt-semantic-interfaces"; license = licenses.asl20; maintainers = with maintainers; [ pbsds ]; + # https://github.com/dbt-labs/dbt-semantic-interfaces/issues/134 + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/dependency-injector/default.nix b/pkgs/development/python-modules/dependency-injector/default.nix index ff00a9fd200ab..0b575412e8541 100644 --- a/pkgs/development/python-modules/dependency-injector/default.nix +++ b/pkgs/development/python-modules/dependency-injector/default.nix @@ -78,5 +78,7 @@ buildPythonPackage rec { changelog = "https://github.com/ets-labs/python-dependency-injector/blob/${version}/docs/main/changelog.rst"; license = licenses.bsd3; maintainers = with maintainers; [ gerschtli ]; + # https://github.com/ets-labs/python-dependency-injector/issues/726 + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/farm-haystack/default.nix b/pkgs/development/python-modules/farm-haystack/default.nix index afee9c60f8945..ba793db122655 100644 --- a/pkgs/development/python-modules/farm-haystack/default.nix +++ b/pkgs/development/python-modules/farm-haystack/default.nix @@ -286,5 +286,7 @@ buildPythonPackage rec { homepage = "https://github.com/deepset-ai/haystack"; license = licenses.asl20; maintainers = with maintainers; [ happysalada ]; + # https://github.com/deepset-ai/haystack/issues/5304 + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/flask-security-too/default.nix b/pkgs/development/python-modules/flask-security-too/default.nix index 81abf369a8a41..d4aecda14e1b4 100644 --- a/pkgs/development/python-modules/flask-security-too/default.nix +++ b/pkgs/development/python-modules/flask-security-too/default.nix @@ -127,5 +127,7 @@ buildPythonPackage rec { description = "Simple security for Flask apps (fork)"; license = licenses.mit; maintainers = with maintainers; [ gador ]; + # https://github.com/Flask-Middleware/flask-security/pull/851 + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/ha-mqtt-discoverable/default.nix b/pkgs/development/python-modules/ha-mqtt-discoverable/default.nix index 202678344145f..55ce0e3583076 100644 --- a/pkgs/development/python-modules/ha-mqtt-discoverable/default.nix +++ b/pkgs/development/python-modules/ha-mqtt-discoverable/default.nix @@ -49,5 +49,6 @@ buildPythonPackage rec { changelog = "https://github.com/unixorn/ha-mqtt-discoverable/releases/tag/v${version}"; license = licenses.asl20; maintainers = with maintainers; [ fab ]; + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/huum/default.nix b/pkgs/development/python-modules/huum/default.nix index 68cba094ab31a..1b2da27594289 100644 --- a/pkgs/development/python-modules/huum/default.nix +++ b/pkgs/development/python-modules/huum/default.nix @@ -47,5 +47,6 @@ buildPythonPackage rec { changelog = "https://github.com/frwickst/pyhuum/releases/tag/${version}"; license = with licenses; [ mit ]; maintainers = with maintainers; [ fab ]; + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/labelbox/default.nix b/pkgs/development/python-modules/labelbox/default.nix index cf71b36b3c2ba..eda5472940b3a 100644 --- a/pkgs/development/python-modules/labelbox/default.nix +++ b/pkgs/development/python-modules/labelbox/default.nix @@ -99,5 +99,7 @@ buildPythonPackage rec { changelog = "https://github.com/Labelbox/labelbox-python/blob/v.${version}/CHANGELOG.md"; license = licenses.asl20; maintainers = with maintainers; [ rakesh4g ]; + # https://github.com/Labelbox/labelbox-python/issues/1246 + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/maison/default.nix b/pkgs/development/python-modules/maison/default.nix index 03d4c5c05d879..0e716240afbde 100644 --- a/pkgs/development/python-modules/maison/default.nix +++ b/pkgs/development/python-modules/maison/default.nix @@ -47,5 +47,6 @@ buildPythonPackage rec { changelog = "https://github.com/dbatten5/maison/releases/tag/v${version}"; license = licenses.mit; maintainers = with maintainers; [ fab ]; + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/pycfmodel/default.nix b/pkgs/development/python-modules/pycfmodel/default.nix index f6173a18966dc..0ee92706afc9c 100644 --- a/pkgs/development/python-modules/pycfmodel/default.nix +++ b/pkgs/development/python-modules/pycfmodel/default.nix @@ -48,5 +48,6 @@ buildPythonPackage rec { homepage = "https://github.com/Skyscanner/pycfmodel"; license = licenses.asl20; maintainers = with maintainers; [ fab ]; + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/pyngo/default.nix b/pkgs/development/python-modules/pyngo/default.nix index 91d39a4ab0a22..172b853d96bca 100644 --- a/pkgs/development/python-modules/pyngo/default.nix +++ b/pkgs/development/python-modules/pyngo/default.nix @@ -52,5 +52,7 @@ buildPythonPackage rec { homepage = "https://github.com/yezz123/pyngo"; license = licenses.mit; maintainers = with maintainers; [ hexa ]; + # https://github.com/yezz123/pyngo/issues/70 + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/pytradfri/default.nix b/pkgs/development/python-modules/pytradfri/default.nix index 83ab0a9879f34..b4de887f54559 100644 --- a/pkgs/development/python-modules/pytradfri/default.nix +++ b/pkgs/development/python-modules/pytradfri/default.nix @@ -48,5 +48,7 @@ buildPythonPackage rec { changelog = "https://github.com/home-assistant-libs/pytradfri/releases/tag/${version}"; license = licenses.mit; maintainers = with maintainers; [ dotlambda ]; + # https://github.com/home-assistant-libs/pytradfri/issues/720 + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/shazamio/default.nix b/pkgs/development/python-modules/shazamio/default.nix index ee1616f7b775d..05c9784b367f1 100644 --- a/pkgs/development/python-modules/shazamio/default.nix +++ b/pkgs/development/python-modules/shazamio/default.nix @@ -72,5 +72,6 @@ buildPythonPackage rec { changelog = "https://github.com/dotX12/ShazamIO/releases/tag/${src.rev}"; license = licenses.mit; maintainers = with maintainers; [ figsoda ]; + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/steamship/default.nix b/pkgs/development/python-modules/steamship/default.nix index adc6db83dd9bd..aba55ddfcb09f 100644 --- a/pkgs/development/python-modules/steamship/default.nix +++ b/pkgs/development/python-modules/steamship/default.nix @@ -58,5 +58,7 @@ buildPythonPackage rec { changelog = "https://github.com/steamship-core/python-client/releases/tag/${version}"; license = licenses.mit; maintainers = with maintainers; [ natsukium ]; + # https://github.com/steamship-core/python-client/issues/503 + broken = versionAtLeast pydantic.version "2"; }; } diff --git a/pkgs/development/python-modules/withings-api/default.nix b/pkgs/development/python-modules/withings-api/default.nix index 5be701fa298ff..226907f9e95da 100644 --- a/pkgs/development/python-modules/withings-api/default.nix +++ b/pkgs/development/python-modules/withings-api/default.nix @@ -52,5 +52,6 @@ buildPythonPackage rec { homepage = "https://github.com/vangorra/python_withings_api"; license = licenses.mit; maintainers = with maintainers; [ kittywitch ]; + broken = versionAtLeast pydantic.version "2"; }; }