1{ buildPythonPackage
2, fetchPypi
3, python
4, stdenv
5, fetchurl
6, pytest
7, glibcLocales
8, cython
9, dateutil
10, scipy
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 optionalString concatStringsSep;
27 inherit (stdenv) isDarwin;
28in buildPythonPackage rec {
29 pname = "pandas";
30 version = "0.17.1";
31 name = "${pname}-${version}";
32
33 src = fetchPypi {
34 inherit pname version;
35 sha256 = "cfd7214a7223703fe6999fbe34837749540efee1c985e6aee9933f30e3f72837";
36 };
37
38 LC_ALL = "en_US.UTF-8";
39 buildInputs = [ pytest glibcLocales ] ++ optional isDarwin libcxx;
40 propagatedBuildInputs = [
41 cython
42 dateutil
43 scipy
44 numexpr
45 pytz
46 xlrd
47 bottleneck
48 sqlalchemy
49 lxml
50 html5lib
51 beautifulsoup4
52 openpyxl
53 tables
54 xlwt
55 ];
56
57 doCheck = false;
58
59 # For OSX, we need to add a dependency on libcxx, which provides
60 # `complex.h` and other libraries that pandas depends on to build.
61 postPatch = optionalString isDarwin ''
62 cpp_sdk="${libcxx}/include/c++/v1";
63 echo "Adding $cpp_sdk to the setup.py common_include variable"
64 substituteInPlace setup.py \
65 --replace "['pandas/src/klib', 'pandas/src']" \
66 "['pandas/src/klib', 'pandas/src', '$cpp_sdk']"
67 '';
68
69 meta = {
70 # https://github.com/pandas-dev/pandas/issues/14866
71 # pandas devs are no longer testing i686 so safer to assume it's broken
72 broken = stdenv.isi686;
73 homepage = http://pandas.pydata.org/;
74 description = "Python Data Analysis Library";
75 license = stdenv.lib.licenses.bsd3;
76 maintainers = with stdenv.lib.maintainers; [ shlevy ];
77 platforms = stdenv.lib.platforms.unix;
78 };
79}