nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 178 lines 3.2 kB view raw
1{ 2 lib, 3 fetchFromGitHub, 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 uncompresspy, 44 45 # testing 46 hypothesis, 47 pytestCheckHook, 48 pytest-xdist, 49 pytest-astropy-header, 50 pytest-doctestplus, 51 pytest-remotedata, 52 threadpoolctl, 53 54}: 55 56buildPythonPackage rec { 57 pname = "astropy"; 58 version = "7.2.0"; 59 pyproject = true; 60 61 disabled = pythonOlder "3.11"; 62 63 src = fetchFromGitHub { 64 owner = "astropy"; 65 repo = "astropy"; 66 tag = "v${version}"; 67 hash = "sha256-U9kCzyOZcttlUP0DUGkhJVkk96sBM/Gm/s5ZPJZcEoA="; 68 }; 69 70 env = lib.optionalAttrs stdenv.cc.isClang { 71 NIX_CFLAGS_COMPILE = "-Wno-error=unused-command-line-argument"; 72 }; 73 74 build-system = [ 75 cython 76 extension-helpers 77 setuptools 78 setuptools-scm 79 ]; 80 81 dependencies = [ 82 astropy-iers-data 83 numpy 84 packaging 85 pyerfa 86 pyyaml 87 ]; 88 89 optional-dependencies = lib.fix (self: { 90 recommended = [ 91 scipy 92 matplotlib 93 ]; 94 ipython = [ 95 ipython 96 ]; 97 jupyter = [ 98 ipywidgets 99 ipykernel 100 # ipydatagrid 101 pandas 102 ] 103 ++ self.ipython; 104 all = [ 105 certifi 106 dask 107 h5py 108 pyarrow 109 beautifulsoup4 110 html5lib 111 sortedcontainers 112 pytz 113 jplephem 114 mpmath 115 asdf 116 asdf-astropy 117 bottleneck 118 fsspec 119 s3fs 120 uncompresspy 121 ] 122 ++ self.recommended 123 ++ self.ipython 124 ++ self.jupyter 125 ++ dask.optional-dependencies.array 126 ++ fsspec.optional-dependencies.http; 127 }); 128 129 nativeCheckInputs = [ 130 hypothesis 131 pytestCheckHook 132 pytest-xdist 133 pytest-astropy-header 134 pytest-doctestplus 135 pytest-remotedata 136 threadpoolctl 137 # FIXME remove in 7.2.0 138 # see https://github.com/astropy/astropy/pull/18882 139 uncompresspy 140 ] 141 ++ optional-dependencies.recommended; 142 143 pythonImportsCheck = [ "astropy" ]; 144 145 __darwinAllowLocalNetworking = true; 146 147 preCheck = '' 148 export HOME="$(mktemp -d)" 149 export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 )) 150 if [ $OMP_NUM_THREADS -eq 0 ]; then 151 export OMP_NUM_THREADS=1 152 fi 153 154 # See https://github.com/astropy/astropy/issues/17649 and see 155 # --hypothesis-profile=ci pytest flag below. 156 cp conftest.py $out/ 157 # https://github.com/NixOS/nixpkgs/issues/255262 158 cd "$out" 159 ''; 160 pytestFlags = [ 161 "--hypothesis-profile=ci" 162 ]; 163 postCheck = '' 164 rm conftest.py 165 ''; 166 167 meta = { 168 changelog = "https://docs.astropy.org/en/${src.tag}/changelog.html"; 169 description = "Astronomy/Astrophysics library for Python"; 170 homepage = "https://www.astropy.org"; 171 license = lib.licenses.bsd3; 172 platforms = lib.platforms.all; 173 maintainers = with lib.maintainers; [ 174 kentjames 175 doronbehar 176 ]; 177 }; 178}