1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 click,
11 packaging,
12 pydantic,
13 pystac,
14 pystac-client,
15 python-dotenv,
16 pytz,
17 requests,
18
19 # optional-dependencies
20 adlfs,
21 azure-storage-blob,
22
23 # test
24 responses,
25 pytestCheckHook,
26}:
27
28buildPythonPackage rec {
29 pname = "planetary-computer";
30 version = "1.0.0.post0";
31 pyproject = true;
32
33 src = fetchFromGitHub {
34 owner = "microsoft";
35 repo = "planetary-computer-sdk-for-python";
36 tag = "v${version}";
37 hash = "sha256-NPHUxThSZzENw4W91WAOqChyIl6Z/Afi4mddz+lXlXA=";
38 };
39
40 build-system = [
41 setuptools
42 ];
43
44 dependencies = [
45 click
46 packaging
47 pydantic
48 pystac
49 pystac-client
50 python-dotenv
51 pytz
52 requests
53 ];
54
55 optional-dependencies = {
56 adlfs = [ adlfs ];
57 azure = [ azure-storage-blob ];
58 all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies));
59 };
60
61 pythonImportsCheck = [
62 "planetary_computer"
63 ];
64
65 nativeCheckInputs = [
66 responses
67 pytestCheckHook
68 ]
69 ++ optional-dependencies.all;
70
71 disabledTests = [
72 # tests require network access
73 "test_get_adlfs_filesystem"
74 "test_get_container_client"
75 "test_signing"
76 ];
77
78 meta = {
79 description = "Planetary Computer SDK for Python";
80 homepage = "https://github.com/microsoft/planetary-computer-sdk-for-python";
81 changelog = "https://github.com/microsoft/planetary-computer-sdk-for-python/blob/${src.tag}/CHANGELOG.md";
82 license = lib.licenses.mit;
83 maintainers = with lib.maintainers; [ daspk04 ];
84 mainProgram = "planetarycomputer";
85 };
86}