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