1{ 2 absl-py, 3 buildPythonPackage, 4 contextlib2, 5 fetchPypi, 6 fetchurl, 7 lib, 8 pyyaml, 9}: 10 11let 12 requirements = fetchurl { 13 url = "https://raw.githubusercontent.com/google/ml_collections/7f749a281c69f9d0b339c05ecb94b80d95029f25/requirements.txt"; 14 sha256 = "1xb351hiscj4zmajfkql3swpacdp6lmz8iwdvwwdx2zqw9a62zps"; 15 }; 16 requirements-test = fetchurl { 17 url = "https://raw.githubusercontent.com/google/ml_collections/7f749a281c69f9d0b339c05ecb94b80d95029f25/requirements-test.txt"; 18 sha256 = "0r457k2nrg5jkf093r0x29yf8xwy6l7jxi6al0fh7mmnfrhr9cb1"; 19 }; 20in 21buildPythonPackage rec { 22 pname = "ml-collections"; 23 version = "0.1.1"; 24 format = "setuptools"; 25 26 # ml-collections does not have any git release tags. See https://github.com/google/ml_collections/issues/8. 27 src = fetchPypi { 28 inherit version; 29 pname = "ml_collections"; 30 hash = "sha256-P+/McuxDOqHl0yMHo+R0u7Z/QFvoFOpSohZr/J2+aMw="; 31 }; 32 33 # The pypi source archive does not include requirements.txt or 34 # requirements-test.txt. See https://github.com/google/ml_collections/issues/7. 35 postPatch = '' 36 cp ${requirements} requirements.txt 37 cp ${requirements-test} requirements-test.txt 38 ''; 39 40 propagatedBuildInputs = [ 41 absl-py 42 contextlib2 43 pyyaml 44 ]; 45 46 # The official test suite uses bazel. With pytestCheckHook there are name 47 # conflicts between files and tests have assumptions that are broken by the 48 # nix-build environment, eg. re module names and __file__ attributes. 49 doCheck = false; 50 51 pythonImportsCheck = [ "ml_collections" ]; 52 53 meta = with lib; { 54 description = "ML Collections is a library of Python collections designed for ML usecases."; 55 homepage = "https://github.com/google/ml_collections"; 56 license = licenses.asl20; 57 maintainers = with maintainers; [ samuela ]; 58 }; 59}