nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, python
6, cython
7, numpy
8, python-dateutil
9, pytz
10, scipy
11, sqlalchemy
12, tables
13, xlrd
14, xlwt
15# Test inputs
16, glibcLocales
17, hypothesis
18, jinja2
19, pytestCheckHook
20, pytest-xdist
21, pytest-asyncio
22, XlsxWriter
23# Darwin inputs
24, runtimeShell
25, libcxx
26}:
27
28buildPythonPackage rec {
29 pname = "pandas";
30 version = "1.4.2";
31 format = "setuptools";
32
33 src = fetchPypi {
34 inherit pname version;
35 sha256 = "sha256-krwfxYXxRjyoJ7RVNZV4FbfeshjFSbfBhALDIsdUmhI=";
36 };
37
38 nativeBuildInputs = [ cython ];
39
40 buildInputs = lib.optional stdenv.isDarwin libcxx;
41
42 propagatedBuildInputs = [
43 numpy
44 python-dateutil
45 pytz
46 ];
47
48 checkInputs = [
49 glibcLocales
50 hypothesis
51 jinja2
52 pytest-asyncio
53 pytest-xdist
54 pytestCheckHook
55 XlsxWriter
56 ];
57
58 # Doesn't work with -Werror,-Wunused-command-line-argument
59 # https://github.com/NixOS/nixpkgs/issues/39687
60 hardeningDisable = lib.optional stdenv.cc.isClang "strictoverflow";
61
62 doCheck = !stdenv.isAarch32 && !stdenv.isAarch64; # upstream doesn't test this architecture
63
64 # don't max out build cores, it breaks tests
65 dontUsePytestXdist = true;
66
67 pytestFlagsArray = [
68 # https://github.com/pandas-dev/pandas/blob/main/test_fast.sh
69 "--skip-db"
70 "--skip-slow"
71 "--skip-network"
72 "-m" "'not single_cpu'"
73 "--numprocesses" "4"
74 ];
75
76 disabledTests = [
77 # Locale-related
78 "test_names"
79 "test_dt_accessor_datetime_name_accessors"
80 "test_datetime_name_accessors"
81 # Disable IO related tests because IO data is no longer distributed
82 "io"
83 # Tries to import from pandas.tests post install
84 "util_in_top_level"
85 # Tries to import compiled C extension locally
86 "test_missing_required_dependency"
87 # AssertionError with 1.2.3
88 "test_from_coo"
89 # AssertionError: No common DType exists for the given inputs
90 "test_comparison_invalid"
91 # AssertionError: Regex pattern '"quotechar" must be string, not int'
92 "python-kwargs2"
93 ] ++ lib.optionals stdenv.isDarwin [
94 "test_locale"
95 "test_clipboard"
96 # ValueError: cannot reindex on an axis with duplicate labels
97 #
98 # Attempts to reproduce this problem outside of Hydra failed.
99 "test_reindex_timestamp_with_fold"
100 ];
101
102 # Tests have relative paths, and need to reference compiled C extensions
103 # so change directory where `import .test` is able to be resolved
104 preCheck = ''
105 cd $out/${python.sitePackages}/pandas
106 export LC_ALL="en_US.UTF-8"
107 PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH
108 ''
109 # TODO: Get locale and clipboard support working on darwin.
110 # Until then we disable the tests.
111 + lib.optionalString stdenv.isDarwin ''
112 # Fake the impure dependencies pbpaste and pbcopy
113 echo "#!${runtimeShell}" > pbcopy
114 echo "#!${runtimeShell}" > pbpaste
115 chmod a+x pbcopy pbpaste
116 export PATH=$(pwd):$PATH
117 '';
118
119 enableParallelBuilding = true;
120
121 pythonImportsCheck = [ "pandas" ];
122
123 meta = with lib; {
124 # https://github.com/pandas-dev/pandas/issues/14866
125 # pandas devs are no longer testing i686 so safer to assume it's broken
126 broken = stdenv.isi686;
127 homepage = "https://pandas.pydata.org/";
128 changelog = "https://pandas.pydata.org/docs/whatsnew/index.html";
129 description = "Python Data Analysis Library";
130 license = licenses.bsd3;
131 maintainers = with maintainers; [ raskin fridh knedlsepp ];
132 platforms = platforms.unix;
133 };
134}