diff --git a/pkgs/development/python-modules/netket/default.nix b/pkgs/development/python-modules/netket/default.nix new file mode 100644 index 0000000000000..144679e5f3080 --- /dev/null +++ b/pkgs/development/python-modules/netket/default.nix @@ -0,0 +1,111 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools-scm, + hatchling, + hatch-vcs, + jax, + jaxlib, + numpy, + scipy, + tqdm, + numba, + igraph, + flax, + orjson, + optax, + beartype, + rich, + equinox, + plum-dispatch, + sparse, + einops, + pytestCheckHook, + pytest-xdist, + pytest-cov-stub, + pytest-json-report, + qutip, + networkx, + matplotlib, + pyscf, + tensorboardx, + h5py, +}: + +buildPythonPackage (finalAttrs: { + pname = "netket"; + version = "3.21.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "netket"; + repo = "netket"; + tag = "v${finalAttrs.version}"; + hash = "sha256-jpF3OoVDkGvns2XU3kyfCSjh/Nkqj6R5GKAGqWchrTg="; + }; + + build-system = [ + setuptools-scm + hatchling + hatch-vcs + ]; + + dependencies = [ + jax + jaxlib + numpy + scipy + tqdm + numba + igraph + flax + orjson + optax + beartype + rich + equinox + plum-dispatch + sparse + einops + ]; + + optional-dependencies = { + pyscf = [ pyscf ]; + extra = [ + tensorboardx + #openfermion # not packaged yet + h5py + qutip + ]; + }; + + doCheck = false; # tests use up my ram, and they fail anyway + + nativeCheckInputs = [ + pytestCheckHook + pytest-xdist + pytest-cov-stub + pytest-json-report + networkx + matplotlib + ]; + + # https://github.com/netket/netket/blob/v3.21.0/.github/workflows/CI.yml#L81-L83 + env.NETKET_EXPERIMENTAL = "1"; + pytestFlags = [ + "--jax-cpu-disable-async-dispatch" + "--clear-cache-every" + "200" + ]; + + pythonImportsCheck = [ "netket" ]; + + meta = { + homepage = "https://www.netket.org"; + changelog = "https://github.com/netket/netket/blob/v${finalAttrs.version}/CHANGELOG.md"; + description = "Machine-learning toolbox for quantum physics"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ ulysseszhan ]; + }; +}) diff --git a/pkgs/development/python-modules/plum-dispatch/default.nix b/pkgs/development/python-modules/plum-dispatch/default.nix new file mode 100644 index 0000000000000..47084c0356ed0 --- /dev/null +++ b/pkgs/development/python-modules/plum-dispatch/default.nix @@ -0,0 +1,65 @@ +{ + lib, + stdenv, + buildPythonPackage, + pythonAtLeast, + fetchPypi, + hatch, + hatch-vcs, + hatch-mypyc, + ipython, + numpy, + pytestCheckHook, + pytest-cov-stub, + sybil, + beartype, + typing-extensions, + rich, +}: + +buildPythonPackage (finalAttrs: { + pname = "plum-dispatch"; + version = "2.8.0"; + pyproject = true; + + src = fetchPypi { + pname = "plum_dispatch"; + inherit (finalAttrs) version; + hash = "sha256-RT/HvGfSo5SSyDSwDJTYFocdFItaCl0/SeK78jkeJhk="; + }; + + # https://github.com/beartype/plum/pull/225 + disabled = pythonAtLeast "3.14"; + + build-system = [ + hatch + hatch-vcs + hatch-mypyc + ]; + + dependencies = [ + beartype + typing-extensions + rich + ]; + + nativeCheckInputs = [ + pytestCheckHook + ipython + numpy + pytest-cov-stub + sybil + ]; + + disabledTests = lib.optional stdenv.hostPlatform.isDarwin "test_methodlist_repr"; + + pythonImportsCheck = [ "plum" ]; + + meta = { + homepage = "https://beartype.github.io/plum"; + changelog = "https://github.com/beartype/plum/releases/tag/v${finalAttrs.version}"; + description = "Multiple dispatch in Python"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ ulysseszhan ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 8a21ae262dab2..1d403b3da5a07 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10990,6 +10990,8 @@ self: super: with self; { netio = callPackage ../development/python-modules/netio { }; + netket = callPackage ../development/python-modules/netket { }; + netmap = callPackage ../development/python-modules/netmap { }; netmiko = callPackage ../development/python-modules/netmiko { }; @@ -12630,6 +12632,8 @@ self: super: with self; { plugwise = callPackage ../development/python-modules/plugwise { }; + plum-dispatch = callPackage ../development/python-modules/plum-dispatch { }; + plum-py = callPackage ../development/python-modules/plum-py { }; plumbum = callPackage ../development/python-modules/plumbum { };