diff --git a/pkgs/by-name/nu/numkong/package.nix b/pkgs/by-name/nu/numkong/package.nix new file mode 100644 index 000000000000..af5ed0c42a5d --- /dev/null +++ b/pkgs/by-name/nu/numkong/package.nix @@ -0,0 +1,37 @@ +{ + lib, + cmake, + fetchFromGitHub, + stdenv, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "numkong"; + version = "7.7.0"; + + outputs = [ + "out" + "lib" + "dev" + ]; + + __structuredAttrs = true; + strictDeps = true; + + src = fetchFromGitHub { + owner = "ashvardanian"; + repo = "NumKong"; + tag = "v${finalAttrs.version}"; + hash = "sha256-JZafqqq3jDX+iim2DvyuavuvZ0wrPLIU+hcrOiT1L84="; + }; + + nativeBuildInputs = [ cmake ]; + + meta = { + description = "Portable mixed-precision math, linear-algebra, & retrieval library with 2000+ SIMD kernels for x86, Arm, RISC-V, LoongArch, Power, & WebAssembly"; + homepage = "https://github.com/ashvardanian/NumKong/"; + changelog = "https://github.com/ashvardanian/NumKong/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ SuperSandro2000 ]; + }; +}) diff --git a/pkgs/development/python-modules/numkong/default.nix b/pkgs/development/python-modules/numkong/default.nix new file mode 100644 index 000000000000..8c80135f1069 --- /dev/null +++ b/pkgs/development/python-modules/numkong/default.nix @@ -0,0 +1,53 @@ +{ + lib, + buildPythonPackage, + llvmPackages, + ml-dtypes, + numpy, + pkgs, + pytest-repeat, + pytest-xdist, + pytestCheckHook, + scipy, + setuptools, + stdenv, +}: + +buildPythonPackage { + inherit (pkgs.numkong) pname version src; + pyproject = true; + + build-system = [ + setuptools + ]; + + buildInputs = lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp; + + pythonImportsCheck = [ "numkong" ]; + + nativeCheckInputs = [ + numpy + scipy + ml-dtypes + pytest-repeat + pytest-xdist + pytestCheckHook + # there are more tests for big libraries, but we avoid them to not explode the closure size + ]; + + disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [ + # slight floating point error + "test/test_similarities.py::test_cdist_float_accuracy" + "test/test_similarities.py::test_cdist_jaccard" + ]; + + meta = { + inherit (pkgs.numkong.meta) + description + homepage + changelog + license + maintainers + ; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 9940f1ae2498..69c58b40111e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11458,6 +11458,8 @@ self: super: with self; { numexpr = callPackage ../development/python-modules/numexpr { }; + numkong = callPackage ../development/python-modules/numkong { }; + numpy = numpy_2; numpy-financial = callPackage ../development/python-modules/numpy-financial { };