nixpkgs/pkgs/development/python-modules/pandas/default.nix

144 lines
3.4 KiB
Nix
Raw Normal View History

2021-03-05 19:52:11 +00:00
{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, python
, isPy38
, beautifulsoup4
, bottleneck
, cython
, python-dateutil
, html5lib
2021-03-05 19:52:11 +00:00
, jinja2
, lxml
, numexpr
, openpyxl
, pytz
, scipy
2021-03-05 19:52:11 +00:00
, sqlalchemy
, tables
, xlrd
, xlwt
2021-03-05 19:52:11 +00:00
# Test inputs
, glibcLocales
, hypothesis
, pytestCheckHook
2021-03-05 19:52:11 +00:00
, pytest-xdist
, pytest-asyncio
, XlsxWriter
# Darwin inputs
, runtimeShell
2021-03-05 19:52:11 +00:00
, libcxx
}:
buildPythonPackage rec {
pname = "pandas";
2021-06-18 21:47:28 +00:00
version = "1.2.4";
src = fetchPypi {
inherit pname version;
2021-06-18 21:47:28 +00:00
sha256 = "649ecab692fade3cbfcf967ff936496b0cfba0af00a55dfaacd82bdda5cb2279";
};
2019-02-14 07:37:22 +00:00
nativeBuildInputs = [ cython ];
2021-03-05 19:52:11 +00:00
buildInputs = lib.optional stdenv.isDarwin libcxx;
2021-03-05 19:52:11 +00:00
propagatedBuildInputs = [
beautifulsoup4
bottleneck
python-dateutil
html5lib
numexpr
lxml
openpyxl
pytz
scipy
sqlalchemy
tables
xlrd
xlwt
];
2021-03-05 19:52:11 +00:00
checkInputs = [
glibcLocales
hypothesis
jinja2
pytest-asyncio
pytest-xdist
pytestCheckHook
XlsxWriter
];
2021-03-05 19:52:11 +00:00
# Doesn't work with -Werror,-Wunused-command-line-argument
# https://github.com/NixOS/nixpkgs/issues/39687
hardeningDisable = lib.optional stdenv.cc.isClang "strictoverflow";
2021-03-05 19:52:11 +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.
postPatch = lib.optionalString stdenv.isDarwin ''
cpp_sdk="${lib.getDev libcxx}/include/c++/v1";
2021-03-05 19:52:11 +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']"
'';
2020-03-20 15:50:40 +00:00
doCheck = !stdenv.isAarch64; # upstream doesn't test this architecture
2018-06-23 09:48:06 +00:00
pytestFlagsArray = [
"--skip-slow"
"--skip-network"
2021-03-05 19:52:11 +00:00
"--numprocesses" "0"
];
2021-03-05 19:52:11 +00:00
disabledTests = [
2018-06-23 09:48:06 +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-05 19:52:11 +00:00
# Tries to import from pandas.tests post install
"util_in_top_level"
2021-03-05 19:52:11 +00:00
# Tries to import compiled C extension locally
2020-11-06 04:01:03 +00:00
"test_missing_required_dependency"
2021-03-05 19:52:11 +00:00
# AssertionError with 1.2.3
"test_from_coo"
] ++ lib.optionals stdenv.isDarwin [
2018-06-23 09:48:06 +00:00
"test_locale"
"test_clipboard"
];
2021-03-05 19:52:11 +00:00
# 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"
2020-11-06 04:01:03 +00:00
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
'';
2021-03-05 19:52:11 +00:00
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;
};
}