Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

prescient-sdk

A Python SDK for the Prescient platform. Use it to search your Organization's STAC catalog, read its data, and run ingestions.

Documentation: https://sparkgeo.github.io/prescient-sdk/

If you used a version before 1.0, read Migrate to version 1.0. Version 1.0 removes the earlier sign-in settings and the S3 upload.

Install

The SDK needs Python 3.11 or later.

pip install prescient-sdk

Or from conda-forge:

conda install -c conda-forge prescient-sdk

Configure

The SDK signs in with an API key for your Organization. Create the key in the Keycloak Account Console of your Organization, on the API Keys page. The key starts with pk_.

Setting Required Value
prescient_endpoint_url Yes Your Organization host, for example https://<org>.<env>.prescient.earth
prescient_api_key Yes Your API key (pk_...)
prescient_auth_url No The Keycloak base URL. If you do not set it, the SDK gets it from prescient_endpoint_url

Set the values as environment variables, or put them in a config.env file in your working directory:

PRESCIENT_ENDPOINT_URL="https://<org>.<env>.prescient.earth"
PRESCIENT_API_KEY="pk_..."

Do not commit the file. For other ways to configure the client, see the configuration example.

Search the STAC catalog

This example needs pystac-client.

from pystac_client import Client

from prescient_sdk import PrescientClient

client = PrescientClient()
catalog = Client.open(client.stac_url, request_modifier=client.request_modifier)
items = list(catalog.search(max_items=10).items())

Asset links point at the platform over HTTPS. To read an asset, send the header from client.headers. You do not need AWS credentials. The STAC search example shows how to read an asset with rasterio.

Run an ingestion

You must be an admin of your Organization. The input files must already be in storage: version 1.0 cannot upload files.

from prescient_sdk import IngestClient, IngestResource, IngestSpec
from prescient_sdk.ingest_models import ErrorSeverity, Status

client = IngestClient()
spec = IngestSpec.from_file("spec.yaml")  # a version 2 spec: version: "2.0.0"

ing = IngestResource.create(client, spec)
ing.wait_until_ready()
problems = [e for e in ing.errors() if e.severity != ErrorSeverity.WARNING]
if ing.status is Status.READY and not problems:
    ing.start().wait_until_done()

See the ingest example.

Local development

The project uses uv for package management. Install uv with these instructions.

  1. Install the project with its development dependencies:

    uv sync
    
  2. Run the tests:

    uv run pytest
    
  3. Check and format the code with Ruff:

    uv run ruff check
    uv run ruff format
    

Add or remove dependencies

uv add <some-dependency>
uv add <some-dependency> --dev
uv remove <some-dependency>

For more, see the uv documentation.

Build the documentation

The documentation is a Jupyter Book in the docs folder.

  1. Build the HTML:

    uv run jupyter-book build docs/
    
  2. Open docs/_build/html/index.html in a browser.

Cut a release

  1. Make a branch from main. Name it with the new version, vX.Y.Z, following semantic versioning.

  2. Set the version in pyproject.toml under [project].

  3. Update uv.lock:

    uv sync
    
  4. Open a pull request against main. Get it reviewed and merged.

  5. Create a GitHub release with a tag and title vX.Y.Z. Describe the main changes.

    The release starts the GitHub Actions that publish to PyPI and update the documentation on GitHub Pages.

  6. Release to conda-forge. This step is manual. See the next section.

Conda-forge

This package is on conda-forge. For the full documentation, see https://conda-forge.org/docs/maintainer/. To release a new version, you must be a maintainer of the conda-forge recipe. To become a maintainer, follow https://conda-forge.org/docs/maintainer/updating_pkgs/#updating-the-maintainer-list

The feedstock repository is https://github.com/conda-forge/prescient-sdk-feedstock

Make changes to the feedstock repository from a fork. Do not create a branch in the repository itself.

Update the conda-forge release after a PyPI release

A conda-forge bot opens a pull request in the feedstock repository after a new PyPI release. The pull request can miss changes, for example new dependencies.

  1. Review the meta.yaml file in the recipe folder of the bot's pull request.

  2. Generate a meta.yaml file locally with grayskull. Compare it with the file in the pull request, to check the dependencies.

  3. To keep several versions on conda-forge, make a separate pull request from a different branch. Follow https://conda-forge.org/docs/maintainer/updating_pkgs/#maintaining-several-versions

Metadata

Release files for prescient-sdk 1.0.0rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prescient-sdk 1.0.0rc1
File Size Uploaded Provenance Actions
prescient_sdk-1.0.0rc1.tar.gz 294.2 kB Without provenance Details for prescient_sdk-1.0.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for prescient-sdk 1.0.0rc1
File Interpreter ABI Platform Actions
prescient_sdk-1.0.0rc1-py3-none-any.whl Python 3 none any Details for prescient_sdk-1.0.0rc1-py3-none-any.whl

Total release size: 323.7 kB

Release files / prescient_sdk-1.0.0rc1.tar.gz

Download URL prescient_sdk-1.0.0rc1.tar.gz
Size 294.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5d02dce43ee3818b2d9433fff0f1d3f350cfa96478cfcd5370ba8fc8050a4b6b
BLAKE2b-256 checksum
How to use checksums
4783386f761718e7807ca0e6a437a80add6d01abba6097a41d075f8bced99477
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / prescient_sdk-1.0.0rc1-py3-none-any.whl

Download URL prescient_sdk-1.0.0rc1-py3-none-any.whl
Size 29.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b32e4a956fb1a3d0b0ac246153816c18ec0ac340a09230cbdc8de4a200b3b57
BLAKE2b-256 checksum
How to use checksums
ebdd2ee776de19a1606179330c13d7685075ade6323fd3696d21f4a94438e020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for prescient-sdk 1.0.0rc1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page