earthscope-sdk 1.0.0b1__py3-none-any.whl → 1.2.0b0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. earthscope_sdk/__init__.py +1 -1
  2. earthscope_sdk/auth/auth_flow.py +8 -6
  3. earthscope_sdk/auth/client_credentials_flow.py +3 -13
  4. earthscope_sdk/auth/device_code_flow.py +19 -10
  5. earthscope_sdk/client/_client.py +47 -0
  6. earthscope_sdk/client/data_access/__init__.py +0 -0
  7. earthscope_sdk/client/data_access/_arrow/__init__.py +0 -0
  8. earthscope_sdk/client/data_access/_arrow/_common.py +94 -0
  9. earthscope_sdk/client/data_access/_arrow/_gnss.py +116 -0
  10. earthscope_sdk/client/data_access/_base.py +85 -0
  11. earthscope_sdk/client/data_access/_query_plan/__init__.py +0 -0
  12. earthscope_sdk/client/data_access/_query_plan/_gnss_observations.py +295 -0
  13. earthscope_sdk/client/data_access/_query_plan/_query_plan.py +259 -0
  14. earthscope_sdk/client/data_access/_query_plan/_request_set.py +133 -0
  15. earthscope_sdk/client/data_access/_service.py +114 -0
  16. earthscope_sdk/client/discovery/__init__.py +0 -0
  17. earthscope_sdk/client/discovery/_base.py +303 -0
  18. earthscope_sdk/client/discovery/_service.py +209 -0
  19. earthscope_sdk/client/discovery/models.py +144 -0
  20. earthscope_sdk/common/context.py +73 -1
  21. earthscope_sdk/common/service.py +10 -8
  22. earthscope_sdk/config/_bootstrap.py +42 -0
  23. earthscope_sdk/config/models.py +54 -21
  24. earthscope_sdk/config/settings.py +11 -0
  25. earthscope_sdk/model/secret.py +29 -0
  26. earthscope_sdk/util/__init__.py +0 -0
  27. earthscope_sdk/util/_concurrency.py +64 -0
  28. earthscope_sdk/util/_itertools.py +57 -0
  29. earthscope_sdk/util/_time.py +57 -0
  30. earthscope_sdk/util/_types.py +5 -0
  31. {earthscope_sdk-1.0.0b1.dist-info → earthscope_sdk-1.2.0b0.dist-info}/METADATA +15 -4
  32. earthscope_sdk-1.2.0b0.dist-info/RECORD +49 -0
  33. {earthscope_sdk-1.0.0b1.dist-info → earthscope_sdk-1.2.0b0.dist-info}/WHEEL +1 -1
  34. earthscope_sdk-1.0.0b1.dist-info/RECORD +0 -28
  35. {earthscope_sdk-1.0.0b1.dist-info → earthscope_sdk-1.2.0b0.dist-info}/licenses/LICENSE +0 -0
  36. {earthscope_sdk-1.0.0b1.dist-info → earthscope_sdk-1.2.0b0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,57 @@
1
+ import datetime as dt
2
+ from datetime import timezone
3
+ from typing import NamedTuple, TypeVar
4
+
5
+ T = TypeVar("T")
6
+
7
+
8
+ class TimePeriod(NamedTuple):
9
+ """
10
+ A time period.
11
+
12
+ Attributes:
13
+ start (datetime): Start datetime.
14
+ end (datetime): End datetime.
15
+ """
16
+
17
+ start: dt.datetime
18
+ end: dt.datetime
19
+
20
+ def __str__(self):
21
+ return repr(self)
22
+
23
+ def __repr__(self):
24
+ return f"[{self.start}, {self.end})"
25
+
26
+ @property
27
+ def duration(self) -> dt.timedelta:
28
+ return self.end - self.start
29
+
30
+
31
+ def time_range_periods(start: dt.datetime, end: dt.datetime, period: dt.timedelta):
32
+ """
33
+ Generate time ranges between start and end broken into periods of size 'period'.
34
+
35
+ Args:
36
+ start (datetime): Start datetime.
37
+ end (datetime): End datetime.
38
+ period (timedelta): Size of each time period.
39
+
40
+ Yields:
41
+ TimePeriod: Start and end of each period.
42
+ """
43
+ current = start
44
+ while current < end:
45
+ next_time = min(current + period, end)
46
+ yield TimePeriod(start=current, end=next_time)
47
+ current = next_time
48
+
49
+
50
+ def to_utc_dt(dt: dt.datetime) -> dt.datetime:
51
+ """
52
+ Convert a datetime to an aware datetime in the UTC timezone.
53
+ """
54
+ if dt.tzinfo is None:
55
+ return dt.replace(tzinfo=timezone.utc)
56
+
57
+ return dt.astimezone(timezone.utc)
@@ -0,0 +1,5 @@
1
+ from typing import TypeVar, Union
2
+
3
+ T = TypeVar("T")
4
+
5
+ ListOrItem = Union[list[T], T]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: earthscope-sdk
3
- Version: 1.0.0b1
3
+ Version: 1.2.0b0
4
4
  Summary: An SDK for EarthScope API
5
5
  Author-email: EarthScope <data-help@earthscope.org>
6
6
  License: Apache License
@@ -216,12 +216,16 @@ License-File: LICENSE
216
216
  Requires-Dist: httpx>=0.27.0
217
217
  Requires-Dist: pydantic-settings[toml]>=2.8.0
218
218
  Requires-Dist: stamina>=24.3.0
219
+ Provides-Extra: arrow
220
+ Requires-Dist: pyarrow>=20.0.0; extra == "arrow"
221
+ Requires-Dist: pyarrow-stubs>=20.0.0; extra == "arrow"
219
222
  Provides-Extra: dev
220
223
  Requires-Dist: bumpver; extra == "dev"
221
224
  Requires-Dist: build; extra == "dev"
222
225
  Requires-Dist: pytest; extra == "dev"
223
226
  Requires-Dist: twine; extra == "dev"
224
227
  Requires-Dist: pip-tools; extra == "dev"
228
+ Requires-Dist: pre-commit; extra == "dev"
225
229
  Requires-Dist: pytest-httpx; extra == "dev"
226
230
  Requires-Dist: pytest-asyncio; extra == "dev"
227
231
  Requires-Dist: ruff; extra == "dev"
@@ -241,9 +245,16 @@ Install from PyPI
241
245
  pip install earthscope-sdk
242
246
  ```
243
247
 
248
+ Or with optional dependencies:
249
+
250
+ ```shell
251
+ # install arrow dependencies for efficient data access
252
+ pip install earthscope-sdk[arrow]
253
+ ```
254
+
244
255
  ### Usage
245
256
 
246
- For detailed usage options and examples, visit [our usage docs](docs/usage.md).
257
+ For detailed usage info and examples, visit [our SDK docs](https://docs.earthscope.org/projects/SDK).
247
258
 
248
259
  ```py
249
260
  # Import and create a client
@@ -300,7 +311,7 @@ Once refreshable credentials are available to the SDK, it will transparently han
300
311
 
301
312
  ### Same host
302
313
 
303
- If you have the [EarthScope CLI](TODO) installed on the same host that is running your application which uses `earthscope-sdk`, you can simply log in using the CLI. The CLI shares credentials and configuration with this SDK (when running on the same host).
314
+ If you have the [EarthScope CLI](https://docs.earthscope.org/projects/CLI) installed on the same host that is running your application which uses `earthscope-sdk`, you can simply log in using the CLI. The CLI shares credentials and configuration with this SDK (when running on the same host).
304
315
 
305
316
  Running `es login` will open your browser and prompt you to log in to your EarthScope account.
306
317
 
@@ -320,7 +331,7 @@ Now when you run your application, `earthscope-sdk` will find your credentials.
320
331
 
321
332
  Sometimes your workload runs on different hosts than your main workstation and you cannot feasibly "log in" on all of them. For example, maybe you're running many containers in your workload.
322
333
 
323
- You can still use the [EarthScope CLI](TODO) to facilitate auth for applications on other machines.
334
+ You can still use the [EarthScope CLI](https://docs.earthscope.org/projects/CLI) to facilitate auth for applications on other machines.
324
335
 
325
336
  1. Use the CLI on your primary workstation [as described above](#same-host) to log in.
326
337
 
@@ -0,0 +1,49 @@
1
+ earthscope_sdk/__init__.py,sha256=tHAIgbIAiK4xpxSusvWASwptTKQIk73KWaOlem5uR7A,156
2
+ earthscope_sdk/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ earthscope_sdk/auth/auth_flow.py,sha256=gxJmCr5TAhMEss7RskYFCv6-D3A5h0Zw2ejeLJJ_9aI,10352
4
+ earthscope_sdk/auth/client_credentials_flow.py,sha256=GAvskuoEd6qHe-BtfGwYQisMedmSkDhagy4aRPVPri4,2494
5
+ earthscope_sdk/auth/device_code_flow.py,sha256=p53pgRQraToFwONPBj3O3DHAa4x4rE6rvygo_Bbj5_U,8394
6
+ earthscope_sdk/auth/error.py,sha256=eC33Bw1HaBEJE7-eI2krtE__5PxStc3EyiYO12v0kVw,693
7
+ earthscope_sdk/client/__init__.py,sha256=JotTr5oTiiOsUc0RTg82EVCUSg_-u80Qu_R0-crCXkY,139
8
+ earthscope_sdk/client/_client.py,sha256=g-3HSOFioeKPzsO4bcgoWhH5hCSs3TzPR3JegAsOh5I,2038
9
+ earthscope_sdk/client/data_access/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ earthscope_sdk/client/data_access/_base.py,sha256=3ZG5KERhFbGO1vNUWgj-NP490WFR4g76jmM0MTShb8w,2547
11
+ earthscope_sdk/client/data_access/_service.py,sha256=Po25WryLgYfcg87NR89r5VSgSXKnprngXywCKUGa6S0,3978
12
+ earthscope_sdk/client/data_access/_arrow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ earthscope_sdk/client/data_access/_arrow/_common.py,sha256=OhlU6uUR0kDgaHyAfV075JyWwUGSs9iQfqpsa8yE0lM,2590
14
+ earthscope_sdk/client/data_access/_arrow/_gnss.py,sha256=sw4TtTMiJJJgokMlT8d7bs5pf5V64Oh4FhOJ0JJGhq0,3135
15
+ earthscope_sdk/client/data_access/_query_plan/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ earthscope_sdk/client/data_access/_query_plan/_gnss_observations.py,sha256=NEtwUiUc46V84sRZltbSMptIjiyjHNjB3Xxo0LJbmPM,8915
17
+ earthscope_sdk/client/data_access/_query_plan/_query_plan.py,sha256=kZDaYwmUeihO5wPKJPp62gBr4R8xO6A5XVa2w5djRiw,7862
18
+ earthscope_sdk/client/data_access/_query_plan/_request_set.py,sha256=pwdZW_-i2Mm9UdzS9bjXMBoq7YobRRAuuDLAFurXoT8,3777
19
+ earthscope_sdk/client/discovery/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ earthscope_sdk/client/discovery/_base.py,sha256=kFtIdu8_kHdLEqVd_RL1f8ND8e0-NZw34w1skgvlVzA,10676
21
+ earthscope_sdk/client/discovery/_service.py,sha256=QEHXW9T7Kupka57hQBJR3qKBppBDU3zdU7M0xkOAMMo,7026
22
+ earthscope_sdk/client/discovery/models.py,sha256=-QsYXMZAO9YM29EYiZhsJ0Bo28UBfVaOgHhPoP2cy6g,3787
23
+ earthscope_sdk/client/user/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ earthscope_sdk/client/user/_base.py,sha256=8dn4pfQMwVDpF0E6dl6P6HJuNVvozUzfgUGefnPXMnw,1076
25
+ earthscope_sdk/client/user/_service.py,sha256=wRktOZF5GXajXXxij3Nkule6wvuWOV0vn4QsA1IXVHc,3063
26
+ earthscope_sdk/client/user/models.py,sha256=drZAMwOYC1NVCzBZQhNL-pPTB28SURKfoZF8HdjlIj8,1214
27
+ earthscope_sdk/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
+ earthscope_sdk/common/_sync_runner.py,sha256=h_A2pSEjZCLj7ov50M6cWHVoX6eXVmGzz5nX0MwLWDY,4131
29
+ earthscope_sdk/common/client.py,sha256=g5ZTNhFm33H68J9pWD5fDu760Yd5cBdfQmsbU3t8D_4,2156
30
+ earthscope_sdk/common/context.py,sha256=8IyfDDSIjLS6oV2aHkCRNjh5rN4dyXLzuntnhE36UoA,7395
31
+ earthscope_sdk/common/service.py,sha256=G48u-zaGfb4TEq5FaVDTc9LwLnLZPAY1pn8P5uZoJKM,1611
32
+ earthscope_sdk/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ earthscope_sdk/config/_bootstrap.py,sha256=BvDSRccvFPFRnLS4MlE7OMLGYEgxY7znxFZ6AYgxvOE,1243
34
+ earthscope_sdk/config/_compat.py,sha256=P3F5y_Kf5zp9m9uOhl1Bp3ke6expxq4Sm9AeVaBbAHk,4610
35
+ earthscope_sdk/config/_util.py,sha256=RZ6zvKrvjUkO7i69s7AVoIDhamRg4x71CAZLnucr9QM,1249
36
+ earthscope_sdk/config/error.py,sha256=jh25q-b317lAvp32WwQw0zdYoV-MxZtg-n5FgZOMymI,95
37
+ earthscope_sdk/config/models.py,sha256=Gm-KfWnDwDt6n50pTebjEN_ffGS6k4BBYXLL0HCFt6I,9088
38
+ earthscope_sdk/config/settings.py,sha256=kGsoqAgoUS2xrI0rvdqbLEsI2M0Mpbm73oEDLpJG4_Q,9205
39
+ earthscope_sdk/model/secret.py,sha256=QTyWCqXvf9ZYWaVVQcGzdt3rGtyU3sx13AlzkNE3gaU,731
40
+ earthscope_sdk/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
+ earthscope_sdk/util/_concurrency.py,sha256=ryxpwHun91hW2mN9zrsd9J8Q6PsrgkFoYmu3voIGxZI,2056
42
+ earthscope_sdk/util/_itertools.py,sha256=JKUaY05CpEVsXhSuvkZzyEJmm5FjnipbQAfa0BUvxBo,1312
43
+ earthscope_sdk/util/_time.py,sha256=QzsccF951t-FeWvgddj55bpIHsQJJRGxRCPeylVOF1U,1343
44
+ earthscope_sdk/util/_types.py,sha256=FNYmC7u9bgPhWxGOxY8FT2rX6eCuJO5mwbs4y5wJlPA,84
45
+ earthscope_sdk-1.2.0b0.dist-info/licenses/LICENSE,sha256=E_MrVXxRaMQNpvZhsDuz_J9N_ux7dlL_WpYSsE391HU,11349
46
+ earthscope_sdk-1.2.0b0.dist-info/METADATA,sha256=MwXlwToXAjU5vJbR5KP0lTYEu42Jg6yIeFj_BaolWis,18385
47
+ earthscope_sdk-1.2.0b0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
+ earthscope_sdk-1.2.0b0.dist-info/top_level.txt,sha256=zTtIT9yN3JPJF7TqmTzqQcAvZZe4pAm907DLoGa5T_E,15
49
+ earthscope_sdk-1.2.0b0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,28 +0,0 @@
1
- earthscope_sdk/__init__.py,sha256=GUJAs2cToEo9f8MaCUP_VnRsyqZWNhsN-pId5vzPk4U,156
2
- earthscope_sdk/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- earthscope_sdk/auth/auth_flow.py,sha256=6jBQxLJ2gAxXGgtZYXDH1yg5L_WUmgu7fRvW4JoCi4Q,10198
4
- earthscope_sdk/auth/client_credentials_flow.py,sha256=1GyDSIR1OgYP4u0xZoTov1u_YhY1AzHFpOcBCzY1h6E,2769
5
- earthscope_sdk/auth/device_code_flow.py,sha256=dC5Ffj3HzBguRxSHCZYvTe1MD3C-iKf2AlanGuRKNvI,7922
6
- earthscope_sdk/auth/error.py,sha256=eC33Bw1HaBEJE7-eI2krtE__5PxStc3EyiYO12v0kVw,693
7
- earthscope_sdk/client/__init__.py,sha256=JotTr5oTiiOsUc0RTg82EVCUSg_-u80Qu_R0-crCXkY,139
8
- earthscope_sdk/client/_client.py,sha256=ai7WdsTOYglA6bLkT-Wntvxlke6nSaGHwqrtg5PEy80,833
9
- earthscope_sdk/client/user/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- earthscope_sdk/client/user/_base.py,sha256=8dn4pfQMwVDpF0E6dl6P6HJuNVvozUzfgUGefnPXMnw,1076
11
- earthscope_sdk/client/user/_service.py,sha256=wRktOZF5GXajXXxij3Nkule6wvuWOV0vn4QsA1IXVHc,3063
12
- earthscope_sdk/client/user/models.py,sha256=drZAMwOYC1NVCzBZQhNL-pPTB28SURKfoZF8HdjlIj8,1214
13
- earthscope_sdk/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- earthscope_sdk/common/_sync_runner.py,sha256=h_A2pSEjZCLj7ov50M6cWHVoX6eXVmGzz5nX0MwLWDY,4131
15
- earthscope_sdk/common/client.py,sha256=g5ZTNhFm33H68J9pWD5fDu760Yd5cBdfQmsbU3t8D_4,2156
16
- earthscope_sdk/common/context.py,sha256=vrCB_Ez-98Ir7c0GrCe-g7DuRCgc9vPaoRWFYf5q8Ko,5138
17
- earthscope_sdk/common/service.py,sha256=SCUZVJA3jFaEPeFrOf0v9osf2UpqldhlFmirOYWJjxM,1506
18
- earthscope_sdk/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- earthscope_sdk/config/_compat.py,sha256=P3F5y_Kf5zp9m9uOhl1Bp3ke6expxq4Sm9AeVaBbAHk,4610
20
- earthscope_sdk/config/_util.py,sha256=RZ6zvKrvjUkO7i69s7AVoIDhamRg4x71CAZLnucr9QM,1249
21
- earthscope_sdk/config/error.py,sha256=jh25q-b317lAvp32WwQw0zdYoV-MxZtg-n5FgZOMymI,95
22
- earthscope_sdk/config/models.py,sha256=1334Rxzw4qDLSdQg9btxFQySBOCb8TEW6J95M-lyKEc,8198
23
- earthscope_sdk/config/settings.py,sha256=I2DwEvfmETcaYbSvUybs0EIih0yiJO9D46WnWzKPqbo,8812
24
- earthscope_sdk-1.0.0b1.dist-info/licenses/LICENSE,sha256=E_MrVXxRaMQNpvZhsDuz_J9N_ux7dlL_WpYSsE391HU,11349
25
- earthscope_sdk-1.0.0b1.dist-info/METADATA,sha256=BHeAUzZ882lmEExnoVKIywGSYvIbyNdnIh8BzRJs2Ng,17988
26
- earthscope_sdk-1.0.0b1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
27
- earthscope_sdk-1.0.0b1.dist-info/top_level.txt,sha256=zTtIT9yN3JPJF7TqmTzqQcAvZZe4pAm907DLoGa5T_E,15
28
- earthscope_sdk-1.0.0b1.dist-info/RECORD,,