From a532aae5e908bdc5fc82a83f7f4fec382f8798f0 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 3 Aug 2026 17:42:08 +0000 Subject: [PATCH 1/3] python3Packages.funsor: 0.4.7 -> 0.4.8 Diff: https://github.com/pyro-ppl/funsor/compare/0.4.7...0.4.8 Changelog: https://github.com/pyro-ppl/funsor/releases/tag/0.4.8 --- .../python-modules/funsor/default.nix | 15 +++--- .../torch-arg-constraints-property.patch | 52 +++++++++++++++++++ 2 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 pkgs/development/python-modules/funsor/torch-arg-constraints-property.patch diff --git a/pkgs/development/python-modules/funsor/default.nix b/pkgs/development/python-modules/funsor/default.nix index 04ece9b20542..4c57b7fbb58c 100644 --- a/pkgs/development/python-modules/funsor/default.nix +++ b/pkgs/development/python-modules/funsor/default.nix @@ -2,7 +2,6 @@ lib, buildPythonPackage, fetchFromGitHub, - fetchpatch, # build-system setuptools, @@ -29,7 +28,7 @@ buildPythonPackage (finalAttrs: { pname = "funsor"; - version = "0.4.7"; + version = "0.4.8"; pyproject = true; __structuredAttrs = true; @@ -37,15 +36,15 @@ buildPythonPackage (finalAttrs: { owner = "pyro-ppl"; repo = "funsor"; tag = finalAttrs.version; - hash = "sha256-0STJv1OOliJaHdmYUXdnOnocH3hVXceH/Uw5nILvT+U="; + hash = "sha256-iTkDd6vz4wesY3jABSMxLtTKioP98DhGB0plLL+vhNY="; }; patches = [ - # Compatibility with torch >= 2.5 (arg_constraints is now a property) - (fetchpatch { - url = "https://github.com/pyro-ppl/funsor/commit/c5e2a48d73cad4e98058147af4090171272a44e5.patch"; - hash = "sha256-sTR+hbJtS0Th5sIqlvB2bReEC0wnEbnB7gAiZKiqjAQ="; - }) + # Compatibility with torch >= 2.5, where `Uniform.arg_constraints` is a property. + # Remaining part of the pending upstream PR https://github.com/pyro-ppl/funsor/pull/610 + # (the `Uniform` parameter registration was already merged as part of + # https://github.com/pyro-ppl/funsor/pull/614). + ./torch-arg-constraints-property.patch ]; build-system = [ setuptools ]; diff --git a/pkgs/development/python-modules/funsor/torch-arg-constraints-property.patch b/pkgs/development/python-modules/funsor/torch-arg-constraints-property.patch new file mode 100644 index 000000000000..e6dd756af6d1 --- /dev/null +++ b/pkgs/development/python-modules/funsor/torch-arg-constraints-property.patch @@ -0,0 +1,52 @@ +diff --git a/funsor/distribution.py b/funsor/distribution.py +index 5a48ecb..cfb2d2e 100644 +--- a/funsor/distribution.py ++++ b/funsor/distribution.py +@@ -309,7 +309,10 @@ class Distribution(Funsor, metaclass=DistributionMeta): + @classmethod + @functools.lru_cache(maxsize=5000) + def _infer_param_domain(cls, name, raw_shape): +- support = cls.dist_class.arg_constraints.get(name, None) ++ constraints = getattr(cls.dist_class, "arg_constraints", {}) ++ if isinstance(constraints, property): ++ constraints = {} ++ support = constraints.get(name, None) + # XXX: if the backend does not have the same definition of constraints, we should + # define backend-specific distributions and overide these `infer_value_domain`, + # `infer_param_domain` methods. +@@ -330,9 +333,8 @@ class Distribution(Funsor, metaclass=DistributionMeta): + # for discrete multivariate distributions in Pyro + elif support_name == "Real": + if name == "logits" and ( +- "probs" in cls.dist_class.arg_constraints +- and type(cls.dist_class.arg_constraints["probs"]).__name__.lstrip("_") +- == "Simplex" ++ "probs" in constraints ++ and type(constraints.get("probs")).__name__.lstrip("_") == "Simplex" + ): + output = Reals[raw_shape[-1 - event_dim :]] + else: +@@ -377,10 +379,13 @@ def make_dist( + backend_dist_class, param_names=(), generate_eager=True, generate_to_funsor=True + ): + if not param_names: ++ constraints = getattr(backend_dist_class, "arg_constraints", {}) ++ if isinstance(constraints, property): ++ constraints = {} + param_names = tuple( + name + for name in inspect.getfullargspec(backend_dist_class.__init__)[0][1:] +- if name in backend_dist_class.arg_constraints ++ if name in constraints + ) + + @makefun.with_signature( +@@ -608,7 +613,7 @@ class CoerceDistributionToFunsor: + def __call__(self, cls, args, kwargs): + # Check whether distribution class takes any tensor inputs. + arg_constraints = getattr(cls, "arg_constraints", None) +- if not arg_constraints: ++ if not arg_constraints or isinstance(arg_constraints, property): + return + + # Check whether any tensor inputs are actually funsors. From 9c3f30e894454068cdb4c1623bf0deecec272a79 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 3 Aug 2026 20:53:43 +0000 Subject: [PATCH 2/3] python3Packages.botorch: fix build --- pkgs/development/python-modules/botorch/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/python-modules/botorch/default.nix b/pkgs/development/python-modules/botorch/default.nix index 1cc078b4224a..0bcaf74767cd 100644 --- a/pkgs/development/python-modules/botorch/default.nix +++ b/pkgs/development/python-modules/botorch/default.nix @@ -3,6 +3,7 @@ stdenv, buildPythonPackage, fetchFromGitHub, + fetchpatch, # build-system setuptools, @@ -42,6 +43,16 @@ buildPythonPackage (finalAttrs: { hash = "sha256-tUTtImqPlbS8g1oLoTTCCWQbeLwLop13qPjFrQeMtb8="; }; + patches = [ + # Allow scipy 1.18 in batched L-BFGS-B fast path + # https://github.com/meta-pytorch/botorch/pull/3328 + (fetchpatch { + name = "scipy-1.18.patch"; + url = "https://github.com/meta-pytorch/botorch/commit/611f14acc8c1b2f30ce2ae058568d90f96bbb2ec.patch"; + hash = "sha256-PiXq9GmPaWQXh+emY7aNI53Y+ufl8K5uOFa8GD0clP8="; + }) + ]; + build-system = [ setuptools setuptools-scm From 42d9ffb2d02edf72544efc9e4480b9b168d4a2af Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 3 Aug 2026 21:26:24 +0000 Subject: [PATCH 3/3] python3Packages.syne-tune: 0.15.0 -> 0.16.0 Diff: https://github.com/syne-tune/syne-tune/compare/v0.15.0...v0.16.0 Changelog: https://github.com/syne-tune/syne-tune/releases/tag/v0.16.0 --- .../python-modules/syne-tune/default.nix | 99 +++++-------------- 1 file changed, 22 insertions(+), 77 deletions(-) diff --git a/pkgs/development/python-modules/syne-tune/default.nix b/pkgs/development/python-modules/syne-tune/default.nix index 21645320fe63..c788e5d43a6e 100644 --- a/pkgs/development/python-modules/syne-tune/default.nix +++ b/pkgs/development/python-modules/syne-tune/default.nix @@ -1,6 +1,5 @@ { lib, - stdenv, buildPythonPackage, fetchFromGitHub, @@ -11,119 +10,65 @@ dill, numpy, pandas, + psutil, + scikit-learn, sortedcontainers, + statsmodels, + tqdm, typing-extensions, + xgboost, - # optional-dependencies - autograd, + # tests botorch, - # configspace, fastparquet, h5py, huggingface-hub, - matplotlib, pymoo, - scikit-learn, - scipy, - # smac, - statsmodels, - xgboost, - # yahpo-gym, - - # tests - pytestCheckHook, pytest-timeout, - ray, + pytestCheckHook, writableTmpDirAsHomeHook, }: buildPythonPackage (finalAttrs: { pname = "syne-tune"; - version = "0.15.0"; + version = "0.16.0"; pyproject = true; + __structuredAttrs = true; src = fetchFromGitHub { owner = "syne-tune"; repo = "syne-tune"; tag = "v${finalAttrs.version}"; - hash = "sha256-UNBpfC+aLXhkbyvCG2K00yedJnpYpfldqisZ/wDPtuA="; + hash = "sha256-fejG/KWWT6HrGCGzGh4p/Q3kzIDgYbRgfwGQf5sgKic="; }; build-system = [ setuptools ]; - pythonRelaxDeps = [ - "numpy" - ]; - dependencies = [ dill numpy pandas + psutil + scikit-learn sortedcontainers + statsmodels + tqdm typing-extensions + xgboost ]; - optional-dependencies = lib.fix (self: { - blackbox-repository = [ - fastparquet - h5py - huggingface-hub - numpy - pandas - scikit-learn - xgboost - ]; - bore = [ - scikit-learn - xgboost - ]; - botorch = [ botorch ]; - gpsearchers = [ - autograd - scipy - ]; - kde = [ statsmodels ]; - moo = [ - pymoo - scipy - ]; - sklearn = [ scikit-learn ]; - # smac = [ smac swig ]; # smac unavailable on nixpkgs - visual = [ matplotlib ]; - # yahpo = [ configspace onnxruntime pandas pyyaml yahpo-gym ]; # yahpo-gym unavailable on nixpkgs - }); + pythonImportsCheck = [ "syne_tune" ]; nativeCheckInputs = [ - pytestCheckHook + botorch + fastparquet + h5py + huggingface-hub + pymoo pytest-timeout - ray + pytestCheckHook writableTmpDirAsHomeHook - ] - ++ ray.optional-dependencies.tune - ++ finalAttrs.passthru.optional-dependencies.blackbox-repository - ++ finalAttrs.passthru.optional-dependencies.bore - ++ finalAttrs.passthru.optional-dependencies.botorch - ++ finalAttrs.passthru.optional-dependencies.gpsearchers - ++ finalAttrs.passthru.optional-dependencies.kde - ++ finalAttrs.passthru.optional-dependencies.sklearn; - - disabledTests = [ - # NameError: name 'HV' is not defined - # these require pkg `pymoo` and adding `pymoo` raises: - # setuptools.errors.PackageDiscoveryError: Multiple top-level packages discovered in a flat-layout: ['cma', 'notebooks']. - "test_append_hypervolume_indicator" - "test_hypervolume" - "test_hypervolume_progress" - "test_hypervolume_simple" - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - # assert np.float64(1.0114686865847489e-12) < 1e-12 - "test_cholesky_factorization" - ]; - - pythonImportsCheck = [ - "syne_tune" ]; meta = {