stac-fastapi.types 3.0.0a2__tar.gz → 3.0.0a4__tar.gz

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 (25) hide show
  1. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/PKG-INFO +1 -1
  2. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/config.py +1 -5
  3. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/core.py +62 -50
  4. stac_fastapi_types-3.0.0a4/stac_fastapi/types/version.py +2 -0
  5. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi.types.egg-info/PKG-INFO +1 -1
  6. stac_fastapi_types-3.0.0a2/stac_fastapi/types/version.py +0 -2
  7. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/README.md +0 -0
  8. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/setup.cfg +0 -0
  9. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/setup.py +0 -0
  10. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/__init__.py +0 -0
  11. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/conformance.py +0 -0
  12. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/errors.py +0 -0
  13. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/extension.py +0 -0
  14. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/links.py +0 -0
  15. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/requests.py +0 -0
  16. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/rfc3339.py +0 -0
  17. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/search.py +0 -0
  18. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi/types/stac.py +0 -0
  19. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi.types.egg-info/SOURCES.txt +0 -0
  20. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi.types.egg-info/dependency_links.txt +0 -0
  21. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi.types.egg-info/not-zip-safe +0 -0
  22. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi.types.egg-info/requires.txt +0 -0
  23. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/stac_fastapi.types.egg-info/top_level.txt +0 -0
  24. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/tests/test_limit.py +0 -0
  25. {stac_fastapi_types-3.0.0a2 → stac_fastapi_types-3.0.0a4}/tests/test_rfc3339.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac-fastapi.types
3
- Version: 3.0.0a2
3
+ Version: 3.0.0a4
4
4
  Summary: An implementation of STAC API based on the FastAPI framework.
5
5
  Home-page: https://github.com/stac-utils/stac-fastapi
6
6
  Author: Arturo Engineering
@@ -1,6 +1,6 @@
1
1
  """stac_fastapi.types.config module."""
2
2
 
3
- from typing import Optional, Set
3
+ from typing import Optional
4
4
 
5
5
  from pydantic_settings import BaseSettings, SettingsConfigDict
6
6
 
@@ -19,10 +19,6 @@ class ApiSettings(BaseSettings):
19
19
  as distinct columns in the database.
20
20
  """
21
21
 
22
- # TODO: Remove `default_includes` attribute so we can use
23
- # `pydantic.BaseSettings` instead
24
- default_includes: Optional[Set[str]] = None
25
-
26
22
  stac_fastapi_title: str = "stac-fastapi"
27
23
  stac_fastapi_description: str = "stac-fastapi"
28
24
  stac_fastapi_version: str = "0.1"
@@ -1,7 +1,8 @@
1
1
  """Base clients."""
2
2
 
3
-
4
3
  import abc
4
+ import importlib
5
+ import warnings
5
6
  from typing import Any, Dict, List, Optional, Union
6
7
  from urllib.parse import urljoin
7
8
 
@@ -22,6 +23,16 @@ from stac_fastapi.types.requests import get_base_url
22
23
  from stac_fastapi.types.rfc3339 import DateTimeType
23
24
  from stac_fastapi.types.search import BaseSearchPostRequest
24
25
 
26
+ __all__ = [
27
+ "NumType",
28
+ "StacType",
29
+ "BaseTransactionsClient",
30
+ "AsyncBaseTransactionsClient",
31
+ "LandingPageMixin",
32
+ "BaseCoreClient",
33
+ "AsyncBaseCoreClient",
34
+ ]
35
+
25
36
  NumType = Union[float, int]
26
37
  StacType = Dict[str, Any]
27
38
 
@@ -387,6 +398,25 @@ class BaseCoreClient(LandingPageMixin, abc.ABC):
387
398
  }
388
399
  )
389
400
 
401
+ # Add Aggregation links
402
+ if self.extension_is_enabled("AggregationExtension"):
403
+ landing_page["links"].extend(
404
+ [
405
+ {
406
+ "rel": "aggregate",
407
+ "type": "application/json",
408
+ "title": "Aggregate",
409
+ "href": urljoin(base_url, "aggregate"),
410
+ },
411
+ {
412
+ "rel": "aggregations",
413
+ "type": "application/json",
414
+ "title": "Aggregations",
415
+ "href": urljoin(base_url, "aggregations"),
416
+ },
417
+ ]
418
+ )
419
+
390
420
  # Add Collections links
391
421
  collections = self.all_collections(request=kwargs["request"])
392
422
 
@@ -591,6 +621,25 @@ class AsyncBaseCoreClient(LandingPageMixin, abc.ABC):
591
621
  }
592
622
  )
593
623
 
624
+ # Add Aggregation links
625
+ if self.extension_is_enabled("AggregationExtension"):
626
+ landing_page["links"].extend(
627
+ [
628
+ {
629
+ "rel": "aggregate",
630
+ "type": "application/json",
631
+ "title": "Aggregate",
632
+ "href": urljoin(base_url, "aggregate"),
633
+ },
634
+ {
635
+ "rel": "aggregations",
636
+ "type": "application/json",
637
+ "title": "Aggregations",
638
+ "href": urljoin(base_url, "aggregations"),
639
+ },
640
+ ]
641
+ )
642
+
594
643
  # Add Collections links
595
644
  collections = await self.all_collections(request=kwargs["request"])
596
645
 
@@ -737,53 +786,16 @@ class AsyncBaseCoreClient(LandingPageMixin, abc.ABC):
737
786
  ...
738
787
 
739
788
 
740
- @attr.s
741
- class AsyncBaseFiltersClient(abc.ABC):
742
- """Defines a pattern for implementing the STAC filter extension."""
743
-
744
- async def get_queryables(
745
- self, collection_id: Optional[str] = None, **kwargs
746
- ) -> Dict[str, Any]:
747
- """Get the queryables available for the given collection_id.
748
-
749
- If collection_id is None, returns the intersection of all queryables over all
750
- collections.
751
-
752
- This base implementation returns a blank queryable schema. This is not allowed
753
- under OGC CQL but it is allowed by the STAC API Filter Extension
754
- https://github.com/radiantearth/stac-api-spec/tree/master/fragments/filter#queryables
755
- """
756
- return {
757
- "$schema": "https://json-schema.org/draft/2019-09/schema",
758
- "$id": "https://example.org/queryables",
759
- "type": "object",
760
- "title": "Queryables for Example STAC API",
761
- "description": "Queryable names for the example STAC API Item Search filter.",
762
- "properties": {},
763
- }
764
-
765
-
766
- @attr.s
767
- class BaseFiltersClient(abc.ABC):
768
- """Defines a pattern for implementing the STAC filter extension."""
769
-
770
- def get_queryables(
771
- self, collection_id: Optional[str] = None, **kwargs
772
- ) -> Dict[str, Any]:
773
- """Get the queryables available for the given collection_id.
774
-
775
- If collection_id is None, returns the intersection of all queryables over all
776
- collections.
789
+ # TODO: remove for 3.0.0 final release
790
+ def __getattr__(name: str) -> Any:
791
+ if name in ["AsyncBaseFiltersClient", "BaseFiltersClient"]:
792
+ warnings.warn(
793
+ f"""importing {name} from `stac_fastapi.types.core` is deprecated,
794
+ please import it from `stac_fastapi.extensions.core.filter.client`.""",
795
+ DeprecationWarning,
796
+ stacklevel=2,
797
+ )
798
+ clients = importlib.import_module("stac_fastapi.extensions.core.filter.client")
799
+ return getattr(clients, name)
777
800
 
778
- This base implementation returns a blank queryable schema. This is not allowed
779
- under OGC CQL but it is allowed by the STAC API Filter Extension
780
- https://github.com/stac-api-extensions/filter#queryables
781
- """
782
- return {
783
- "$schema": "https://json-schema.org/draft/2019-09/schema",
784
- "$id": "https://example.org/queryables",
785
- "type": "object",
786
- "title": "Queryables for Example STAC API",
787
- "description": "Queryable names for the example STAC API Item Search filter.",
788
- "properties": {},
789
- }
801
+ raise AttributeError(f"module {__name__} has no attribute {name}")
@@ -0,0 +1,2 @@
1
+ """Library version."""
2
+ __version__ = "3.0.0a4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac-fastapi.types
3
- Version: 3.0.0a2
3
+ Version: 3.0.0a4
4
4
  Summary: An implementation of STAC API based on the FastAPI framework.
5
5
  Home-page: https://github.com/stac-utils/stac-fastapi
6
6
  Author: Arturo Engineering
@@ -1,2 +0,0 @@
1
- """Library version."""
2
- __version__ = "3.0.0a2"