about summary refs log tree commit diff
path: root/pkgs/development/python-modules/astroquery/default.nix
blob: 610238559a2ce361e6f4d8a42ebfac5c137d6646 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ pkgs
, buildPythonPackage
, fetchPypi
, astropy
, requests
, keyring
, beautifulsoup4
, html5lib
, matplotlib
, pillow
, pytest
, pytest-astropy
, pytestCheckHook
, pyvo
, astropy-helpers
, setuptools
, isPy3k
}:

buildPythonPackage rec {
  pname = "astroquery";
  version = "0.4.6";
  format = "pyproject";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-MHylVMtzSgypoi+G9e/+fkE6+ROuZeFXiXLYR7H+E+4=";
  };

  disabled = !isPy3k;

  propagatedBuildInputs = [
    astropy
    requests
    keyring
    beautifulsoup4
    html5lib
    pyvo
  ];

  nativeBuildInputs = [ astropy-helpers setuptools ];

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

  nativeCheckInputs = [
    matplotlib
    pillow
    pytest
    pytest-astropy
    pytestCheckHook
  ];

  pytestFlagsArray = [
    # DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
    "-W" "ignore::DeprecationWarning"
  ];

  # Tests must be run in the build directory. The tests create files
  # in $HOME/.astropy so we need to set HOME to $TMPDIR.
  preCheck = ''
    export HOME=$TMPDIR
    cd build/lib
  '';

  pythonImportsCheck = [ "astroquery" ];

  meta = with pkgs.lib; {
    description = "Functions and classes to access online data resources";
    homepage = "https://astroquery.readthedocs.io/";
    license = licenses.bsd3;
    maintainers = [ maintainers.smaret ];
  };
}