Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 166 lines 2.8 kB view raw
1{ 2 lib, 3 fetchPypi, 4 buildPythonPackage, 5 pythonOlder, 6 7 # build time 8 stdenv, 9 cython, 10 extension-helpers, 11 setuptools, 12 setuptools-scm, 13 14 # dependencies 15 astropy-iers-data, 16 numpy, 17 packaging, 18 pyerfa, 19 pyyaml, 20 21 # optional-dependencies 22 scipy, 23 matplotlib, 24 ipython, 25 ipywidgets, 26 ipykernel, 27 pandas, 28 certifi, 29 dask, 30 h5py, 31 pyarrow, 32 beautifulsoup4, 33 html5lib, 34 sortedcontainers, 35 pytz, 36 jplephem, 37 mpmath, 38 asdf, 39 asdf-astropy, 40 bottleneck, 41 fsspec, 42 s3fs, 43 44 # testing 45 pytestCheckHook, 46 pytest-xdist, 47 pytest-astropy-header, 48 pytest-astropy, 49 threadpoolctl, 50 51}: 52 53buildPythonPackage rec { 54 pname = "astropy"; 55 version = "7.0.1"; 56 pyproject = true; 57 58 disabled = pythonOlder "3.11"; 59 60 src = fetchPypi { 61 inherit pname version; 62 hash = "sha256-OS/utEOyQ3zUwuBkGmXg8VunkeFI6bHl7X3n38s45GA="; 63 }; 64 65 patches = [ 66 ./test_z_at_value_numpyvectorize.patch 67 ]; 68 69 env = lib.optionalAttrs stdenv.cc.isClang { 70 NIX_CFLAGS_COMPILE = "-Wno-error=unused-command-line-argument"; 71 }; 72 73 build-system = [ 74 cython 75 extension-helpers 76 setuptools 77 setuptools-scm 78 ]; 79 80 dependencies = [ 81 astropy-iers-data 82 numpy 83 packaging 84 pyerfa 85 pyyaml 86 ]; 87 88 optional-dependencies = lib.fix (self: { 89 recommended = [ 90 scipy 91 matplotlib 92 ]; 93 ipython = [ 94 ipython 95 ]; 96 jupyter = [ 97 ipywidgets 98 ipykernel 99 # ipydatagrid 100 pandas 101 ] 102 ++ self.ipython; 103 all = [ 104 certifi 105 dask 106 h5py 107 pyarrow 108 beautifulsoup4 109 html5lib 110 sortedcontainers 111 pytz 112 jplephem 113 mpmath 114 asdf 115 asdf-astropy 116 bottleneck 117 fsspec 118 s3fs 119 ] 120 ++ self.recommended 121 ++ self.ipython 122 ++ self.jupyter 123 ++ dask.optional-dependencies.array 124 ++ fsspec.optional-dependencies.http; 125 }); 126 127 nativeCheckInputs = [ 128 pytestCheckHook 129 pytest-xdist 130 pytest-astropy-header 131 pytest-astropy 132 threadpoolctl 133 ] 134 ++ optional-dependencies.recommended; 135 136 pythonImportsCheck = [ "astropy" ]; 137 138 __darwinAllowLocalNetworking = true; 139 140 preCheck = '' 141 export HOME="$(mktemp -d)" 142 export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 )) 143 # See https://github.com/astropy/astropy/issues/17649 and see 144 # --hypothesis-profile=ci pytest flag below. 145 cp conftest.py $out/ 146 # https://github.com/NixOS/nixpkgs/issues/255262 147 cd "$out" 148 ''; 149 pytestFlags = [ 150 "--hypothesis-profile=ci" 151 ]; 152 postCheck = '' 153 rm conftest.py 154 ''; 155 156 meta = { 157 description = "Astronomy/Astrophysics library for Python"; 158 homepage = "https://www.astropy.org"; 159 license = lib.licenses.bsd3; 160 platforms = lib.platforms.all; 161 maintainers = with lib.maintainers; [ 162 kentjames 163 doronbehar 164 ]; 165 }; 166}