2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-11-19 00:13:47 +00:00
|
|
|
, buildPythonPackage
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchPypi
|
|
|
|
, python
|
|
|
|
, cython
|
2021-12-06 16:07:01 +00:00
|
|
|
, numpy
|
2021-07-04 02:40:35 +00:00
|
|
|
, python-dateutil
|
2020-04-24 23:36:52 +00:00
|
|
|
, pytz
|
2020-11-19 00:13:47 +00:00
|
|
|
, scipy
|
2021-03-09 03:18:52 +00:00
|
|
|
, sqlalchemy
|
2020-04-24 23:36:52 +00:00
|
|
|
, tables
|
2020-11-19 00:13:47 +00:00
|
|
|
, xlrd
|
2020-04-24 23:36:52 +00:00
|
|
|
, xlwt
|
2021-03-09 03:18:52 +00:00
|
|
|
# Test inputs
|
2020-11-19 00:13:47 +00:00
|
|
|
, glibcLocales
|
|
|
|
, hypothesis
|
2021-12-06 16:07:01 +00:00
|
|
|
, jinja2
|
2020-11-19 00:13:47 +00:00
|
|
|
, pytestCheckHook
|
2021-03-09 03:18:52 +00:00
|
|
|
, pytest-xdist
|
|
|
|
, pytest-asyncio
|
|
|
|
, XlsxWriter
|
2020-11-19 00:13:47 +00:00
|
|
|
# Darwin inputs
|
2020-04-24 23:36:52 +00:00
|
|
|
, runtimeShell
|
2021-03-09 03:18:52 +00:00
|
|
|
, libcxx
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "pandas";
|
2022-04-15 01:41:22 +00:00
|
|
|
version = "1.4.1";
|
2021-12-26 17:43:05 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-04-15 01:41:22 +00:00
|
|
|
sha256 = "sha256-jbk+yYrHy1+KwUIMEPXjxDUzFT8lP+f7bYkc9aorgNI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cython ];
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
buildInputs = lib.optional stdenv.isDarwin libcxx;
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2021-12-06 16:07:01 +00:00
|
|
|
numpy
|
2021-07-04 02:40:35 +00:00
|
|
|
python-dateutil
|
2020-11-19 00:13:47 +00:00
|
|
|
pytz
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
checkInputs = [
|
|
|
|
glibcLocales
|
|
|
|
hypothesis
|
|
|
|
jinja2
|
|
|
|
pytest-asyncio
|
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
|
|
|
XlsxWriter
|
|
|
|
];
|
2020-11-19 00:13:47 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
# Doesn't work with -Werror,-Wunused-command-line-argument
|
2020-09-25 04:45:31 +00:00
|
|
|
# https://github.com/NixOS/nixpkgs/issues/39687
|
2021-02-05 17:12:51 +00:00
|
|
|
hardeningDisable = lib.optional stdenv.cc.isClang "strictoverflow";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# For OSX, we need to add a dependency on libcxx, which provides
|
|
|
|
# `complex.h` and other libraries that pandas depends on to build.
|
2021-02-05 17:12:51 +00:00
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
2021-05-20 23:08:51 +00:00
|
|
|
cpp_sdk="${lib.getDev libcxx}/include/c++/v1";
|
2020-04-24 23:36:52 +00:00
|
|
|
echo "Adding $cpp_sdk to the setup.py common_include variable"
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "['pandas/src/klib', 'pandas/src']" \
|
|
|
|
"['pandas/src/klib', 'pandas/src', '$cpp_sdk']"
|
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
doCheck = !stdenv.isAarch32 && !stdenv.isAarch64; # upstream doesn't test this architecture
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-19 00:13:47 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
"--skip-slow"
|
|
|
|
"--skip-network"
|
2021-03-09 03:18:52 +00:00
|
|
|
"--numprocesses" "0"
|
2020-11-19 00:13:47 +00:00
|
|
|
];
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2020-11-19 00:13:47 +00:00
|
|
|
disabledTests = [
|
2020-04-24 23:36:52 +00:00
|
|
|
# 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"
|
2021-03-09 03:18:52 +00:00
|
|
|
# Tries to import from pandas.tests post install
|
2020-04-24 23:36:52 +00:00
|
|
|
"util_in_top_level"
|
2021-03-09 03:18:52 +00:00
|
|
|
# Tries to import compiled C extension locally
|
2020-11-19 00:13:47 +00:00
|
|
|
"test_missing_required_dependency"
|
2021-03-09 03:18:52 +00:00
|
|
|
# AssertionError with 1.2.3
|
|
|
|
"test_from_coo"
|
2021-09-26 12:46:18 +00:00
|
|
|
# AssertionError: No common DType exists for the given inputs
|
|
|
|
"test_comparison_invalid"
|
2021-12-26 17:43:05 +00:00
|
|
|
# AssertionError: Regex pattern '"quotechar" must be string, not int'
|
|
|
|
"python-kwargs2"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2020-04-24 23:36:52 +00:00
|
|
|
"test_locale"
|
|
|
|
"test_clipboard"
|
2020-11-19 00:13:47 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
# Tests have relative paths, and need to reference compiled C extensions
|
2021-01-15 22:18:51 +00:00
|
|
|
# so change directory where `import .test` is able to be resolved
|
2020-11-19 00:13:47 +00:00
|
|
|
preCheck = ''
|
2021-01-15 22:18:51 +00:00
|
|
|
cd $out/${python.sitePackages}/pandas
|
2020-11-19 00:13:47 +00:00
|
|
|
export LC_ALL="en_US.UTF-8"
|
|
|
|
PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH
|
2020-04-24 23:36:52 +00:00
|
|
|
''
|
|
|
|
# TODO: Get locale and clipboard support working on darwin.
|
|
|
|
# Until then we disable the tests.
|
2021-02-05 17:12:51 +00:00
|
|
|
+ lib.optionalString stdenv.isDarwin ''
|
2020-04-24 23:36:52 +00:00
|
|
|
# Fake the impure dependencies pbpaste and pbcopy
|
|
|
|
echo "#!${runtimeShell}" > pbcopy
|
|
|
|
echo "#!${runtimeShell}" > pbpaste
|
|
|
|
chmod a+x pbcopy pbpaste
|
|
|
|
export PATH=$(pwd):$PATH
|
|
|
|
'';
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
pythonImportsCheck = [ "pandas" ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
# 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/";
|
2020-11-19 00:13:47 +00:00
|
|
|
changelog = "https://pandas.pydata.org/docs/whatsnew/index.html";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Python Data Analysis Library";
|
2020-11-19 00:13:47 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ raskin fridh knedlsepp ];
|
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|