From ae072812b59cccbc2ffeb63ba6886f3263cf81a4 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 3 Jan 2024 02:44:40 +0100 Subject: [PATCH 1/6] python311Packages.sqlalchemy_1_4: init at 1.4.51 We'd rather maintain one version, than have many unmaintained overrides throughout nixpkgs. Don't use this version for libraries, only for applications. --- .../python-modules/sqlalchemy/1_4.nix | 140 ++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 142 insertions(+) create mode 100644 pkgs/development/python-modules/sqlalchemy/1_4.nix diff --git a/pkgs/development/python-modules/sqlalchemy/1_4.nix b/pkgs/development/python-modules/sqlalchemy/1_4.nix new file mode 100644 index 000000000000..4efdee5927cc --- /dev/null +++ b/pkgs/development/python-modules/sqlalchemy/1_4.nix @@ -0,0 +1,140 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub + +# build-system +, setuptools + +# dependencies +, greenlet + +# optionals +, aiomysql +, aiosqlite +, asyncmy +, asyncpg +, cx_oracle +, mariadb +, mypy +, mysql-connector +, mysqlclient +, pg8000 +, psycopg2 +, psycopg2cffi +# TODO: pymssql +, pymysql +, pyodbc +# TODO: sqlcipher3 +, typing-extensions + +# tests +, mock +, pytest-xdist +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "sqlalchemy"; + version = "1.4.51"; + pyproject = true; + + src = fetchFromGitHub { + owner = "sqlalchemy"; + repo = "sqlalchemy"; + rev = "rel_${lib.replaceStrings [ "." ] [ "_" ] version}"; + hash = "sha256-KhLSKlQ4xfSh1nsAt+cRO+adh2aj/h/iqV6YmDbz39k="; + }; + + nativeBuildInputs = [ + setuptools + ]; + + propagatedBuildInputs = [ + greenlet + ]; + + passthru.optional-dependencies = lib.fix (self: { + asyncio = [ + greenlet + ]; + mypy = [ + mypy + ]; + mssql = [ + pyodbc + ]; + mssql_pymysql = [ + # TODO: pymssql + ]; + mssql_pyodbc = [ + pyodbc + ]; + mysql = [ + mysqlclient + ]; + mysql_connector = [ + mysql-connector + ]; + mariadb_connector = [ + mariadb + ]; + oracle = [ + cx_oracle + ]; + postgresql = [ + psycopg2 + ]; + postgresql_pg8000 = [ + pg8000 + ]; + postgresql_asyncpg = [ + asyncpg + ] ++ self.asyncio; + postgresql_psycopg2binary = [ + psycopg2 + ]; + postgresql_psycopg2cffi = [ + psycopg2cffi + ]; + pymysql = [ + pymysql + ]; + aiomysql = [ + aiomysql + ] ++ self.asyncio; + asyncmy = [ + asyncmy + ] ++ self.asyncio; + aiosqlite = [ + aiosqlite + typing-extensions + ] ++ self.asyncio; + sqlcipher = [ + # TODO: sqlcipher3 + ]; + }); + + nativeCheckInputs = [ + pytest-xdist + pytestCheckHook + mock + ]; + + disabledTestPaths = [ + # typing correctness, not interesting + "test/ext/mypy" + # slow and high memory usage, not interesting + "test/aaa_profiling" + ]; + + pythonImportsCheck = [ + "sqlalchemy" + ]; + + meta = with lib; { + changelog = "https://github.com/sqlalchemy/sqlalchemy/releases/tag/rel_${builtins.replaceStrings [ "." ] [ "_" ] version}"; + description = "The Database Toolkit for Python"; + homepage = "https://github.com/sqlalchemy/sqlalchemy"; + license = licenses.mit; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5bca030bf240..d6005221828e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13622,6 +13622,8 @@ self: super: with self; { sqlalchemy = callPackage ../development/python-modules/sqlalchemy { }; + sqlalchemy_1_4 = callPackage ../development/python-modules/sqlalchemy/1_4.nix { }; + sqlalchemy-citext = callPackage ../development/python-modules/sqlalchemy-citext { }; sqlalchemy-continuum = callPackage ../development/python-modules/sqlalchemy-continuum { }; From f7c4f8550f1cc5f5ac686fd4b7c6c4b5ca9c8129 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 3 Jan 2024 02:49:51 +0100 Subject: [PATCH 2/6] python311Packages.alembic: adjust dependencies, use pep517 builder --- .../python-modules/alembic/default.nix | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pkgs/development/python-modules/alembic/default.nix b/pkgs/development/python-modules/alembic/default.nix index 36a6bb79bc27..004d025062c9 100644 --- a/pkgs/development/python-modules/alembic/default.nix +++ b/pkgs/development/python-modules/alembic/default.nix @@ -2,13 +2,21 @@ , buildPythonPackage , fetchPypi , pythonOlder -, mako -, python-dateutil -, sqlalchemy + +# build-system +, setuptools + +# dependencies , importlib-metadata , importlib-resources -, pytest-xdist +, mako +, sqlalchemy +, typing-extensions + +# tests , pytestCheckHook +, pytest-xdist +, python-dateutil }: buildPythonPackage rec { @@ -23,13 +31,16 @@ buildPythonPackage rec { hash = "sha256-jnZFwy5PIAZ15p8HRUFTNetZo2Y/X+tIer+gswxFiIs="; }; + nativeBuildInputs = [ + setuptools + ]; + propagatedBuildInputs = [ mako - python-dateutil sqlalchemy + typing-extensions ] ++ lib.optionals (pythonOlder "3.9") [ importlib-resources - ] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ]; @@ -40,6 +51,7 @@ buildPythonPackage rec { nativeCheckInputs = [ pytestCheckHook pytest-xdist + python-dateutil ]; meta = with lib; { From 1697051b339f21bc404ba25794a2b20fdf2f9301 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 3 Jan 2024 03:03:39 +0100 Subject: [PATCH 3/6] python39Packages.typeguard: fix build on python<3.10 --- pkgs/development/python-modules/typeguard/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/python-modules/typeguard/default.nix b/pkgs/development/python-modules/typeguard/default.nix index 23e3bdc5b546..c2eaf3889bf8 100644 --- a/pkgs/development/python-modules/typeguard/default.nix +++ b/pkgs/development/python-modules/typeguard/default.nix @@ -6,6 +6,7 @@ , setuptools-scm , pytestCheckHook , typing-extensions +, importlib-metadata , sphinxHook , sphinx-autodoc-typehints , sphinx-rtd-theme @@ -40,6 +41,8 @@ buildPythonPackage rec { propagatedBuildInputs = [ typing-extensions + ] ++ lib.optionals (pythonOlder "3.10") [ + importlib-metadata ]; env.LC_ALL = "en_US.utf-8"; From ba3412d88a7df9c19088040d82ceaf01d84ff1bb Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 3 Jan 2024 03:04:24 +0100 Subject: [PATCH 4/6] treewide: use sqlalchemy_1_4 instead of individual overrides As long as sqlalchemy 1.4 is still maintained we should rather maintain one derivation well, instead of many overrides barely. --- .../version-management/sourcehut/default.nix | 13 +------------ pkgs/applications/video/pyca/default.nix | 14 +------------- .../continuous-integration/buildbot/default.nix | 13 +------------ pkgs/servers/apache-airflow/default.nix | 14 +------------- pkgs/servers/calibre-web/default.nix | 14 +------------- pkgs/servers/geospatial/fit-trackee/default.nix | 15 ++------------- pkgs/tools/misc/ntfy/default.nix | 16 +++------------- pkgs/tools/text/csvkit/default.nix | 13 +------------ 8 files changed, 11 insertions(+), 101 deletions(-) diff --git a/pkgs/applications/version-management/sourcehut/default.nix b/pkgs/applications/version-management/sourcehut/default.nix index 8682057b7838..b951a34e8916 100644 --- a/pkgs/applications/version-management/sourcehut/default.nix +++ b/pkgs/applications/version-management/sourcehut/default.nix @@ -29,18 +29,7 @@ let scmsrht = self.callPackage ./scm.nix { }; # sourcehut is not (yet) compatible with SQLAlchemy 2.x - sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec { - version = "1.4.46"; - src = fetchPypi { - pname = "SQLAlchemy"; - inherit version; - hash = "sha256-aRO4JH2KKS74MVFipRkx4rQM6RaB8bbxj2lwRSAMSjA="; - }; - nativeCheckInputs = with super; [ pytestCheckHook mock ]; - disabledTestPaths = [] - # Disable incompatible tests on Darwin. - ++ lib.optionals stdenv.isDarwin [ "test/aaa_profiling" ]; - }); + sqlalchemy = super.sqlalchemy_1_4; flask-sqlalchemy = super.flask-sqlalchemy.overridePythonAttrs (oldAttrs: rec { version = "2.5.1"; diff --git a/pkgs/applications/video/pyca/default.nix b/pkgs/applications/video/pyca/default.nix index 28d25844e033..73b6e606118a 100644 --- a/pkgs/applications/video/pyca/default.nix +++ b/pkgs/applications/video/pyca/default.nix @@ -1,6 +1,5 @@ { lib , python3 -, fetchPypi , buildNpmPackage , fetchFromGitHub , jq @@ -11,18 +10,7 @@ let python = python3.override { packageOverrides = self: super: { # pyCA is incompatible with SQLAlchemy 2.0 - sqlalchemy = super.sqlalchemy.overridePythonAttrs (old: rec { - version = "1.4.46"; - src = fetchPypi { - pname = "SQLAlchemy"; - inherit version; - hash = "sha256-aRO4JH2KKS74MVFipRkx4rQM6RaB8bbxj2lwRSAMSjA="; - }; - disabledTestPaths = [ - "test/aaa_profiling" - "test/ext/mypy" - ]; - }); + sqlalchemy = super.sqlalchemy_1_4; }; }; diff --git a/pkgs/development/tools/continuous-integration/buildbot/default.nix b/pkgs/development/tools/continuous-integration/buildbot/default.nix index 7bc06163f236..019ba4579d4a 100644 --- a/pkgs/development/tools/continuous-integration/buildbot/default.nix +++ b/pkgs/development/tools/continuous-integration/buildbot/default.nix @@ -6,18 +6,7 @@ let python = python3.override { packageOverrides = self: super: { - sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec { - version = "1.4.50"; - src = fetchPypi { - pname = "SQLAlchemy"; - inherit version; - hash = "sha256-O5fd9Qn8IeELCUA7UhmwbFtViyf8JFMVAnT6TnBwfb8="; - }; - disabledTestPaths = [ - "test/aaa_profiling" - "test/ext/mypy" - ]; - }); + sqlalchemy = super.sqlalchemy_1_4; moto = super.moto.overridePythonAttrs (oldAttrs: rec { # a lot of tests -> very slow, we already build them when building python packages doCheck = false; diff --git a/pkgs/servers/apache-airflow/default.nix b/pkgs/servers/apache-airflow/default.nix index 7495b2d8dfd4..223eabc595ca 100644 --- a/pkgs/servers/apache-airflow/default.nix +++ b/pkgs/servers/apache-airflow/default.nix @@ -52,19 +52,7 @@ let }); # apache-airflow doesn't work with sqlalchemy 2.x # https://github.com/apache/airflow/issues/28723 - sqlalchemy = pySuper.sqlalchemy.overridePythonAttrs (o: rec { - version = "1.4.48"; - src = fetchFromGitHub { - owner = "sqlalchemy"; - repo = "sqlalchemy"; - rev = "refs/tags/rel_${lib.replaceStrings [ "." ] [ "_" ] version}"; - hash = "sha256-qyD3uoxEnD2pdVvwpUlSqHB3drD4Zg/+ov4CzLFIlLs="; - }; - disabledTestPaths = [ - "test/aaa_profiling" - "test/ext/mypy" - ]; - }); + sqlalchemy = pySuper.sqlalchemy_1_4; apache-airflow = pySelf.callPackage ./python-package.nix { }; }; diff --git a/pkgs/servers/calibre-web/default.nix b/pkgs/servers/calibre-web/default.nix index eb5f9bae9297..0d0afd185f41 100644 --- a/pkgs/servers/calibre-web/default.nix +++ b/pkgs/servers/calibre-web/default.nix @@ -2,24 +2,12 @@ , fetchFromGitHub , nixosTests , python3 -, fetchPypi }: let python = python3.override { packageOverrides = self: super: { - sqlalchemy = super.sqlalchemy.overridePythonAttrs (old: rec { - version = "1.4.46"; - src = fetchPypi { - pname = "SQLAlchemy"; - inherit version; - hash = "sha256-aRO4JH2KKS74MVFipRkx4rQM6RaB8bbxj2lwRSAMSjA="; - }; - disabledTestPaths = [ - "test/aaa_profiling" - "test/ext/mypy" - ]; - }); + sqlalchemy = super.sqlalchemy_1_4; }; }; in diff --git a/pkgs/servers/geospatial/fit-trackee/default.nix b/pkgs/servers/geospatial/fit-trackee/default.nix index 266747622db9..5a3673244e30 100644 --- a/pkgs/servers/geospatial/fit-trackee/default.nix +++ b/pkgs/servers/geospatial/fit-trackee/default.nix @@ -8,19 +8,8 @@ let python = python3.override { packageOverrides = self: super: { - sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec { - version = "1.4.49"; - src = fetchPypi { - pname = "SQLAlchemy"; - inherit version; - hash = "sha256-Bv8ly64ww5bEt3N0ZPKn/Deme32kCZk7GCsCTOyArtk="; - }; - # Remove "test/typing" that does not exist - disabledTestPaths = [ - "test/aaa_profiling" - "test/ext/mypy" - ]; - }); + sqlalchemy = super.sqlalchemy_1_4; + flask-sqlalchemy = super.flask-sqlalchemy.overridePythonAttrs (oldAttrs: rec { version = "3.0.5"; diff --git a/pkgs/tools/misc/ntfy/default.nix b/pkgs/tools/misc/ntfy/default.nix index cb81d49e29d1..fc9fd078ab20 100644 --- a/pkgs/tools/misc/ntfy/default.nix +++ b/pkgs/tools/misc/ntfy/default.nix @@ -1,7 +1,6 @@ { lib , stdenv , python39 -, fetchPypi , fetchFromGitHub , fetchpatch , withXmpp ? !stdenv.isDarwin @@ -18,18 +17,9 @@ let ntfy-webpush = self.callPackage ./webpush.nix { }; # databases, on which slack-sdk depends, is incompatible with SQLAlchemy 2.0 - sqlalchemy = super.sqlalchemy.overridePythonAttrs rec { - version = "1.4.46"; - src = fetchPypi { - pname = "SQLAlchemy"; - inherit version; - hash = "sha256-aRO4JH2KKS74MVFipRkx4rQM6RaB8bbxj2lwRSAMSjA="; - }; - disabledTestPaths = [ - "test/aaa_profiling" - "test/ext/mypy" - ]; - }; + sqlalchemy = super.sqlalchemy_1_4; + + django = super.django_3; }; }; in python.pkgs.buildPythonApplication rec { diff --git a/pkgs/tools/text/csvkit/default.nix b/pkgs/tools/text/csvkit/default.nix index cfebb5674327..d559f1204915 100644 --- a/pkgs/tools/text/csvkit/default.nix +++ b/pkgs/tools/text/csvkit/default.nix @@ -6,18 +6,7 @@ let python = python3.override { packageOverrides = self: super: { - sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec { - version = "1.4.46"; - src = fetchPypi { - pname = "SQLAlchemy"; - inherit version; - hash = "sha256-aRO4JH2KKS74MVFipRkx4rQM6RaB8bbxj2lwRSAMSjA="; - }; - disabledTestPaths = [ - "test/aaa_profiling" - "test/ext/mypy" - ]; - }); + sqlalchemy = super.sqlalchemy_1_4; }; }; in From 1c599defe026786770d7d8051379523b1e5c95ca Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 3 Jan 2024 14:36:40 +0100 Subject: [PATCH 5/6] mailman: propagate python-dateutil Broke after moving python-dateutil to checkDeps in alembic. --- pkgs/servers/mail/mailman/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/servers/mail/mailman/package.nix b/pkgs/servers/mail/mailman/package.nix index f64c3f1a29c8..6edfeacf8999 100644 --- a/pkgs/servers/mail/mailman/package.nix +++ b/pkgs/servers/mail/mailman/package.nix @@ -31,6 +31,7 @@ buildPythonPackage rec { gunicorn lazr-config passlib + python-dateutil requests sqlalchemy zope-component From 11408cee3ae3ba149b7b8507ae9d69175cb98781 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 3 Jan 2024 15:11:33 +0100 Subject: [PATCH 6/6] python311Packages.spacy_models: use pep517 builder with setuptools --- pkgs/development/python-modules/spacy/models.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/spacy/models.nix b/pkgs/development/python-modules/spacy/models.nix index 08f54e6f125c..3c8a3cc0ff2f 100644 --- a/pkgs/development/python-modules/spacy/models.nix +++ b/pkgs/development/python-modules/spacy/models.nix @@ -5,6 +5,7 @@ , pymorphy3 , pymorphy3-dicts-uk , sentencepiece +, setuptools , spacy , spacy-pkuseg , spacy-transformers @@ -23,6 +24,7 @@ let in buildPythonPackage { inherit pname version; + pyproject = true; src = fetchurl { url = "https://github.com/explosion/spacy-models/releases/download/${pname}-${version}/${pname}-${version}.tar.gz"; @@ -41,7 +43,9 @@ let --replace "protobuf<3.21.0" "protobuf" ''; - nativeBuildInputs = lib.optionals requires-protobuf [ + nativeBuildInputs = [ + setuptools + ] ++ lib.optionals requires-protobuf [ protobuf ];