1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 certifi,
7 numpy,
8 sgp4,
9 jplephem,
10 pandas,
11 ipython,
12 matplotlib,
13 assay,
14}:
15
16buildPythonPackage rec {
17 pname = "skyfield";
18 version = "1.45";
19 format = "setuptools";
20
21 src = fetchFromGitHub {
22 owner = "skyfielders";
23 repo = "python-skyfield";
24 rev = version;
25 hash = "sha256-kZrXNVE+JGPGiVsd6CTwOqfciYLsD2A4pTS3FpqO+Dk=";
26 };
27
28 # Fix broken tests on "exotic" platforms.
29 # https://github.com/skyfielders/python-skyfield/issues/582#issuecomment-822033858
30 postPatch = ''
31 substituteInPlace skyfield/tests/test_planetarylib.py \
32 --replace "if IS_32_BIT" "if True"
33 '';
34
35 propagatedBuildInputs = [
36 certifi
37 numpy
38 sgp4
39 jplephem
40 ];
41
42 nativeCheckInputs = [
43 pandas
44 ipython
45 matplotlib
46 assay
47 ];
48
49 # assay is broken on Python >= 3.11
50 # https://github.com/brandon-rhodes/assay/issues/15
51 doCheck = pythonOlder "3.11";
52
53 checkPhase = ''
54 runHook preCheck
55
56 cd ci
57 assay --batch skyfield.tests
58
59 runHook postCheck
60 '';
61
62 pythonImportsCheck = [ "skyfield" ];
63
64 meta = with lib; {
65 homepage = "https://github.com/skyfielders/python-skyfield";
66 description = "Elegant astronomy for Python";
67 license = licenses.mit;
68 maintainers = with maintainers; [ zane ];
69 };
70}