1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6 astropy,
7 boto3,
8 requests,
9 keyring,
10 beautifulsoup4,
11 html5lib,
12 matplotlib,
13 pillow,
14 pytest,
15 pytest-astropy,
16 pytest-dependency,
17 pytest-rerunfailures,
18 pytestCheckHook,
19 pyvo,
20 astropy-helpers,
21 setuptools,
22}:
23
24buildPythonPackage rec {
25 pname = "astroquery";
26 version = "0.4.10";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "astropy";
31 repo = "astroquery";
32 tag = "v${version}";
33 hash = "sha256-5pNKV+XNfUQca7WoWboVphXffzyVIHCmfxwr4nBMaEk=";
34 };
35
36 patches = [
37 # https://github.com/astropy/astroquery/pull/3311
38 (fetchpatch2 {
39 name = "setuptools-package-index.patch";
40 url = "https://github.com/astropy/astroquery/commit/9d43beb4b7bea424d73fff0b602ca90026155519.patch";
41 hash = "sha256-3QdOwP1rlWeScGxHT9ZVPmffE7S1XE0cbtnQ8T4bIYw=";
42 })
43 ];
44
45 build-system = [
46 astropy-helpers
47 setuptools
48 ];
49
50 dependencies = [
51 astropy
52 requests
53 keyring
54 beautifulsoup4
55 html5lib
56 pyvo
57 ];
58
59 # Disable automatic update of the astropy-helper module
60 postPatch = ''
61 substituteInPlace setup.cfg --replace "auto_use = True" "auto_use = False"
62 '';
63
64 nativeCheckInputs = [ pytestCheckHook ];
65
66 checkInputs = [
67 boto3
68 matplotlib
69 pillow
70 pytest
71 pytest-astropy
72 pytest-dependency
73 pytest-rerunfailures
74 ];
75
76 pytestFlags = [
77 # DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
78 "-Wignore::DeprecationWarning"
79 ];
80
81 # Tests must be run in the build directory. The tests create files
82 # in $HOME/.astropy so we need to set HOME to $TMPDIR.
83 preCheck = ''
84 export HOME=$TMPDIR
85 cd build/lib
86 '';
87
88 pythonImportsCheck = [ "astroquery" ];
89
90 meta = {
91 description = "Functions and classes to access online data resources";
92 homepage = "https://astroquery.readthedocs.io/";
93 license = lib.licenses.bsd3;
94 maintainers = [ lib.maintainers.smaret ];
95 };
96}