2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, absl-py
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, jaxlib
|
|
|
|
, numpy
|
|
|
|
, opt-einsum
|
|
|
|
, pytestCheckHook
|
2022-02-20 05:27:41 +00:00
|
|
|
, pytest-xdist
|
2021-12-06 16:07:01 +00:00
|
|
|
, pythonOlder
|
|
|
|
, scipy
|
|
|
|
, typing-extensions
|
2021-09-18 10:52:07 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "jax";
|
2022-02-20 05:27:41 +00:00
|
|
|
version = "0.3.1";
|
2021-12-06 16:07:01 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = pname;
|
2021-12-30 13:39:12 +00:00
|
|
|
rev = "${pname}-v${version}";
|
2022-02-20 05:27:41 +00:00
|
|
|
sha256 = "0bpqmyc4hg25i8cfnrx3y2bwgp6h5rri2a1q9i8gb6r0id97zvcn";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
|
2021-12-30 13:39:12 +00:00
|
|
|
patches = [
|
|
|
|
# See https://github.com/google/jax/issues/7944
|
|
|
|
./cache-fix.patch
|
|
|
|
];
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
# jaxlib is _not_ included in propagatedBuildInputs because there are
|
|
|
|
# different versions of jaxlib depending on the desired target hardware. The
|
|
|
|
# JAX project ships separate wheels for CPU, GPU, and TPU. Currently only the
|
|
|
|
# CPU wheel is packaged.
|
2021-12-06 16:07:01 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
absl-py
|
|
|
|
numpy
|
|
|
|
opt-einsum
|
|
|
|
scipy
|
|
|
|
typing-extensions
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
jaxlib
|
|
|
|
pytestCheckHook
|
2022-02-20 05:27:41 +00:00
|
|
|
pytest-xdist
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
# NOTE: Don't run the tests in the expiremental directory as they require flax
|
|
|
|
# which creates a circular dependency. See https://discourse.nixos.org/t/how-to-nix-ify-python-packages-with-circular-dependencies/14648/2.
|
|
|
|
# Not a big deal, this is how the JAX docs suggest running the test suite
|
|
|
|
# anyhow.
|
2021-12-06 16:07:01 +00:00
|
|
|
pytestFlagsArray = [
|
2022-02-20 05:27:41 +00:00
|
|
|
"-n auto"
|
2021-12-06 16:07:01 +00:00
|
|
|
"-W ignore::DeprecationWarning"
|
|
|
|
"tests/"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"jax"
|
|
|
|
];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Differentiate, compile, and transform Numpy code";
|
2021-12-06 16:07:01 +00:00
|
|
|
homepage = "https://github.com/google/jax";
|
|
|
|
license = licenses.asl20;
|
2021-09-18 10:52:07 +00:00
|
|
|
maintainers = with maintainers; [ samuela ];
|
|
|
|
};
|
|
|
|
}
|