From f80228a8059fd8b2ecf03bc82e910013badb3625 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 10 May 2024 15:55:42 +0300 Subject: [PATCH 1/8] build-support/rust: rewrite workspace dependency inheritance This fixes at least one bug with default-features, and also just aligns us more with what Cargo actually does. Also some Python style fixes and a bit less mutating state. --- .../rust/replace-workspace-values.py | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/pkgs/build-support/rust/replace-workspace-values.py b/pkgs/build-support/rust/replace-workspace-values.py index 2b88f1fa79bb..003023ff2560 100644 --- a/pkgs/build-support/rust/replace-workspace-values.py +++ b/pkgs/build-support/rust/replace-workspace-values.py @@ -15,6 +15,9 @@ def load_file(path: str) -> dict[str, Any]: return tomli.load(f) +# This replicates the dependency merging logic from Cargo. +# See `inner_dependency_inherit_with`: +# https://github.com/rust-lang/cargo/blob/4de0094ac78743d2c8ff682489e35c8a7cafe8e4/src/cargo/util/toml/mod.rs#L982 def replace_key( workspace_manifest: dict[str, Any], table: dict[str, Any], section: str, key: str ) -> bool: @@ -25,28 +28,37 @@ def replace_key( ): print("replacing " + key) - replaced = table[key] - del replaced["workspace"] + local_dep = table[key] + del local_dep["workspace"] - workspace_copy = workspace_manifest[section][key] + workspace_dep = workspace_manifest[section][key] if section == "dependencies": - crate_features = replaced.get("features") + if isinstance(workspace_dep, str): + workspace_dep = {"version": workspace_dep} - if type(workspace_copy) is str: - replaced["version"] = workspace_copy - else: - replaced.update(workspace_copy) + final: dict[str, Any] = workspace_dep.copy() - merged_features = (crate_features or []) + ( - workspace_copy.get("features") or [] - ) + merged_features = local_dep.pop("features", []) + workspace_dep.get("features", []) + if merged_features: + final["features"] = merged_features - if len(merged_features) > 0: - # Dictionaries are guaranteed to be ordered (https://stackoverflow.com/a/7961425) - replaced["features"] = list(dict.fromkeys(merged_features)) + local_default_features = local_dep.pop("default-features", None) + workspace_default_features = workspace_dep.get("default-features") + + if not workspace_default_features and local_default_features: + final["default-features"] = True + + optional = local_dep.pop("optional", False) + if optional: + final["optional"] = True + + if local_dep: + raise Exception(f"Unhandled keys in inherited dependency {key}: {local_dep}") + + table[key] = final elif section == "package": - table[key] = replaced = workspace_copy + table[key] = workspace_dep return True From 60929c1912e29d9e5878964b9fc2b6a9a25668b8 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 11 May 2024 10:20:14 +0200 Subject: [PATCH 2/8] ome_zarr: fix by disabling failing tests --- .../python-modules/ome-zarr/default.nix | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkgs/development/python-modules/ome-zarr/default.nix b/pkgs/development/python-modules/ome-zarr/default.nix index 0412a0f80718..b87e8f925931 100644 --- a/pkgs/development/python-modules/ome-zarr/default.nix +++ b/pkgs/development/python-modules/ome-zarr/default.nix @@ -48,6 +48,27 @@ buildPythonPackage rec { "test_s3_info" ]; + pytestFlagsArray = [ + # Fail with RecursionError + # https://github.com/ome/ome-zarr-py/issues/352 + "--deselect=tests/test_cli.py::TestCli::test_astronaut_download" + "--deselect=tests/test_cli.py::TestCli::test_astronaut_info" + "--deselect=tests/test_cli.py::TestCli::test_coins_info" + "--deselect=tests/test_emitter.py::test_close" + "--deselect=tests/test_emitter.py::test_create_wrong_encoding" + "--deselect=tests/test_node.py::TestNode::test_image" + "--deselect=tests/test_node.py::TestNode::test_label" + "--deselect=tests/test_node.py::TestNode::test_labels" + "--deselect=tests/test_ome_zarr.py::TestOmeZarr::test_download" + "--deselect=tests/test_ome_zarr.py::TestOmeZarr::test_info" + "--deselect=tests/test_reader.py::TestReader::test_image" + "--deselect=tests/test_reader.py::TestReader::test_label" + "--deselect=tests/test_reader.py::TestReader::test_labels" + "--deselect=tests/test_starting_points.py::TestStartingPoints::test_label" + "--deselect=tests/test_starting_points.py::TestStartingPoints::test_labels" + "--deselect=tests/test_starting_points.py::TestStartingPoints::test_top_level" + ]; + pythonImportsCheck = [ "ome_zarr" "ome_zarr.cli" From 04898de2a313084beae441ba54f5309c1958a35f Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 11 May 2024 10:30:12 +0200 Subject: [PATCH 3/8] qovery-cli: 0.92.3 -> 0.92.4 Diff: https://github.com/Qovery/qovery-cli/compare/refs/tags/v0.92.3...v0.92.4 Changelog: https://github.com/Qovery/qovery-cli/releases/tag/v0.92.4 --- pkgs/tools/admin/qovery-cli/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/admin/qovery-cli/default.nix b/pkgs/tools/admin/qovery-cli/default.nix index 265f7f9de069..2abc5b851039 100644 --- a/pkgs/tools/admin/qovery-cli/default.nix +++ b/pkgs/tools/admin/qovery-cli/default.nix @@ -9,13 +9,13 @@ buildGoModule rec { pname = "qovery-cli"; - version = "0.92.3"; + version = "0.92.4"; src = fetchFromGitHub { owner = "Qovery"; repo = "qovery-cli"; rev = "refs/tags/v${version}"; - hash = "sha256-Xcl/2vkuOYfZcgICThYD5i1h82E6Leh+hNPzmzISZvQ="; + hash = "sha256-A8R1QbUFD4wJyLrTrxE8w9rz0E/vhaPXXAt80UpAOSc="; }; vendorHash = "sha256-6gjYnDv4L2AO47uWcp/MySX9i3IDMIWQUvgglxPCvGo="; From d90deb29b8b78ec87834533152426111a0b4598a Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 11 May 2024 11:34:18 +0200 Subject: [PATCH 4/8] python312Packages.pandas-datareader: mark as broken on python 3.12 --- .../pandas-datareader/default.nix | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/pandas-datareader/default.nix b/pkgs/development/python-modules/pandas-datareader/default.nix index e5222cf7ef83..de9f285a4a5f 100644 --- a/pkgs/development/python-modules/pandas-datareader/default.nix +++ b/pkgs/development/python-modules/pandas-datareader/default.nix @@ -1,7 +1,9 @@ { lib , buildPythonPackage +, pythonOlder +, pythonAtLeast , fetchPypi -, isPy27 +, setuptools , pandas , lxml , requests @@ -10,20 +12,29 @@ buildPythonPackage rec { pname = "pandas-datareader"; version = "0.10.0"; - format = "setuptools"; - disabled = isPy27; + pyproject = true; + + disabled = pythonOlder "3.6" || pythonAtLeast "3.12"; src = fetchPypi { inherit pname version; sha256 = "9fc3c63d39bc0c10c2683f1c6d503ff625020383e38f6cbe14134826b454d5a6"; }; + build-system = [ + setuptools + ]; + + dependencies = [ + pandas + lxml + requests + ]; + # Tests are trying to load data over the network doCheck = false; pythonImportsCheck = [ "pandas_datareader" ]; - propagatedBuildInputs = [ pandas lxml requests ]; - meta = with lib; { description = "Up to date remote data access for pandas, works for multiple versions of pandas"; homepage = "https://github.com/pydata/pandas-datareader"; From 40bed4630536b99ea1f2afb85f57801712d3c4a5 Mon Sep 17 00:00:00 2001 From: Tricia Tan Date: Sat, 11 May 2024 17:37:15 +0800 Subject: [PATCH 5/8] flyctl: 0.2.51 -> 0.2.52 --- pkgs/development/web/flyctl/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/web/flyctl/default.nix b/pkgs/development/web/flyctl/default.nix index 1b5e2d6f0770..8ca6eca5268b 100644 --- a/pkgs/development/web/flyctl/default.nix +++ b/pkgs/development/web/flyctl/default.nix @@ -2,13 +2,13 @@ buildGo122Module rec { pname = "flyctl"; - version = "0.2.51"; + version = "0.2.52"; src = fetchFromGitHub { owner = "superfly"; repo = "flyctl"; rev = "v${version}"; - hash = "sha256-UAA8aTT4Q3aimXJTz3P7Hirx4I3UZJb5KdXT59hxeXs="; + hash = "sha256-BCnMXyS94tuD+Un1DLqs3mdGi7XrVBoZGJ/XkpACOQI"; }; vendorHash = "sha256-eTiY65VGFBgGzCOrnp/WbOo9Lbdk4PYwT7CppjsZ4WE="; From ce7467e3034043cb047cd22b50bb0594ad041a38 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 10 May 2024 14:54:57 +0200 Subject: [PATCH 6/8] python312Packages.diffusers: fix build on python 3.12 --- .../python-modules/diffusers/default.nix | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/diffusers/default.nix b/pkgs/development/python-modules/diffusers/default.nix index 39464efe47fd..19fe676abb64 100644 --- a/pkgs/development/python-modules/diffusers/default.nix +++ b/pkgs/development/python-modules/diffusers/default.nix @@ -1,8 +1,9 @@ { lib , stdenv , buildPythonPackage -, fetchFromGitHub , pythonOlder +, fetchFromGitHub +, fetchpatch , writeText , setuptools , wheel @@ -35,6 +36,7 @@ , sentencepiece , torchsde , transformers +, pythonAtLeast }: buildPythonPackage rec { @@ -51,12 +53,26 @@ buildPythonPackage rec { hash = "sha256-aRnbU3jN40xaCsoMFyRt1XB+hyIYMJP2b/T1yZho90c="; }; - nativeBuildInputs = [ + patches = [ + # fix python3.12 build + (fetchpatch { # https://github.com/huggingface/diffusers/pull/7455 + name = "001-remove-distutils.patch"; + url = "https://github.com/huggingface/diffusers/compare/363699044e365ef977a7646b500402fa585e1b6b...3c67864c5acb30413911730b1ed4a9ad47c0a15c.patch"; + hash = "sha256-Qyvyp1GyTVXN+A+lA1r2hf887ubTtaUknbKd4r46NZQ="; + }) + (fetchpatch { # https://github.com/huggingface/diffusers/pull/7461 + name = "002-fix-removed-distutils.patch"; + url = "https://github.com/huggingface/diffusers/commit/efbbbc38e436a1abb1df41a6eccfd6f9f0333f97.patch"; + hash = "sha256-scdtpX1RYFFEDHcaMb+gDZSsPafkvnIO/wQlpzrQhLA="; + }) + ]; + + build-system = [ setuptools wheel ]; - propagatedBuildInputs = [ + dependencies = [ filelock huggingface-hub importlib-metadata @@ -143,6 +159,10 @@ buildPythonPackage rec { "test_model_cpu_offload_forward_pass" # tries to run ruff which we have intentionally removed from nativeCheckInputs "test_is_copy_consistent" + ] ++ lib.optionals (pythonAtLeast "3.12") [ + + # RuntimeError: Dynamo is not supported on Python 3.12+ + "test_from_save_pretrained_dynamo" ]; meta = with lib; { From 2e1287b70a5b53441f2f3874b2a2fa7869e27b82 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 9 May 2024 11:16:13 +0200 Subject: [PATCH 7/8] python311Packages.gradio-client: 0.14.0 -> 0.16.1 Changelog: https://github.com/gradio-app/gradio/releases/tag/gradio_client%400.16.1 --- pkgs/development/python-modules/gradio/client.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/gradio/client.nix b/pkgs/development/python-modules/gradio/client.nix index 96c293d399c5..bbf4d468ce69 100644 --- a/pkgs/development/python-modules/gradio/client.nix +++ b/pkgs/development/python-modules/gradio/client.nix @@ -28,8 +28,8 @@ buildPythonPackage rec { pname = "gradio-client"; - version = "0.14.0"; - format = "pyproject"; + version = "0.16.1"; + pyproject = true; disabled = pythonOlder "3.8"; @@ -37,9 +37,9 @@ buildPythonPackage rec { src = fetchFromGitHub { owner = "gradio-app"; repo = "gradio"; - rev = "refs/tags/@gradio/client@${version}"; + rev = "refs/tags/gradio_client@${version}"; sparseCheckout = [ "client/python" ]; - hash = "sha256-7oC/Z3YUiOFZdv/60q7PkfluV77broRkHgWiY9Vim9Y="; + hash = "sha256-SVUm9LrjYG0r3U1yOd3rctxVMYlnAOW+Opqy9c3osnw="; }; prePatch = '' cd client/python @@ -52,7 +52,7 @@ buildPythonPackage rec { "websockets" ]; - nativeBuildInputs = [ + build-system = [ hatchling hatch-requirements-txt hatch-fancy-pypi-readme From c207a5ef698dd95c63b241cae51a35911e989253 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 9 May 2024 11:18:20 +0200 Subject: [PATCH 8/8] python311Packages.gradio: 4.27.0 -> 4.29.0 --- pkgs/development/python-modules/gradio/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/gradio/default.nix b/pkgs/development/python-modules/gradio/default.nix index 0d4838e372de..7f3a173cf1ae 100644 --- a/pkgs/development/python-modules/gradio/default.nix +++ b/pkgs/development/python-modules/gradio/default.nix @@ -62,7 +62,7 @@ buildPythonPackage rec { pname = "gradio"; - version = "4.27.0"; + version = "4.29.0"; format = "pyproject"; disabled = pythonOlder "3.7"; @@ -71,7 +71,7 @@ buildPythonPackage rec { # and upstream has stopped tagging releases since 3.41.0 src = fetchPypi { inherit pname version; - hash = "sha256-617zutFhS8NGO4+fcALH8aKbk+reGC65DNWKVVKiWEw="; + hash = "sha256-17KT0b9kBO+xLgIgxfpwjETDoRM4aTJPlJv7HjkJXjo="; }; # fix packaging.ParserSyntaxError, which can't handle comments