Giter Club home page Giter Club logo

stac-fastapi's Introduction

FastAPI implemention of the STAC API spec.

Test Package version License


Documentation: https://stac-utils.github.io/stac-fastapi/

Source Code: https://github.com/stac-utils/stac-fastapi


Python library for building a STAC compliant FastAPI application. The project is split up into several namespace packages:

  • stac_fastapi.api: An API layer which enforces the stac-api-spec.
  • stac_fastapi.extensions: Abstract base classes for STAC API extensions and third-party extensions.
  • stac_fastapi.types: Shared types and abstract base classes used by the library.

Backends

Backends are hosted in their own repositories:

stac-fastapi was initially developed by arturo-ai.

Response Model Validation

A common question when using this package is how request and response types are validated?

This package uses stac-pydantic to validate and document STAC objects. However, by default, validation of response types is turned off and the API will simply forward responses without validating them against the Pydantic model first. This decision was made with the assumption that responses usually come from a (typed) database and can be considered safe. Extra validation would only increase latency, in particular for large payloads.

To turn on response validation, set ENABLE_RESPONSE_MODELS to True. Either as an environment variable or directly in the ApiSettings.

With the introduction of Pydantic 2, the extra time it takes to validate models became negatable. While ENABLE_RESPONSE_MODELS still defaults to False there should be no penalty for users to turn on this feature but users discretion is advised.

Installation

# Install from PyPI
python -m pip install stac-fastapi.types stac-fastapi.api stac-fastapi.extensions

# Install a backend of your choice
python -m pip install stac-fastapi.sqlalchemy
# or
python -m pip install stac-fastapi.pgstac

Other backends may be available from other sources, search PyPI for more.

Development

Install the packages in editable mode:

python -m pip install -e \
  'stac_fastapi/types[dev]' \
  'stac_fastapi/api[dev]' \
  'stac_fastapi/extensions[dev]'

To run the tests:

python -m pytest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.