biome: 1.9.2 -> 1.9.3 (#349335)
[NixPkgs.git] / pkgs / development / python-modules / astropy / default.nix
blobc6a7f9fea08beffa7a9a971f8eec8930221628d6
2   lib,
3   fetchPypi,
4   fetchpatch,
5   buildPythonPackage,
6   pythonOlder,
8   # build time
9   astropy-extension-helpers,
10   cython,
11   jinja2,
12   oldest-supported-numpy,
13   setuptools-scm,
14   wheel,
15   # testing
16   pytestCheckHook,
17   stdenv,
18   pytest-xdist,
19   pytest-astropy,
21   # runtime
22   astropy-iers-data,
23   numpy,
24   packaging,
25   pyerfa,
26   pyyaml,
29 buildPythonPackage rec {
30   pname = "astropy";
31   version = "6.1.1";
32   pyproject = true;
34   disabled = pythonOlder "3.8"; # according to setup.cfg
36   src = fetchPypi {
37     inherit pname version;
38     hash = "sha256-5cb0XZEcMKy41VbH+O2ZSuxxsQjmHu5QZ/AK8eTjYTg=";
39   };
41   patches = [
42     (fetchpatch {
43       name = "drop-usage-known-bad-actor-cdn.patch";
44       url = "https://github.com/astropy/astropy/commit/d329cb38e49584ad0ff5244fd2fff74cfa1f92f1.patch";
45       hash = "sha256-+DbDwYeyR+mMDLRB4jiyol/5WO0LwqSCCEwjgflxoTk=";
46     })
47   ];
49   postPatch = ''
50     substituteInPlace pyproject.toml \
51       --replace-fail "numpy>=2.0.0"  "numpy"
52   '';
54   nativeBuildInputs = [
55     astropy-extension-helpers
56     cython
57     jinja2
58     oldest-supported-numpy
59     setuptools-scm
60     wheel
61   ];
63   propagatedBuildInputs = [
64     astropy-iers-data
65     numpy
66     packaging
67     pyerfa
68     pyyaml
69   ];
71   nativeCheckInputs = [
72     pytestCheckHook
73     pytest-xdist
74     pytest-astropy
75   ];
77   # Not running it inside the build directory. See:
78   # https://github.com/astropy/astropy/issues/15316#issuecomment-1722190547
79   preCheck = ''
80     cd "$out"
81     export HOME="$(mktemp -d)"
82     export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 ))
83   '';
84   pythonImportsCheck = [ "astropy" ];
85   disabledTests = [
86     # May fail due to parallelism, see:
87     # https://github.com/astropy/astropy/issues/15441
88     "TestUnifiedOutputRegistry"
90     # fail due to pytest>=8
91     # https://github.com/astropy/astropy/issues/15960#issuecomment-1913654471
92     "test_distortion_header"
94     # flaky
95     "test_timedelta_conversion"
96     # More flaky tests, see: https://github.com/NixOS/nixpkgs/issues/294392
97     "test_sidereal_lon_independent"
98     "test_timedelta_full_precision_arithmetic"
99     "test_datetime_to_timedelta"
101     "test_datetime_difference_agrees_with_timedelta_no_hypothesis"
102   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "test_sidereal_lat_independent" ];
104   meta = {
105     description = "Astronomy/Astrophysics library for Python";
106     homepage = "https://www.astropy.org";
107     license = lib.licenses.bsd3;
108     platforms = lib.platforms.all;
109     maintainers = with lib.maintainers; [
110       kentjames
111       doronbehar
112     ];
113   };