Skip to main content

pysepal-api

📖 Documentation

UI-free HTTP client for SEPAL platform services. Powers Jupyter notebooks, Voila apps, CLI scripts, and background jobs running inside a SEPAL sandbox.

from pysepal_api import SepalClient

# sync — notebooks, CLI, jobs
with SepalClient(session_id="...") as sepal:
    listing = sepal.files.list("/")
    task = sepal.tasks.submit("image.download", params={...})
    sepal.tasks.wait(task.id)

    # escape hatch: any route the typed endpoints don't model
    image = sepal.get("/api/gee/image/json", params={"recipeId": "foo"}).json()
from pysepal_api import AsyncSepalClient

# async — Voila / Solara
async with AsyncSepalClient(session_id="...") as sepal:
    listing = await sepal.files.list("/")
    image = (await sepal.get("/api/gee/image/json", params={"recipeId": "foo"})).json()

The two clients are twins: identical surface, the only difference is await.

  • Scoped use — with SepalClient(...) / async with AsyncSepalClient(...). Construction never performs network I/O; entering the context creates the module results dir (when module_name is given).
  • Long-lived clients — sepal = SepalClient.create(...) / sepal = await AsyncSepalClient.create(...): same eager setup without a context manager; call close() / aclose() when done. async with AsyncSepalClient.create(...) also works.
  • Typed endpoints for the common cases: files, tasks, recipes, ee_exports. File verbs follow pathlib: read_bytes / read_text / read_json / write / mkdir.
  • Generic primitive — request() / get() / post() / put() / delete() — for any other SEPAL route, with the same typed-error mapping (NotFound, Unauthorized, …). Returns the raw httpx.Response.
  • One exception root — catch PysepalError for anything this library raises.

TLS is verified by default. host.docker.internal is auto-skipped for local dev; for any other self-signed host pass verify=False or list it in PYSEPAL_INSECURE_TLS_HOSTS (comma-separated, exact-host match).

Earth Engine exports

sepal.ee_exports (alias sepal.exports) routes notebook-created ee.Image and ee.FeatureCollection exports through SEPAL's TaskManager. It serializes the EE object into a Cloud API expression and submits an ee.export task — no new HTTP route, so tasks.wait(task.id) tracks it like any other task.

Requires the SEPAL backend adapter in openforis/sepal#454. See the export notebook for a runnable sandbox example.

Serializing a live EE object needs the optional Earth Engine extra:

pip install "pysepal-api[ee]"

submit_image(...) and submit_table(...) each take a destination of "SEPAL", "DRIVE", or "GEE":

import ee
from pysepal_api import SepalClient

ee.Initialize()
image = ee.Image("COPERNICUS/S2_SR/...").normalizedDifference(["B8", "B4"])
region = ee.Geometry.Rectangle([0, 0, 1, 1])

with SepalClient(session_id="...", module_name="my_module") as sepal:
    # → SEPAL sandbox. workspace_path is RELATIVE to your SEPAL home dir.
    task = sepal.ee_exports.submit_image(
        image=image, region=region, destination="SEPAL",
        name="ndvi_2026", scale=30,
        workspace_path="module_results/my_module/exports",
    )

    # → Google Drive
    sepal.ee_exports.submit_image(
        image=image, region=region, destination="DRIVE",
        name="ndvi_2026", scale=30, drive_folder="SEPAL/exports",
    )

    # → Earth Engine asset (asset_id is required for GEE)
    sepal.ee_exports.submit_image(
        image=image, region=region, destination="GEE",
        name="ndvi_2026", scale=30,
        asset_id="projects/my-project/assets/exports/ndvi_2026",
    )

    # FeatureCollection → asset
    sepal.ee_exports.submit_table(
        collection=ee.FeatureCollection("..."), destination="GEE",
        name="plots", asset_id="projects/my-project/assets/exports/plots",
    )

    sepal.tasks.wait(task.id)

Notes:

  • workspace_path is relative to your SEPAL home directory — never pass an absolute path (the worker rejects .. traversal).
  • destination="GEE" requires asset_id; omitting it raises ValueError before any network call.
  • image / collection / region accept either a live EE object (encoded for you) or an already-encoded Cloud API expression dict (no [ee] extra needed).
  • Table max_vertices is supported by the current backend only for Drive exports. ImageCollection asset exports require SEPAL's tiled recipe workflow.
  • The async twin AsyncSepalClient.ee_exports has the identical surface, differing only by await.

Metadata

Release files for pysepal-api 0.4.0

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

Source distribution (sdist)

Source distribution for pysepal-api 0.4.0
File Size Uploaded Provenance Actions
pysepal_api-0.4.0.tar.gz 50.7 kB With provenance Details for pysepal_api-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysepal-api 0.4.0
File Interpreter ABI Platform Actions
pysepal_api-0.4.0-py3-none-any.whl Python 3 none any Details for pysepal_api-0.4.0-py3-none-any.whl

Total release size: 76.7 kB

Release files / pysepal_api-0.4.0.tar.gz

Download URL pysepal_api-0.4.0.tar.gz
Size 50.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f4bac051c2cbb73f18c2c04377f50fb68dbb25b7263e95551cbe1fcbaafbdbee
BLAKE2b-256 checksum
How to use checksums
86d94b977de885a0931db119d37791016243a47b8636229ba48e6fa10c7555eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / pysepal_api-0.4.0-py3-none-any.whl

Download URL pysepal_api-0.4.0-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e46ab9b41ba23f6d7e5530393e26a85020010365ccf998660ee868e14e817a66
BLAKE2b-256 checksum
How to use checksums
2fff33a54bb7004a652ff51ab385ab1d003f6bae97cc6fb6130d730f7b5ef689
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for pysepal-api 0.4.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pysepal_api-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

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