Files
nixpkgs/pkgs/development/python-modules/astropy/default.nix
T
Martin Weinelt b79da2786f Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
	pkgs/development/python-modules/bundlewrap/default.nix
	pkgs/development/python-modules/coverage/default.nix
	pkgs/development/python-modules/h5netcdf/default.nix
	pkgs/development/python-modules/hypothesis/default.nix
	pkgs/development/python-modules/numba/default.nix
	pkgs/development/python-modules/optype/default.nix
	pkgs/development/python-modules/setuptools-git-versioning/default.nix
	pkgs/development/python-modules/sphinx/default.nix
2026-02-15 16:17:41 +01:00

176 lines
3.0 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 = "7.2.0";
pyproject = true;
src = fetchFromGitHub {
owner = "astropy";
repo = "astropy";
tag = "v${version}";
hash = "sha256-U9kCzyOZcttlUP0DUGkhJVkk96sBM/Gm/s5ZPJZcEoA=";
};
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)"
export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 ))
if [ $OMP_NUM_THREADS -eq 0 ]; then
export OMP_NUM_THREADS=1
fi
# 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"
];
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
];
};
}