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