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