From c89f023b8dcb33dec8c656cd324b77b5e4053151 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sat, 4 Jan 2025 08:44:10 -0500 Subject: [PATCH 1/3] python3Packages.fastjet: re-init at 3.4.2.1 --- .../python-modules/fastjet/default.nix | 92 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 5 +- 2 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/python-modules/fastjet/default.nix diff --git a/pkgs/development/python-modules/fastjet/default.nix b/pkgs/development/python-modules/fastjet/default.nix new file mode 100644 index 000000000000..d3e62027ae77 --- /dev/null +++ b/pkgs/development/python-modules/fastjet/default.nix @@ -0,0 +1,92 @@ +{ + lib, + stdenv, + fetchPypi, + fetchurl, + buildPythonPackage, + pytestCheckHook, + pkgs, + awkward, + numpy, + pybind11, + python, + setuptools, + setuptools-scm, + vector, +}: + +let + fastjet = + (pkgs.fastjet.override { + inherit python; + withPython = true; + }).overrideAttrs + (prev: { + postInstall = + (prev.postInstall or "") + + '' + mv "$out/${python.sitePackages}/"{fastjet.py,_fastjet_swig.py} + ''; + }); + fastjet-contrib = pkgs.fastjet-contrib.override { + inherit fastjet; + }; +in + +buildPythonPackage rec { + pname = "fastjet"; + version = "3.4.2.1"; + pyproject = true; + + src = fetchPypi { + pname = "fastjet"; + inherit version; + hash = "sha256-YlYJWCdwEBiG+koh1X2app1HinvktryisxP/C024g1k="; + }; + + # unvendor fastjet/fastjet-contrib + postPatch = '' + substituteInPlace setup.py \ + --replace-fail 'cmdclass={"build_ext": FastJetBuild, "install": FastJetInstall},' "" \ + --replace-fail 'str(OUTPUT / "include")' "" \ + --replace-fail 'str(OUTPUT / "lib")' "" + for file in src/fastjet/*.py; do + substituteInPlace "$file" \ + --replace-warn "fastjet._swig" "_fastjet_swig" + done + sed -i src/fastjet/_pyjet.py -e '1iimport _fastjet_swig' + ''; + + strictDeps = true; + + build-system = [ + setuptools + setuptools-scm + ]; + + dependencies = [ + fastjet + ]; + + buildInputs = [ + pybind11 + fastjet-contrib + ]; + + nativeCheckInputs = [ + pytestCheckHook + awkward + numpy + vector + ]; + + env.SETUPTOOLS_SCM_PRETEND_VERSION = version; + + meta = { + description = "Jet-finding in the Scikit-HEP ecosystem"; + homepage = "https://github.com/scikit-hep/fastjet"; + changelog = "https://github.com/scikit-hep/fastjet/releases/tag/v${version}"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index abac140b6209..868922729599 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4492,10 +4492,7 @@ self: super: with self; { fastimport = callPackage ../development/python-modules/fastimport { }; - fastjet = toPythonModule (pkgs.fastjet.override { - withPython = true; - inherit (self) python; - }); + fastjet = callPackage ../development/python-modules/fastjet { }; fastjsonschema = callPackage ../development/python-modules/fastjsonschema { }; From a4ba9bc650f033a52b401b043a927246d3ed8098 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 5 Jan 2025 10:25:39 -0500 Subject: [PATCH 2/3] python3Packages.awkward: disable testing against JAX --- .../python-modules/awkward/default.nix | 35 ++++++++----------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/pkgs/development/python-modules/awkward/default.nix b/pkgs/development/python-modules/awkward/default.nix index 867941a53aff..849b4b43b780 100644 --- a/pkgs/development/python-modules/awkward/default.nix +++ b/pkgs/development/python-modules/awkward/default.nix @@ -24,8 +24,6 @@ pyarrow, pytest-xdist, pytestCheckHook, - jax, - jaxlib, stdenv, }: @@ -61,28 +59,23 @@ buildPythonPackage rec { pythonImportsCheck = [ "awkward" ]; - nativeCheckInputs = - [ - fsspec - numba - setuptools - numexpr - pandas - pyarrow - pytest-xdist - pytestCheckHook - ] - ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ - # no support for darwin - jax - jaxlib - ]; + nativeCheckInputs = [ + fsspec + numba + setuptools + numexpr + pandas + pyarrow + pytest-xdist + pytestCheckHook + ]; - # The following tests have been disabled because they need to be run on a GPU platform. disabledTestPaths = [ + # Need to be run on a GPU platform. "tests-cuda" - # Disable tests dependending on jax on darwin - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "tests/test_2603_custom_behaviors_with_jax.py" ]; + # JAX is broken + "tests/test_2603_custom_behaviors_with_jax.py" + ]; disabledTests = [ # AssertionError: Regex pattern did not match. From 7dfdc3526086ba39711d70fde261c5794c7ee807 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 5 Jan 2025 11:19:38 -0500 Subject: [PATCH 3/3] python3Packages.correctionlib: patch vendored rapidjson --- .../python-modules/correctionlib/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/python-modules/correctionlib/default.nix b/pkgs/development/python-modules/correctionlib/default.nix index 6c39407ae3c2..0d40e8e3ab51 100644 --- a/pkgs/development/python-modules/correctionlib/default.nix +++ b/pkgs/development/python-modules/correctionlib/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + fetchpatch, # build-system cmake, @@ -37,6 +38,16 @@ buildPythonPackage rec { fetchSubmodules = true; }; + patches = [ + # fix https://github.com/Tencent/rapidjson/issues/2277 + (fetchpatch { + url = "https://github.com/Tencent/rapidjson/pull/719.diff"; + hash = "sha256-xarSfi9o73KoJo0ijT0G8fyTSYVuY0+9rLEtfUwas0Q="; + extraPrefix = "rapidjson/"; + stripLen = 1; + }) + ]; + build-system = [ cmake scikit-build