at 18.09-beta 3.0 kB view raw
1{ buildPythonPackage 2, fetchPypi 3, python 4, stdenv 5, pytest 6, glibcLocales 7, cython 8, dateutil 9, scipy 10, moto 11, numexpr 12, pytz 13, xlrd 14, bottleneck 15, sqlalchemy 16, lxml 17, html5lib 18, beautifulsoup4 19, openpyxl 20, tables 21, xlwt 22, libcxx ? null 23}: 24 25let 26 inherit (stdenv.lib) optional optionals optionalString; 27 inherit (stdenv) isDarwin; 28 29in buildPythonPackage rec { 30 pname = "pandas"; 31 version = "0.23.4"; 32 33 src = fetchPypi { 34 inherit pname version; 35 sha256 = "5b24ca47acf69222e82530e89111dd9d14f9b970ab2cd3a1c2c78f0c4fbba4f4"; 36 }; 37 38 checkInputs = [ pytest glibcLocales moto ]; 39 40 buildInputs = [] ++ optional isDarwin libcxx; 41 propagatedBuildInputs = [ 42 cython 43 dateutil 44 scipy 45 numexpr 46 pytz 47 xlrd 48 bottleneck 49 sqlalchemy 50 lxml 51 html5lib 52 beautifulsoup4 53 openpyxl 54 tables 55 xlwt 56 ]; 57 58 # For OSX, we need to add a dependency on libcxx, which provides 59 # `complex.h` and other libraries that pandas depends on to build. 60 postPatch = optionalString isDarwin '' 61 cpp_sdk="${libcxx}/include/c++/v1"; 62 echo "Adding $cpp_sdk to the setup.py common_include variable" 63 substituteInPlace setup.py \ 64 --replace "['pandas/src/klib', 'pandas/src']" \ 65 "['pandas/src/klib', 'pandas/src', '$cpp_sdk']" 66 ''; 67 68 69 disabledTests = stdenv.lib.concatMapStringsSep " and " (s: "not " + s) ([ 70 # since dateutil 0.6.0 the following fails: test_fallback_plural, test_ambiguous_flags, test_ambiguous_compat 71 # was supposed to be solved by https://github.com/dateutil/dateutil/issues/321, but is not the case 72 "test_fallback_plural" 73 "test_ambiguous_flags" 74 "test_ambiguous_compat" 75 # Locale-related 76 "test_names" 77 "test_dt_accessor_datetime_name_accessors" 78 "test_datetime_name_accessors" 79 # Can't import from test folder 80 "test_oo_optimizable" 81 # Disable IO related tests because IO data is no longer distributed 82 "io" 83 # KeyError Timestamp 84 "test_to_excel" 85 ] ++ optionals isDarwin [ 86 "test_locale" 87 "test_clipboard" 88 ]); 89 90 checkPhase = '' 91 runHook preCheck 92 '' 93 # TODO: Get locale and clipboard support working on darwin. 94 # Until then we disable the tests. 95 + optionalString isDarwin '' 96 # Fake the impure dependencies pbpaste and pbcopy 97 echo "#!/bin/sh" > pbcopy 98 echo "#!/bin/sh" > pbpaste 99 chmod a+x pbcopy pbpaste 100 export PATH=$(pwd):$PATH 101 '' + '' 102 LC_ALL="en_US.UTF-8" py.test $out/${python.sitePackages}/pandas --skip-slow --skip-network -k "$disabledTests" 103 runHook postCheck 104 ''; 105 106 meta = { 107 # https://github.com/pandas-dev/pandas/issues/14866 108 # pandas devs are no longer testing i686 so safer to assume it's broken 109 broken = stdenv.isi686; 110 homepage = http://pandas.pydata.org/; 111 description = "Python Data Analysis Library"; 112 license = stdenv.lib.licenses.bsd3; 113 maintainers = with stdenv.lib.maintainers; [ raskin fridh knedlsepp ]; 114 platforms = stdenv.lib.platforms.unix; 115 }; 116}