at master 2.7 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.1.0"; 56 pyproject = true; 57 58 disabled = pythonOlder "3.11"; 59 60 src = fetchPypi { 61 inherit pname version; 62 hash = "sha256-yPJUMiKVsbjPJDA9bxVb9+/bbBKCiCuWbOMEDv+MU8U="; 63 }; 64 65 env = lib.optionalAttrs stdenv.cc.isClang { 66 NIX_CFLAGS_COMPILE = "-Wno-error=unused-command-line-argument"; 67 }; 68 69 build-system = [ 70 cython 71 extension-helpers 72 setuptools 73 setuptools-scm 74 ]; 75 76 dependencies = [ 77 astropy-iers-data 78 numpy 79 packaging 80 pyerfa 81 pyyaml 82 ]; 83 84 optional-dependencies = lib.fix (self: { 85 recommended = [ 86 scipy 87 matplotlib 88 ]; 89 ipython = [ 90 ipython 91 ]; 92 jupyter = [ 93 ipywidgets 94 ipykernel 95 # ipydatagrid 96 pandas 97 ] 98 ++ self.ipython; 99 all = [ 100 certifi 101 dask 102 h5py 103 pyarrow 104 beautifulsoup4 105 html5lib 106 sortedcontainers 107 pytz 108 jplephem 109 mpmath 110 asdf 111 asdf-astropy 112 bottleneck 113 fsspec 114 s3fs 115 ] 116 ++ self.recommended 117 ++ self.ipython 118 ++ self.jupyter 119 ++ dask.optional-dependencies.array 120 ++ fsspec.optional-dependencies.http; 121 }); 122 123 nativeCheckInputs = [ 124 pytestCheckHook 125 pytest-xdist 126 pytest-astropy-header 127 pytest-astropy 128 threadpoolctl 129 ] 130 ++ optional-dependencies.recommended; 131 132 pythonImportsCheck = [ "astropy" ]; 133 134 __darwinAllowLocalNetworking = true; 135 136 preCheck = '' 137 export HOME="$(mktemp -d)" 138 export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 )) 139 # See https://github.com/astropy/astropy/issues/17649 and see 140 # --hypothesis-profile=ci pytest flag below. 141 cp conftest.py $out/ 142 # https://github.com/NixOS/nixpkgs/issues/255262 143 cd "$out" 144 ''; 145 pytestFlags = [ 146 "--hypothesis-profile=ci" 147 ]; 148 postCheck = '' 149 rm conftest.py 150 ''; 151 152 meta = { 153 description = "Astronomy/Astrophysics library for Python"; 154 homepage = "https://www.astropy.org"; 155 license = lib.licenses.bsd3; 156 platforms = lib.platforms.all; 157 maintainers = with lib.maintainers; [ 158 kentjames 159 doronbehar 160 ]; 161 }; 162}