2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-11-19 00:13:47 +00:00
|
|
|
, buildPythonPackage
|
2023-11-16 04:20:00 +00:00
|
|
|
, fetchFromGitHub
|
2024-01-13 08:15:51 +00:00
|
|
|
, pythonAtLeast
|
2022-09-30 11:47:45 +00:00
|
|
|
, pythonOlder
|
2023-08-10 07:59:29 +00:00
|
|
|
|
|
|
|
# build-system
|
2024-04-21 15:54:59 +00:00
|
|
|
, cython
|
2023-11-16 04:20:00 +00:00
|
|
|
, meson-python
|
|
|
|
, meson
|
2023-10-09 19:29:22 +00:00
|
|
|
, oldest-supported-numpy
|
2023-11-16 04:20:00 +00:00
|
|
|
, pkg-config
|
2023-08-10 07:59:29 +00:00
|
|
|
, versioneer
|
2023-10-09 19:29:22 +00:00
|
|
|
, wheel
|
2023-08-10 07:59:29 +00:00
|
|
|
|
|
|
|
# propagates
|
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
|
2023-08-10 07:59:29 +00:00
|
|
|
, tzdata
|
|
|
|
|
|
|
|
# optionals
|
|
|
|
, beautifulsoup4
|
|
|
|
, bottleneck
|
|
|
|
, blosc2
|
|
|
|
, fsspec
|
|
|
|
, gcsfs
|
|
|
|
, html5lib
|
|
|
|
, jinja2
|
|
|
|
, lxml
|
|
|
|
, matplotlib
|
|
|
|
, numba
|
|
|
|
, numexpr
|
|
|
|
, odfpy
|
|
|
|
, openpyxl
|
|
|
|
, psycopg2
|
|
|
|
, pyarrow
|
|
|
|
, pymysql
|
|
|
|
, pyqt5
|
|
|
|
, pyreadstat
|
|
|
|
, qtpy
|
|
|
|
, s3fs
|
|
|
|
, scipy
|
|
|
|
, sqlalchemy
|
|
|
|
, tables
|
|
|
|
, tabulate
|
|
|
|
, xarray
|
|
|
|
, xlrd
|
|
|
|
, xlsxwriter
|
|
|
|
, zstandard
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, adv_cmds
|
|
|
|
, glibc
|
2020-11-19 00:13:47 +00:00
|
|
|
, glibcLocales
|
|
|
|
, hypothesis
|
|
|
|
, pytestCheckHook
|
2021-03-09 03:18:52 +00:00
|
|
|
, pytest-xdist
|
|
|
|
, pytest-asyncio
|
2023-08-10 07:59:29 +00:00
|
|
|
, python
|
2020-04-24 23:36:52 +00:00
|
|
|
, runtimeShell
|
|
|
|
}:
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
let pandas = buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "pandas";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "2.2.1";
|
2023-11-16 04:20:00 +00:00
|
|
|
pyproject = true;
|
2023-08-10 07:59:29 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
disabled = pythonOlder "3.9";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pandas-dev";
|
|
|
|
repo = "pandas";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-eyVUIYG0KCAEJbh/qZiEjGpdXq7A+2Lab+5bp+7t4cw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
2024-02-29 20:09:43 +00:00
|
|
|
--replace-fail "Cython==3.0.5" "Cython>=3.0.5" \
|
|
|
|
--replace-fail "meson-python==0.13.1" "meson-python>=0.13.1" \
|
|
|
|
--replace-fail "meson==1.2.1" "meson>=1.2.1"
|
2023-11-16 04:20:00 +00:00
|
|
|
'';
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
nativeBuildInputs = [
|
2024-04-21 15:54:59 +00:00
|
|
|
cython
|
2023-11-16 04:20:00 +00:00
|
|
|
meson-python
|
|
|
|
meson
|
2023-08-10 07:59:29 +00:00
|
|
|
numpy
|
2023-11-16 04:20:00 +00:00
|
|
|
pkg-config
|
2023-08-10 07:59:29 +00:00
|
|
|
versioneer
|
2023-10-09 19:29:22 +00:00
|
|
|
wheel
|
2023-11-16 04:20:00 +00:00
|
|
|
]
|
|
|
|
++ versioneer.optional-dependencies.toml
|
|
|
|
++ lib.optionals (pythonOlder "3.12") [
|
|
|
|
oldest-supported-numpy
|
|
|
|
];
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
enableParallelBuilding = true;
|
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
|
2023-08-10 07:59:29 +00:00
|
|
|
tzdata
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
passthru.optional-dependencies = let
|
|
|
|
extras = {
|
|
|
|
aws = [
|
|
|
|
s3fs
|
|
|
|
];
|
|
|
|
clipboard = [
|
|
|
|
pyqt5
|
|
|
|
qtpy
|
|
|
|
];
|
|
|
|
compression = [
|
|
|
|
zstandard
|
|
|
|
];
|
|
|
|
computation = [
|
|
|
|
scipy
|
|
|
|
xarray
|
|
|
|
];
|
|
|
|
excel = [
|
|
|
|
odfpy
|
|
|
|
openpyxl
|
|
|
|
# TODO: pyxlsb
|
|
|
|
xlrd
|
|
|
|
xlsxwriter
|
|
|
|
];
|
|
|
|
feather = [
|
|
|
|
pyarrow
|
|
|
|
];
|
|
|
|
fss = [
|
|
|
|
fsspec
|
|
|
|
];
|
|
|
|
gcp = [
|
|
|
|
gcsfs
|
|
|
|
# TODO: pandas-gqb
|
|
|
|
];
|
|
|
|
hdf5 = [
|
|
|
|
blosc2
|
|
|
|
tables
|
|
|
|
];
|
|
|
|
html = [
|
|
|
|
beautifulsoup4
|
|
|
|
html5lib
|
|
|
|
lxml
|
|
|
|
];
|
|
|
|
mysql = [
|
|
|
|
sqlalchemy
|
|
|
|
pymysql
|
|
|
|
];
|
|
|
|
output_formatting = [
|
|
|
|
jinja2
|
|
|
|
tabulate
|
|
|
|
];
|
|
|
|
parquet = [
|
|
|
|
pyarrow
|
|
|
|
];
|
|
|
|
performance = [
|
|
|
|
bottleneck
|
|
|
|
numba
|
|
|
|
numexpr
|
|
|
|
];
|
|
|
|
plot = [
|
|
|
|
matplotlib
|
|
|
|
];
|
|
|
|
postgresql = [
|
|
|
|
sqlalchemy
|
|
|
|
psycopg2
|
|
|
|
];
|
|
|
|
spss = [
|
|
|
|
pyreadstat
|
|
|
|
];
|
|
|
|
sql-other = [
|
|
|
|
sqlalchemy
|
|
|
|
];
|
|
|
|
xml = [
|
|
|
|
lxml
|
|
|
|
];
|
|
|
|
};
|
|
|
|
in extras // {
|
|
|
|
all = lib.concatLists (lib.attrValues extras);
|
|
|
|
};
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
doCheck = false; # various infinite recursions
|
|
|
|
|
|
|
|
passthru.tests.pytest = pandas.overridePythonAttrs (_: { doCheck = true; });
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-03-09 03:18:52 +00:00
|
|
|
glibcLocales
|
2023-07-15 17:15:38 +00:00
|
|
|
hypothesis
|
2021-03-09 03:18:52 +00:00
|
|
|
pytest-asyncio
|
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
2024-01-13 08:15:51 +00:00
|
|
|
]
|
|
|
|
++ lib.flatten (lib.attrValues passthru.optional-dependencies)
|
|
|
|
++ lib.optionals (stdenv.isLinux) [
|
2023-08-10 07:59:29 +00:00
|
|
|
# for locale executable
|
|
|
|
glibc
|
2024-01-13 08:15:51 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals (stdenv.isDarwin) [
|
2023-08-10 07:59:29 +00:00
|
|
|
# for locale executable
|
|
|
|
adv_cmds
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
2020-11-19 00:13:47 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
# don't max out build cores, it breaks tests
|
|
|
|
dontUsePytestXdist = true;
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2020-11-19 00:13:47 +00:00
|
|
|
pytestFlagsArray = [
|
2022-04-27 09:35:20 +00:00
|
|
|
# https://github.com/pandas-dev/pandas/blob/main/test_fast.sh
|
2023-11-16 04:20:00 +00:00
|
|
|
"-m" "'not single_cpu and not slow and not network and not db and not slow_arm'"
|
|
|
|
# https://github.com/pandas-dev/pandas/issues/54907
|
|
|
|
"--no-strict-data-files"
|
2022-04-27 09:35:20 +00:00
|
|
|
"--numprocesses" "4"
|
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 = [
|
2023-08-10 07:59:29 +00:00
|
|
|
# AssertionError: Did not see expected warning of class 'FutureWarning'
|
|
|
|
"test_parsing_tzlocal_deprecated"
|
|
|
|
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
|
|
|
# tests/generic/test_finalize.py::test_binops[and_-args4-right] - AssertionError: assert {} == {'a': 1}
|
|
|
|
"test_binops"
|
2023-10-09 19:29:22 +00:00
|
|
|
# These tests are unreliable on aarch64-darwin. See https://github.com/pandas-dev/pandas/issues/38921.
|
|
|
|
"test_rolling"
|
2023-11-16 04:20:00 +00:00
|
|
|
] ++ lib.optional stdenv.is32bit [
|
|
|
|
# https://github.com/pandas-dev/pandas/issues/37398
|
|
|
|
"test_rolling_var_numerical_issues"
|
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 = ''
|
2023-08-10 07:59:29 +00:00
|
|
|
export HOME=$TMPDIR
|
2020-11-19 00:13:47 +00:00
|
|
|
export LC_ALL="en_US.UTF-8"
|
2023-08-10 07:59:29 +00:00
|
|
|
cd $out/${python.sitePackages}/pandas
|
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
|
|
|
|
'';
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"pandas"
|
|
|
|
];
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-11-16 04:20:00 +00:00
|
|
|
# pandas devs no longer test i686, it's commonly broken
|
|
|
|
# broken = stdenv.isi686;
|
2020-11-19 00:13:47 +00:00
|
|
|
changelog = "https://pandas.pydata.org/docs/whatsnew/index.html";
|
2023-08-10 07:59:29 +00:00
|
|
|
description = "Powerful data structures for data analysis, time series, and statistics";
|
|
|
|
downloadPage = "https://github.com/pandas-dev/pandas";
|
|
|
|
homepage = "https://pandas.pydata.org";
|
2020-11-19 00:13:47 +00:00
|
|
|
license = licenses.bsd3;
|
2023-08-10 07:59:29 +00:00
|
|
|
longDescription = ''
|
|
|
|
Flexible and powerful data analysis / manipulation library for
|
|
|
|
Python, providing labeled data structures similar to R data.frame
|
|
|
|
objects, statistical functions, and much more.
|
|
|
|
'';
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ raskin knedlsepp ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-01-13 08:15:51 +00:00
|
|
|
};
|
|
|
|
in pandas
|