Files
nixpkgs/pkgs/development/python-modules/astropy/default.nix
Niklas Hambüchen 960a3a111e python3Packages.astropy: disable build-date-dependent irreproducible test
See: https://github.com/astropy/astropy/issues/20725

Assisted-by: Claude Opus 5.5 in Zoo Code, human review.
2026-10-27 02:33:33 +00:00

180 lines
3.3 KiB
Nix

{
lib,
fetchFromGitHub,
buildPythonPackage,
# build time
stdenv,
cython,
extension-helpers,
setuptools,
setuptools-scm,
# dependencies
astropy-iers-data,
numpy,
packaging,
pyerfa,
pyyaml,
# optional-dependencies
scipy,
matplotlib,
ipython,
ipywidgets,
ipykernel,
pandas,
certifi,
dask,
h5py,
pyarrow,
beautifulsoup4,
html5lib,
sortedcontainers,
pytz,
jplephem,
mpmath,
asdf,
asdf-astropy,
bottleneck,
fsspec,
s3fs,
uncompresspy,
# testing
hypothesis,
pytestCheckHook,
pytest-xdist,
pytest-astropy-header,
pytest-doctestplus,
pytest-remotedata,
threadpoolctl,
}:
buildPythonPackage rec {
pname = "astropy";
version = "8.0.0";
pyproject = true;
src = fetchFromGitHub {
owner = "astropy";
repo = "astropy";
tag = "v${version}";
hash = "sha256-pKptFnbhiE6DfsEZ557ugd6nrbWGg2FmEdhp78z+bUM=";
};
env = lib.optionalAttrs stdenv.cc.isClang {
NIX_CFLAGS_COMPILE = "-Wno-error=unused-command-line-argument";
};
build-system = [
cython
extension-helpers
setuptools
setuptools-scm
];
dependencies = [
astropy-iers-data
numpy
packaging
pyerfa
pyyaml
];
optional-dependencies = lib.fix (self: {
recommended = [
scipy
matplotlib
];
ipython = [
ipython
];
jupyter = [
ipywidgets
ipykernel
# ipydatagrid
pandas
]
++ self.ipython;
all = [
certifi
dask
h5py
pyarrow
beautifulsoup4
html5lib
sortedcontainers
pytz
jplephem
mpmath
asdf
asdf-astropy
bottleneck
fsspec
s3fs
uncompresspy
]
++ self.recommended
++ self.ipython
++ self.jupyter
++ dask.optional-dependencies.array
++ fsspec.optional-dependencies.http;
});
nativeCheckInputs = [
hypothesis
pytestCheckHook
pytest-xdist
pytest-astropy-header
pytest-doctestplus
pytest-remotedata
threadpoolctl
# FIXME remove in 7.2.0
# see https://github.com/astropy/astropy/pull/18882
uncompresspy
]
++ optional-dependencies.recommended;
pythonImportsCheck = [ "astropy" ];
__darwinAllowLocalNetworking = true;
preCheck = ''
export HOME="$(mktemp -d)"
# See https://github.com/astropy/astropy/issues/17649 and see
# --hypothesis-profile=ci pytest flag below.
cp conftest.py $out/
# https://github.com/NixOS/nixpkgs/issues/255262
cd "$out"
'';
pytestFlags = [
"--hypothesis-profile=ci"
];
disabledTests = [
# Depends on the build date: Asserts that the IERS-B table bundled in
# `astropy-iers-data` covers `Time.now() - 300 days`, so it fails for any
# build more than 300 days after the end of that table.
# Tests run by nixpkgs should not be time-dependent for reproducibility.
# See https://github.com/astropy/astropy/issues/20725
"test_iers_b_out_of_range_handling"
];
postCheck = ''
rm conftest.py
'';
meta = {
changelog = "https://docs.astropy.org/en/${src.tag}/changelog.html";
description = "Astronomy/Astrophysics library for Python";
homepage = "https://www.astropy.org";
license = lib.licenses.bsd3;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [
kentjames
doronbehar
];
};
}