1{
2 lib,
3 fetchPypi,
4 buildPythonPackage,
5 pythonOlder,
6
7 # build time
8 astropy-extension-helpers,
9 cython,
10 jinja2,
11 oldest-supported-numpy,
12 setuptools-scm,
13 wheel,
14 # testing
15 pytestCheckHook,
16 stdenv,
17 pytest-xdist,
18 pytest-astropy,
19
20 # runtime
21 astropy-iers-data,
22 numpy,
23 packaging,
24 pyerfa,
25 pyyaml,
26}:
27
28buildPythonPackage rec {
29 pname = "astropy";
30 version = "6.0.1";
31 pyproject = true;
32
33 disabled = pythonOlder "3.8"; # according to setup.cfg
34
35 src = fetchPypi {
36 inherit pname version;
37 hash = "sha256-ial13jVtBgjnTx9JNEL7Osu7eoW3OeB0RguwNAAUs5w=";
38 };
39
40 nativeBuildInputs = [
41 astropy-extension-helpers
42 cython
43 jinja2
44 oldest-supported-numpy
45 setuptools-scm
46 wheel
47 ];
48
49 propagatedBuildInputs = [
50 astropy-iers-data
51 numpy
52 packaging
53 pyerfa
54 pyyaml
55 ];
56
57 nativeCheckInputs = [
58 pytestCheckHook
59 pytest-xdist
60 pytest-astropy
61 ];
62
63 # Not running it inside the build directory. See:
64 # https://github.com/astropy/astropy/issues/15316#issuecomment-1722190547
65 preCheck = ''
66 cd "$out"
67 export HOME="$(mktemp -d)"
68 export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 ))
69 '';
70 pythonImportsCheck = [ "astropy" ];
71 disabledTests = [
72 # May fail due to parallelism, see:
73 # https://github.com/astropy/astropy/issues/15441
74 "TestUnifiedOutputRegistry"
75
76 # fail due to pytest>=8
77 # https://github.com/astropy/astropy/issues/15960#issuecomment-1913654471
78 "test_distortion_header"
79
80 # flaky
81 "test_timedelta_conversion"
82 # More flaky tests, see: https://github.com/NixOS/nixpkgs/issues/294392
83 "test_sidereal_lon_independent"
84 "test_timedelta_full_precision_arithmetic"
85 "test_datetime_to_timedelta"
86 ] ++ lib.optionals stdenv.isDarwin [ "test_sidereal_lat_independent" ];
87
88 meta = {
89 description = "Astronomy/Astrophysics library for Python";
90 homepage = "https://www.astropy.org";
91 license = lib.licenses.bsd3;
92 platforms = lib.platforms.all;
93 maintainers = with lib.maintainers; [
94 kentjames
95 doronbehar
96 ];
97 };
98}