2024-05-15 15:35:15 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
2024-09-19 14:19:46 +00:00
|
|
|
pythonOlder,
|
|
|
|
|
|
|
|
# build-system
|
2024-05-15 15:35:15 +00:00
|
|
|
cmake,
|
|
|
|
ninja,
|
2024-09-19 14:19:46 +00:00
|
|
|
pathspec,
|
|
|
|
scikit-build-core,
|
|
|
|
|
|
|
|
# dependencies
|
|
|
|
eigen,
|
|
|
|
|
|
|
|
# tests
|
2024-05-15 15:35:15 +00:00
|
|
|
pytestCheckHook,
|
|
|
|
numpy,
|
|
|
|
scipy,
|
|
|
|
torch,
|
2024-09-19 14:19:46 +00:00
|
|
|
tensorflow-bin,
|
2024-05-15 15:35:15 +00:00
|
|
|
jax,
|
|
|
|
jaxlib,
|
|
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "nanobind";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "2.1.0";
|
2024-05-15 15:35:15 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wjakob";
|
2024-06-05 15:53:02 +00:00
|
|
|
repo = "nanobind";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-AO/EHx2TlXidalhPb+xuUchaek4ki7fDExu2foBgUp0=";
|
2024-05-15 15:35:15 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
build-system = [
|
2024-05-15 15:35:15 +00:00
|
|
|
cmake
|
|
|
|
ninja
|
2024-09-19 14:19:46 +00:00
|
|
|
pathspec
|
|
|
|
scikit-build-core
|
2024-05-15 15:35:15 +00:00
|
|
|
];
|
2024-06-05 15:53:02 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
dependencies = [ eigen ];
|
2024-05-15 15:35:15 +00:00
|
|
|
dontUseCmakeBuildDir = true;
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
# build tests
|
|
|
|
make -j $NIX_BUILD_CORES
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
numpy
|
|
|
|
scipy
|
|
|
|
torch
|
2024-09-19 14:19:46 +00:00
|
|
|
tensorflow-bin
|
2024-06-05 15:53:02 +00:00
|
|
|
jax
|
|
|
|
jaxlib
|
2024-05-15 15:35:15 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
meta = {
|
2024-05-15 15:35:15 +00:00
|
|
|
homepage = "https://github.com/wjakob/nanobind";
|
|
|
|
changelog = "https://github.com/wjakob/nanobind/blob/${src.rev}/docs/changelog.rst";
|
|
|
|
description = "Tiny and efficient C++/Python bindings";
|
|
|
|
longDescription = ''
|
|
|
|
nanobind is a small binding library that exposes C++ types in Python and
|
|
|
|
vice versa. It is reminiscent of Boost.Python and pybind11 and uses
|
|
|
|
near-identical syntax. In contrast to these existing tools, nanobind is
|
|
|
|
more efficient: bindings compile in a shorter amount of time, produce
|
|
|
|
smaller binaries, and have better runtime performance.
|
|
|
|
'';
|
2024-06-05 15:53:02 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
maintainers = with lib.maintainers; [ parras ];
|
2024-05-15 15:35:15 +00:00
|
|
|
};
|
|
|
|
}
|