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