Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3Packages.astropy: unbreak multiple modules #120874

Merged
merged 6 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions pkgs/development/python-modules/astropy-healpix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,42 @@
, fetchPypi
, numpy
, astropy
, astropy-helpers
, astropy-extension-helpers
, setuptools-scm
, pytestCheckHook
, pytest-doctestplus
, hypothesis
}:

buildPythonPackage rec {
pname = "astropy-healpix";
version = "0.6";

doCheck = false; # tests require pytest-astropy

src = fetchPypi {
inherit pname version;
inherit version;
pname = lib.replaceStrings ["-"] ["_"] pname;
sha256 = "409a6621c383641456c074f0f0350a24a4a58e910eaeef14e9bbce3e00ad6690";
};

propagatedBuildInputs = [ numpy astropy astropy-helpers ];
nativeBuildInputs = [
astropy-extension-helpers
setuptools-scm
];

propagatedBuildInputs = [
numpy
astropy
];

checkInputs = [
pytestCheckHook
pytest-doctestplus
hypothesis
];

# Disable automatic update of the astropy-helper module
postPatch = ''
substituteInPlace setup.cfg --replace "auto_use = True" "auto_use = False"
# tests must be run in the build directory
preCheck = ''
cd build/lib*
rmcgibbo marked this conversation as resolved.
Show resolved Hide resolved
rmcgibbo marked this conversation as resolved.
Show resolved Hide resolved
'';

meta = with lib; {
Expand Down
19 changes: 12 additions & 7 deletions pkgs/development/python-modules/glymur/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
, buildPythonPackage
, fetchFromGitHub
, numpy
, python
, scikitimage
, openjpeg
, procps
, pytestCheckHook
, contextlib2
, mock
, importlib-resources
Expand All @@ -14,13 +14,13 @@

buildPythonPackage rec {
pname = "glymur";
version = "0.8.18";
version = "0.9.3";

src = fetchFromGitHub {
owner = "quintusdias";
repo = pname;
rev = "v${version}";
sha256 = "1zbghzw1q4fljb019lsrhka9xrnn4425qnxrjbmbv7dssgkkywd7";
sha256 = "1xlpax56qg5qqh0s19xidgvv2483sc684zj7rh6zw1m1z9m37drr";
};

propagatedBuildInputs = [
Expand All @@ -30,16 +30,21 @@ buildPythonPackage rec {
checkInputs = [
scikitimage
procps
pytestCheckHook
];

postConfigure = ''
substituteInPlace glymur/config.py \
--replace "path = read_config_file(libname)" "path = '${openjpeg}/lib' + libname + ${if stdenv.isDarwin then "'.dylib'" else "'.so'"}"
--replace "path = read_config_file(libname)" "path = '${openjpeg}/lib/lib' + libname + ${if stdenv.isDarwin then "'.dylib'" else "'.so'"}"
'';

checkPhase = ''
${python.interpreter} -m unittest discover
'';
disabledTestPaths = [
# this test involves glymur's different ways of finding the openjpeg path on
# fsh systems by reading an .rc file and such, and is obviated by the patch
# in postConfigure
"tests/test_config.py"
];


meta = with lib; {
description = "Tools for accessing JPEG2000 files";
Expand Down
16 changes: 9 additions & 7 deletions pkgs/development/python-modules/pytest-doctestplus/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
, isPy27
, six
, pytest
, pytestCheckHook
, numpy
, setuptools_scm
}:

buildPythonPackage rec {
Expand All @@ -17,22 +19,22 @@ buildPythonPackage rec {
sha256 = "6fe747418461d7b202824a3486ba8f4fa17a9bd0b1eddc743ba1d6d87f03391a";
};

buildInputs = [ pytest ];
nativeBuildInputs = [
setuptools_scm
];
buildInputs = [
pytest
];

propagatedBuildInputs = [
six
numpy
];

checkInputs = [
pytest
pytestCheckHook
];

# check_distribution incorrectly pulls pytest version
checkPhase = ''
pytest -k 'not check_distribution'
'';

meta = with lib; {
description = "Pytest plugin with advanced doctest features";
homepage = "https://astropy.org";
Expand Down
20 changes: 6 additions & 14 deletions pkgs/development/python-modules/radio_beam/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
, fetchPypi
, buildPythonPackage
, astropy
, pytest
, pytest-astropy
, astropy-helpers
, pytestCheckHook
, pytest-doctestplus
, scipy
}:

Expand All @@ -13,25 +12,18 @@ buildPythonPackage rec {
version = "0.3.3";

src = fetchPypi {
inherit pname version;
inherit version;
pname = "radio-beam";
sha256 = "e34902d91713ccab9f450b9d3e82317e292cf46a30bd42f9ad3c9a0519fcddcd";
};

propagatedBuildInputs = [ astropy ];

nativeBuildInputs = [ astropy-helpers ];

# Disable automatic update of the astropy-helper module
postPatch = ''
substituteInPlace setup.cfg --replace "auto_use = True" "auto_use = False"
'';

checkInputs = [ pytest pytest-astropy scipy ];
checkInputs = [ pytestCheckHook pytest-doctestplus scipy ];

# Tests must be run in the build directory
checkPhase = ''
preCheck = ''
cd build/lib
pytest
'';

meta = {
Expand Down
18 changes: 12 additions & 6 deletions pkgs/development/python-modules/spectral-cube/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{ lib
, fetchPypi
, fetchpatch
, buildPythonPackage
, aplpy
, joblib
, astropy
, radio_beam
, pytest
, pytestCheckHook
, pytest-astropy
, astropy-helpers
}:
Expand All @@ -20,13 +21,18 @@ buildPythonPackage rec {
sha256 = "17zisr26syfb8kn89xj17lrdycm0hsmy5yp5zrn236wgd8rjriki";
};

patches = [
# Fix compatibility with radio_beam >= 0.3.3. Will be included
# in the next release of spectral cube > 0.5.0
(fetchpatch {
url = "https://github.com/radio-astro-tools/spectral-cube/commit/bbe4295ebef7dfa6fe4474275a29acd6cb0cb544.patch";
sha256 = "1qddfm3364kc34yf6wd9nd6rxh4qc2v5pqilvz9adwb4a50z28bf";
})
];

nativeBuildInputs = [ astropy-helpers ];
propagatedBuildInputs = [ astropy radio_beam joblib ];
checkInputs = [ aplpy pytest pytest-astropy ];

checkPhase = ''
pytest spectral_cube
'';
checkInputs = [ pytestCheckHook aplpy pytest-astropy ];

meta = {
description = "Library for reading and analyzing astrophysical spectral data cubes";
Expand Down
2 changes: 2 additions & 0 deletions pkgs/development/python-modules/sunpy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
, beautifulsoup4
, drms
, glymur
, h5netcdf
, hypothesis
, matplotlib
, numpy
Expand Down Expand Up @@ -50,6 +51,7 @@ buildPythonPackage rec {
pandas
astropy
astropy-helpers
h5netcdf
parfive
sqlalchemy
scikitimage
Expand Down