e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
99 lines
1.8 KiB
Nix
99 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
absl-py,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
|
|
# build-system
|
|
flit-core,
|
|
|
|
# dependencies
|
|
etils,
|
|
humanize,
|
|
importlib-resources,
|
|
jax,
|
|
jaxlib,
|
|
msgpack,
|
|
nest-asyncio,
|
|
numpy,
|
|
protobuf,
|
|
pyyaml,
|
|
tensorstore,
|
|
typing-extensions,
|
|
|
|
# tests
|
|
chex,
|
|
google-cloud-logging,
|
|
mock,
|
|
pytest-xdist,
|
|
pytestCheckHook,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "orbax-checkpoint";
|
|
version = "0.6.4";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "google";
|
|
repo = "orbax";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-xd75/AKBFUdA6a8sQnCB2rVbHl/Foy4LTb07jnwrTjA=";
|
|
};
|
|
|
|
sourceRoot = "${src.name}/checkpoint";
|
|
|
|
build-system = [ flit-core ];
|
|
|
|
dependencies = [
|
|
absl-py
|
|
etils
|
|
humanize
|
|
importlib-resources
|
|
jax
|
|
jaxlib
|
|
msgpack
|
|
nest-asyncio
|
|
numpy
|
|
protobuf
|
|
pyyaml
|
|
tensorstore
|
|
typing-extensions
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
chex
|
|
google-cloud-logging
|
|
mock
|
|
pytest-xdist
|
|
pytestCheckHook
|
|
];
|
|
|
|
pythonImportsCheck = [
|
|
"orbax"
|
|
"orbax.checkpoint"
|
|
];
|
|
|
|
disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
# Probably failing because of a filesystem impurity
|
|
# self.assertFalse(os.path.exists(dst_dir))
|
|
# AssertionError: True is not false
|
|
"test_create_snapshot"
|
|
];
|
|
|
|
disabledTestPaths = [
|
|
# Circular dependency flax
|
|
"orbax/checkpoint/transform_utils_test.py"
|
|
"orbax/checkpoint/utils_test.py"
|
|
];
|
|
|
|
meta = {
|
|
description = "Orbax provides common utility libraries for JAX users";
|
|
homepage = "https://github.com/google/orbax/tree/main/checkpoint";
|
|
changelog = "https://github.com/google/orbax/releases/tag/v${version}";
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [ fab ];
|
|
};
|
|
}
|