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 replaces 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 be in your Organization bucket or in an External bucket.
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.
Upload local files
You need the ingest permission in your Organization. upload sends the files in a local directory to an Upload location in your Organization bucket and returns the location. Use the location as a location path in an ingestion spec.
from prescient_sdk import PrescientClient, upload
client = PrescientClient()
location = upload(client, "/data/rasters", "rasters/2026", pattern=r".*\.tif$")
A location is 1 to 4 /-separated parts of lower-case letters, digits, ., _ and -. If you do not give one, the platform creates one. Files that already exist in the location are skipped, so you can run an interrupted upload again to send the rest. Pass overwrite=True to replace them.
To resume, run the upload again with the same location. If you did not give one and the upload fails, the created location is only in the SDK's INFO log, and a new call creates another location. So give a location for any upload you may need to resume.
If a spec points a location at a local directory, spec.with_uploaded_sources(["<source file set>"], client=client) uploads the files that the source file set selects and returns a new spec that points at the Upload location.
Local development
The project uses uv for package management. Install uv with these instructions.
-
Install the project with its development dependencies:
uv sync -
Run the tests:
uv run pytest -
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.
-
Build the HTML:
uv run jupyter-book build docs/ -
Open
docs/_build/html/index.htmlin a browser.
Cut a release
-
Make a branch from
main. Name it with the new version,vX.Y.Z, following semantic versioning. -
Set the version in pyproject.toml under
[project]. -
Update uv.lock:
uv sync -
Open a pull request against
main. Get it reviewed and merged. -
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.
-
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.
-
Review the
meta.yamlfile in therecipefolder of the bot's pull request. -
Generate a
meta.yamlfile locally with grayskull. Compare it with the file in the pull request, to check the dependencies. -
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.1.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prescient_sdk-1.1.0rc1.tar.gz | 300.0 kB | Without provenance | Details for prescient_sdk-1.1.0rc1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prescient_sdk-1.1.0rc1-py3-none-any.whl | Python 3 | none | any | Details for prescient_sdk-1.1.0rc1-py3-none-any.whl |
Total release size: 331.3 kB
Release files / prescient_sdk-1.1.0rc1.tar.gz
| Download URL | prescient_sdk-1.1.0rc1.tar.gz |
|---|---|
| Size | 300.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7eda0510fb3acbefaae078872dafdbfffc5abb93022682336f32f5657d0749f4
|
|
BLAKE2b-256 checksum How to use checksums |
16feb9b4ae090674ca5951f156d1f660bf1dcda1537c4e526efe48c511908518
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / prescient_sdk-1.1.0rc1-py3-none-any.whl
| Download URL | prescient_sdk-1.1.0rc1-py3-none-any.whl |
|---|---|
| Size | 31.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6554415d9bc1c09732cee17dae0347c25b78a7cd64d90f75d543ddb72631a2dc
|
|
BLAKE2b-256 checksum How to use checksums |
19e10c0d5d4b6497a270595f0eaf40ebd1adb5979ffa18b904284174075142d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for prescient-sdk 1.1.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.