/pysepal:pysepalfrom pysepal
Provides component discovery, GEE async patterns, translation handling, error diagnosis, and Solara best practices for pysepal-based SEPAL apps. Invoke as /pysepal, /pysepal diagnose, or /pysepal audit.
Ships in pysepal. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Expertise skill for developing with pysepal — the Python library for ipyvuetify/Solara dashboards on SEPAL. Provides component discovery, GEE patterns, error diagnosis, and Solara best practices.
Invoke as /pysepal (knowledge), /pysepal diagnose (error matching),
or /pysepal audit (stale pattern check).
Path conventions: paths in this skill without a leading
~or/are relative to the pysepal repo root (e.g.docs/guides/...,pysepal/templates/...). Installed as a Claude Code plugin, that root is${CLAUDE_PLUGIN_ROOT}; otherwise substitute the path of your local pysepal checkout.
This skill documents pysepal 4.3.0. Compare that with the pysepal installed in the app's environment before relying on any API detail here:
python -c "import importlib.metadata as m; print(m.version('pysepal'))"
If the two differ, say so up front. Wherever this skill and the installed package
disagree, the installed package's docstrings win. Suggest claude plugin update pysepal when the skill is behind, or upgrading pysepal when the app is behind.
This skill is the source of truth for how to build a pysepal app. The package
documentation under docs/ lags behind the code: the Voila tutorials,
sw.App + ui.ipynb and Translator attribute lookups are out of date. Read a
guide for depth. When a document and this skill disagree, follow the skill and
treat the document as stale.
Two rules come before everything else:
@solara.component, and MapApp(...) from
pysepal.solara.components.map_app is its shell (new in 4.2). The legacy
pysepal.sepalwidgets.vue_app.MapApp, used as MapApp.element(...), still
works; new code uses the native one.msg(). See
"Translations" below.Never assume which pysepal components exist. Run discovery first. Without
--repo-root the script inspects the pysepal installed in the current
environment, which is the API the app actually runs against:
python skills/pysepal-app/scripts/discover_pysepal_components.py
Pass --repo-root <checkout> to inspect a checkout instead.
Use the output as the only source of truth for component names and import paths. If the script fails, ask the user for the correct pysepal repo path.
Full reference: docs/guides/solara-gee-patterns.md
# Get the session-backed interface
gee_interface = get_current_gee_interface()
# Call async methods directly — no asyncio.to_thread for GEE
result = await gee_interface.get_info_async(ee_object)
assets = await gee_interface.get_assets_async(folder) # in a component: use_gee_assets()
asset = await gee_interface.get_asset_async(asset_id)
map_id = await gee_interface.get_map_id_async(image, vis)
# use_task must keep coroutines on Solara's loop
@solara.lab.use_task(dependencies=None, raise_error=False, prefer_threaded=False)
async def gee_job(request):
return await gee_interface.get_info_async(request.ee_object)
Rules:
prefer_threaded=False on all GEE use_task hooksawait gee_interface.*_async(...) for all Earth Engine callsasyncio.to_thread(...) only for non-GEE blocking work (file I/O, CPU)gee_interface instance down to child components and SepalMapFor complex layout (responsive positioning, CSS variables, animations,
viewport-aware sizing), use Vue templates — not rv.* elements. Solara
itself recommends this: "It can be beneficial for performance, since
instead of creating many widgets from the Python side we only send data
to the frontend."
Two patterns:
@solara.component_vue("Widget.vue") — auto-generates traitlets from
the function signature. Preferred for new widgets.v.VuetifyTemplate subclass + .element() — more control, used by
existing pysepal widgets (the legacy MapApp, FileInput, TaskButton).For simple inputs, buttons, state display — use @solara.component with
rv.* elements (cheaper, testable in pure Python).
Read docs/guides/ipyvuetify-widgets.md for the full
guide with examples of both approaches.
Inside with rv.Something():, always use rv.Widget(...). Using
v.Widget(...) silently produces nothing — no error, empty DOM.
# WRONG — invisible
with rv.CardActions():
v.Btn(children=["OK"])
# CORRECT
with rv.CardActions():
rv.Btn(children=["OK"])
solara.Column captures children into its own tree, detaching them from
the rv. parent.
# WRONG — CardText stays empty
with rv.CardText():
with solara.Column():
rv.Select(...)
# CORRECT
with rv.CardText():
rv.Select(...)
Reacton matches a container's children by position and type. An element that
appears only sometimes (if status: Alert(...)) moves every later sibling, and
a sibling whose type changes at its position is unmounted and built again. Its
hooks start over. A use_task in it loses its state, but the coroutine keeps
running with no component left to show or cancel it.
Symptom: a TaskButtonComponent flips to Cancel and back to its start label on
the first click only. Later clicks work, because the alert is already there, and
the second click starts a duplicate run. Key the conditional element and the
stateful sibling after it:
if status.value is not None:
StatusAlert(...).key("status")
with rv.Html(tag="div", class_="d-flex").key("actions"):
CalculationAction(...) # holds a use_task
Alternatively put the conditional element after the stateful one.
An element created inside a with block becomes a child of that container,
unless it is passed as a prop to another element created in the same block.
Create it only when it is passed on, or it renders twice:
icon = rv.Icon(children=["mdi-magnify"])
rv.TextField(..., v_slots=[{"name": "prepend-inner", "children": icon}])
Give an element all its slots on its first render. The browser does not draw a
slot that is added to an element after it mounted, although Python shows it in
v_slots. A test that walks v_slots does not see the difference.
A v.Card has elevation 2 by default. Kept from a widget layout around a single
field, it shows as a shadow strip in the light theme (hard to see in dark). Use
elevation=0 for content cards in steps and dialogs.
All map-based pysepal apps use MapApp as the layout shell. Do not build
custom solara.Columns layouts. MapApp is a plain @solara.component. Steps
and panel sections are plain dicts; a content is a Solara element, a widget,
or a list of them, so @solara.component tiles and
solara.Button(..., on_click=...) go straight in.
from pysepal.solara import get_current_theme_state
from pysepal.solara.components.map_app import MapApp
# Scope-keyed theme state — the shell's built-in toggle and the map follow it
theme_state = get_current_theme_state()
sepal_map = SepalMap(fullscreen=True, theme_state=theme_state, gee=True)
MapApp(
app_title="My App",
app_icon="mdi-earth",
main_map=[sepal_map],
steps_data=[
{"id": 1, "name": "AOI", "icon": "mdi-map",
"display": "step", # or "dialog"
"content": AoiStep()},
],
theme_state=theme_state,
locales=messages.available_locales(), # the built-in language selector
right_panel_config={"title": "Tools", "icon": "mdi-cog", "width": 400},
right_panel_content=[
{"title": "Section", "icon": "mdi-cog", "content": [LayerControls()],
# Static guidance belongs here, not in a solara.Info alert.
"description": "Shown under the section title."},
],
# Pinned under the scrolling sections, e.g. a persistent action bar.
right_panel_footer=[ActionBar()],
right_panel_open=True,
)
fullscreen=True on the map is what makes it fill the shell. The shell has no
model=, theme_toggle= or language_selector=: the toggle and the selector
are built in. It owns its state, so a value passed on every render does not undo
what the user did; only a change of the value is an instruction. To follow or
drive the active step, keep it in a reactive and pass the matching callback:
step = solara.use_reactive(1)
MapApp(..., current_step=step.value, on_current_step=step.set)
# same pairs: step_open / on_step_open, right_panel_open / on_right_panel_open
Every argument, and the move from the legacy MapApp.element:
docs/guides/solara-mapapp-component.md.
A step's actions list draws the buttons under a dialog step. "close": True
closes the step, "next": <step id> opens any step (so Back is next set to the
previous step id), and "cancel": True only draws the button outlined. A step
with "right_panel_action": "toggle" and empty content toggles the right panel
instead of opening a window.
{"id": 3, "name": "Settings", "display": "dialog", "content": [Settings()],
"actions": [{"label": "Close", "close": True, "cancel": True},
{"label": "Back", "next": 2, "cancel": True},
{"label": "Next", "next": 4}]}
Pass docs_url= with the app's published guide, for the Documentation link.
To show and hide a map layer from a control, keep the prepared tiles (the
use_task result) and add or remove the layer in an effect on a shown
reactive. Showing it again then needs no Earth Engine request. Reset shown in
an effect on the input the layer depends on, if a new input must show the layer
again.
SepalMap(theme_toggle=...) still works but emits a DeprecationWarning;
pass theme_state= instead. See docs/guides/migration-notes-v3.4.md § 7.
One worked example lives in the pysepal repo — read it before building a new app to see the patterns in action:
demo_apps/solara_map_app/ — MapApp shell with AoiView
in the right panel, NotificationProvider task tracking, ExportLauncher
sources, and a LegendComponent whose layer selector is driven by the layers
on the map. app.py holds the shell: MapAppDemo owns the UI so Page
(Solara, session-authenticated) and ui.ipynb (Voila) can share it. The rest
lives under component/ — parameter/ (layer ids, vis params), model/
(dataclasses in reactives), scripts/ (Earth Engine work, no UI), tile/
(right-panel sections), widget/ (map, layer lifecycle, floating legend).An rv.Dialog inside right_panel_content or steps_data mounts when it
opens; it does not need eager=True. The legacy MapApp.element embedded
content through <jupyter-widget>, where it did. Drop eager=True when you
move an app: an eager dialog is built with the page, so its tasks run at page
load, once per session, not on each open.
All pysepal Solara components follow the Solara reactive pattern:
@solara.component
def MyComponent(
value: Union[T, solara.Reactive[T]] = default,
on_value: Optional[Callable[[T], None]] = None,
):
reactive_value = solara.use_reactive(value, on_value)
del value, on_value
Components that do async work should expose loading/on_loading so
parents can disable buttons:
AssetSelectComponent(
value=asset_data,
loading=asset_loading, # parent wires this to disable submit
)
AssetSelectComponent lists the user's assets once per session and shares the
list with every other field. A custom asset field reads the same list with
use_gee_assets(folder) from pysepal.solara.components.inputs, rather than
calling get_assets_async on each mount. reload_gee_assets() lists every
folder of the session again and refreshes every field; the sync icon calls it.
Call it once an export to an asset has finished, not when it starts:
listing = use_gee_assets()
ids = [a["id"] for a in listing.assets if a["type"] == "IMAGE_COLLECTION"]
# listing.loading and listing.error; reload_gee_assets() for a refresh
All event feedback (success, error, warnings, task progress) goes through
the centralized notification system. Do NOT add inline solara.Error(),
solara.Success(), or Alert widgets for events — use the notification
API instead. A lasting reason, such as why a button is disabled, is state and
stays on the page: see "Events go to the bus; state stays on the page" below.
Setup: Mount NotificationProvider() once at the app root:
from pysepal.solara.notifications import NotificationProvider
@solara.component
def Page():
NotificationProvider()
MapApp(...)
Inside Solara components — use the hook:
from pysepal.solara.notifications import use_notifications
@solara.component
def MyComponent():
notifications = use_notifications()
# Toasts (auto-dismiss after 3s, click to dismiss; errors stay until closed or a new task starts)
notifications.success("Done!")
notifications.error("Failed!")
notifications.warning("Check config")
notifications.info("Processing...")
# Task tracking (shows in pill + logger)
async def process():
with notifications.track("Processing data", total_steps=3) as task:
task.step("Loading...")
await do_work()
task.step("Computing...")
await do_more()
task.step("Finalizing...")
notifications.success("Complete!")
solara.lab.use_task(process, dependencies=None, raise_error=False)
Outside components (scripts, decorators, background threads):
from pysepal.solara.notifications import notify, track_task
notify("Export failed", type_="error")
with track_task("Exporting", total_steps=2) as task:
task.step("Preparing...")
task.step("Uploading...")
Architecture:
state.py — frozen dataclasses (Toast, TrackedTask, TaskMilestone)bus.py — kernel-scoped NotificationBus with dedup, error replacement,
queue cap, task retention cap, refcounted registrynotifier.py — Notifier publisher + TaskTracker context managerhook.py — use_notifications() Solara hookprovider.py — NotificationProvider root componentnotification_ui.py + NotificationUI.vue — Vue-rendered UIglobals.py — notify() / track_task() escape hatchesKey rules:
NotificationProvider must be mounted BEFORE components that call
use_notifications(). Without one the hook raises
NotificationProviderError (pysepal 4.0; it used to return a silent
NoopNotifier).
"Before" means earlier in render order, and a component can never provide for itself. The bus is created when the provider element renders, which is after the body that created it has finished, so this raises:
@solara.component
def MyApp(): # WRONG -- raises NotificationProviderError
NotificationProvider()
notifications = use_notifications()
Put the provider in an enclosing component, or in an earlier sibling, and do the consuming one level down:
@solara.component
def MyApp(): # CORRECT -- Panel renders after the provider
NotificationProvider()
Panel()
A shared component with two entrypoints (a Solara Page and a Voila
ui.ipynb that displays it directly) must therefore mount the provider
itself and consume in a child, as demo_apps/solara_map_app does. Mounting
it only in Page leaves the Voila path with no provider, so the hook raises
there.
A component published for reuse, which may render outside an app shell,
passes use_notifications(required=False) and reports feedback itself. It
then gets a NoopNotifier, which logs every dropped message at WARNING.
App code never passes it.
notify() / track_task() do not raise: a script or worker with no UI is a
legitimate caller, so they log and carry on.
Errors replace previous errors on the bus (only the latest is kept).
A subscriber may publish to the bus from its own callback; the nested publication is deferred until the running dispatch finishes.
The Vue UI subscribes to the bus via Reactive.subscribe(), NOT by
reading .value in the render body. This prevents notification changes
from triggering parent component re-renders (which would disrupt
MapApp layout).
The task pill and the legend track the shell through CSS variables that
MapApp publishes on the page root (--sepal-notification-right-offset,
--sepal-notification-pill-display, --sepal-top-reserved,
--sepal-right-panel-width, --sepal-drawer-width,
--sepal-bottom-reserved). No DOM polling. Mount NotificationProvider()
and the legend next to the shell and they follow it.
The @catch_errors decorator is NOT modified. It continues to work
with legacy Alert widgets only. The notification system is independent.
Events go to the bus; state stays on the page. A reason that holds until the user changes something, such as why an action is disabled, is state:
external_busy until its
inputs are complete; do not hide it until a choice is made.rv.Alert(type="warning", text=True, dense=True) with one short line per item ("Sub-indicator A is not ready: …").
Not one outlined alert per item. text=True is the filled style sw.Alert
uses by default.hint with persistent_hint=True and name what the
reason belongs to.Reference demo:
demo_apps/solara_map_app/ — provider in app.py,
use_notifications in component/tile/process.py
Apps that produce exportable GEE layers (images / feature collections)
should use ExportLauncher — a single button that opens a dialog covering
Earth Engine asset, Google Drive, and SEPAL workspace destinations through
one async engine. Do NOT roll your own export flow unless the dialog
genuinely cannot express your requirements.
Setup: declare one ExportSource per exportable layer and drop the
launcher in the right panel or toolbar:
from pysepal.solara.components.export import ExportLauncher, ExportSource, ResolvedExport
sources = (
ExportSource(
id="dem",
label="Elevation (DEM)",
kind="image", # "image" or "table"
resolve=lambda: ResolvedExport(
ee_object=ee.Image("USGS/SRTMGL1_003").clip(aoi.value),
default_name="SRTM_elevation",
region=aoi.value,
default_scale=30,
),
),
)
ExportLauncher(sources=sources, button_text=True)
Key rules:
ExportSource.resolve is a 0-arg callable. The hook and the dialog call it
on every render for the selected source (to check the kind and fill the
defaults), not only on Export. Build the ee object lazily (clipping,
compositing) and make no Earth Engine request in it: no getInfo(). Leave
ResolvedExport.bands out and pysepal reads the bands itself with one async
request.ExportSource(..., disabled=True, description=...) lists a layer that is not
ready yet, so one launcher can show every exportable layer.ee kind returned by resolve() must
agree; mismatches surface as an error toast rather than a crash."GEO_TIFF" (not
"GeoTIFF"), "GEO_JSON" (not "GeoJSON"), "SHP", "CSV", "KML",
"KMZ". The constants DEFAULT_IMAGE_FILE_FORMAT,
DEFAULT_TABLE_FILE_FORMAT, and the value fields of
TABLE_FILE_FORMATS already use canonical strings.ee-client >= 2.5.2 is required (pyproject.toml enforces). 2.5.1 had a
table-to-asset serializer bug.SepalClient is available — don't pass one explicitly in normal apps,
use_export_dialog picks it up via get_current_sepal_client().use_export_dialog(sources=...) + render ExportDialog(controller=...)
yourself. The controller exposes open_dialog, close_dialog,
submit_export, result, task.Architecture:
export_models.py — ExportSource, ResolvedExport, ExportRequest,
ExportResult, pure helpers (sanitize_export_name,
resolve_asset_folder, resolve_sepal_folder, infer_export_kind)export_engine.py — pure async submit_export_request(...); handles
folder creation, EE task submission, Drive staging for SEPAL targets,
cleanupexport_hook.py — use_export_dialog(...) controller; holds the
reactive dialog state and the solara.lab.use_task runnerexport_dialog.py — ExportDialog modal UIexport_launcher.py — ExportLauncher one-button entry pointexport.py — public import surface + legacy ExportDataComponent compat
wrapperTesting pattern: pure-function helpers test normally; render-tree
tests must wrap .widget(...) in asyncio.run(...) so
solara.lab.use_task can schedule at mount. Post-selection assertions
(destination RadioGroup, scale BtnToggle) require driving the controller
into a selected+open state before the walk — see
tests/test_solara/test_export_component.py::_render and
_render_preselected_dialog.
Reference demo:
demo_apps/solara_map_app/component/scripts/exports.py (sources)
and component/tile/export.py (launcher)
Full guide: docs/guides/solara-export.md
All buttons that trigger async work must use TaskButtonComponent.
Read docs/guides/solara-gee-patterns.md § "Async
Button Convention" for the canonical pattern, rules, and cancel semantics.
SHAPE and POINTS read the user's files through get_current_filesystem(): the
local disk, or in a multi-user container the user's SEPAL workspace through the
session's client. A container app without @with_sepal_sessions has no files,
so pysepal does not offer them there. Drop them with an explicit allowlist only
when the app should not offer them. Read
docs/guides/solara-gee-patterns.md § "AOI Method
Restrictions" for the full matrix.
Use AoiView for the area of interest, not an app-made picker. AoiView(map_=...)
needs map_.gee == gee; otherwise it raises ValueError.
Never do blocking file I/O inside use_effect — it freezes the UI.
Use use_task + asyncio.to_thread instead. Read
docs/guides/solara-gee-patterns.md § "Blocking I/O
in Solara Components" for the pattern.
An asyncio.to_thread worker has no kernel context. Do not call msg() or
notify() in it. Return the result and publish after the await. See
"Translations" § "Workers and the locale".
pysepal.i18n)Every user-facing string comes from a JSON catalogue through one lookup,
msg("dotted.key"). Translator attribute lookups (ms.section.key),
pysepal.message.ms, LocaleState, use_locale() and locale_state= are
gone from Solara apps. Translator survives only for the legacy Voila widgets.
Layout. The app owns component/message/: one __init__.py and one folder
per locale. English is the source of truth. Every other locale is an overlay,
and a key it lacks falls back to English.
component/message/
├── __init__.py # messages = catalog(...); msg = messages.msg
├── en/app.json # every key lives here
├── es/app.json # overlay
└── fr/app.json
# component/message/__init__.py
from pathlib import Path
from pysepal.i18n import catalog
messages = catalog(Path(__file__).parent)
msg = messages.msg
{
"app": { "title": "Risk mapping" },
"toasts": {
"saved": "Saved {name}",
"cleared": {
"one": "{count} layer removed",
"other": "{count} layers removed"
}
}
}
Use. Import messages and msg from the app's own package, not from
pysepal:
from component.message import messages, msg
@solara.component
def Page():
NotificationProvider()
MapApp(
app_title=msg("app.title"),
locales=messages.available_locales(), # the shell mounts the language selector
)
msg("toasts.saved", name=layer) fills named placeholders. Only bare
{name} placeholders are valid: no {0}, no {area:.2f}, no {obj.attr}.
Format numbers in the caller and pass the string.msg("toasts.cleared", count=n) selects the plural form when the English
key is a plural node: an object whose keys are CLDR categories (one,
other, and per language zero, two, few, many). Each locale writes
only the categories its rules use; Babel supplies the rules. On any other key
count is an ordinary placeholder.msg() re-renders when the language changes, also
through a helper on its call stack. Keys may come from data, for example a
registry table that stores keys.current_locale() / set_locale(code) from pysepal.i18n read and change
the locale. It is one Solara reactive per kernel, so users never share it. A
selector's first browser mount overwrites it (localStorage, then
navigator.language, then English), so set_locale cannot seed a default.MapApp, mount LocaleSelectComponent(locales=...) from
pysepal.solara.components.locale_select inside the component.messages.check() returns a tuple of CatalogProblem(code, locale, key, detail). Assert it is empty in a test. Codes: missing_key, extra_key,
placeholder_mismatch, malformed_template, shape_mismatch,
unsupported_plural_category, unreadable_locale.catalog(folder) is strict: a missing English key or a malformed English
template raises. catalog(folder, strict=False) renders ⟦key⟧ instead. A
translator's mistake never raises: it is reported once in the log and
English shows. An empty string in a translation (Pontoon export) means "not
translated" and also shows English.from pysepal.message import msg.Workers and the locale. Solara keys the kernel context by thread:
| Code runs in | Sees the user's locale |
|---|---|
A render, an event handler, a use_task body (threaded or not), a threading.Thread created inside the kernel | yes |
asyncio.to_thread, any executor thread, a thread created at import | no: the process default, usually English |
Let such workers return results, or a message key plus named values, and call
msg() in the UI context that receives them. Never call msg() from a pool
thread. A prefer_threaded=True body keeps the locale but runs on its own
event loop, so it must stay on the synchronous GEE API (see the event-loop
error below).
After you add a locale, switch to it in the browser and open every step. A text that stays in English is a key that is missing from the locale file.
Errors from code without a UI. Keep the science and storage packages free of
component.message imports, so their tests run without pysepal. Raise an
error that keeps a message key, and let the catalogue register the lookup:
# mgci/errors.py (no UI import)
translate = None # set by component.message
class LocalizedError(ValueError):
def __init__(self, key, **values):
super().__init__(key)
self.key, self.values = key, values
def __str__(self):
return translate(f"errors.{self.key}", **self.values) if translate else f"errors.{self.key}"
# component/message/__init__.py
import mgci.errors
mgci.errors.translate = msg
The text is looked up when the error is shown, so a render or a task gets the user's language.
What stays English. Translate only what the user reads in the app. Report tables, default export names (asset names cannot hold accents) and the metadata written into exported images stay in English in every locale. Keep the English names in a constant and translate only the display labels from it.
Migrating a 3.x app:
| 3.x | 4.0 |
|---|---|
ms = Translator(folder, target=locale) | messages = catalog(folder); msg = messages.msg |
ms.section.key | msg("section.key") |
ms.section.key.format(x), {0} in JSON | msg("section.key", name=x), {name} in JSON |
"layer(s)" | a plural node with one / other, and count= |
use_locale(), LocaleState, locale_state= | current_locale() / set_locale() |
language_selector=[LocaleSelect(...)] | locales=messages.available_locales() |
All four demo_apps/ are translated (en, es, fr); solara_raster_app shows
plural nodes. Full text: docs/source/tutorials/translate-app.rst and
docs/guides/migration-v4.md § 6.
One component covers both filesystems and both counts:
| Need | Use |
|---|---|
| One path | FileInputComponent |
| Several paths | FileInputComponent(multiple=True) (new in 4.2) |
| Files and folders | FileInputComponent(multiple=True, select_folders=True) |
Read and write user files through get_current_filesystem() (from
pysepal.solara), never pathlib or SepalClient.files directly. It returns a
LocalFileSystem (the home folder) in Voila, notebooks and a SEPAL sandbox, and
a SandboxFileSystem (the user's workspace through their client) in a shared
app-launcher container, where the process disk belongs to no user. Both speak
the same absolute paths under fs.root (/home/sepal-user on SEPAL), refuse
paths outside it, and offer list, read_bytes/read_text/read_json,
write, mkdir and local_copy (a local path for readers like
gpd.read_file; a shapefile brings its sidecars), each with an *_async twin:
fs = get_current_filesystem() # in the render, or at the start of a task
spec = await fs.read_json_async("module_results/my_app/aoi.json")
async with fs.local_copy_async(path) as local:
gdf = await asyncio.to_thread(gpd.read_file, local)
FileInputComponent browses that same filesystem by default (pass
filesystem= to pick another). Its value is an absolute path as a str; read
it through the filesystem, not open().
With multiple=True the value is a list[str], and a "" value reads as [].
A click on a file adds or removes it, and the selection stays when the user
opens another folder. extensions= filters the listing in both modes.
select_folders=True (only with multiple=True) puts a check on each folder:
the check selects it, a click on the row still opens it. A list passed as
value seeds the selection; the widget drops any path outside root.
clearable=False hides the clear button; paths are then removed one at a time
from the field's menu.
tables = solara.use_reactive([])
FileInputComponent(value=tables, multiple=True, extensions=[".csv"])
for path in tables.value: # list[str]
...
demo_apps/solara_map_app has a Files dialog step with every variation, each
above the value it hands the app.
Do not reach for solara.FileBrowser or solara.FileBrowserMultiple in a
pysepal app. They read the process filesystem through pathlib and take no
client, so they cannot serve a sandbox, and an app built on them stops working
the moment it is deployed to SEPAL. pysepal apps use FileInputComponent.
Always use ipecharts for charts in pysepal apps — bar, line, pie,
scatter, heatmap, 3D, network graphs, etc. Do not use matplotlib,
plotly, or other charting libraries unless the user explicitly asks.
solara.FigureEcharts is not an exception: it takes raw option dicts, fetches
ECharts from a CDN at mount, and rebuilds the chart on every update. The guide's
"Why not solara.FigureEcharts?" section holds the full comparison — read it
before re-opening the question when an upstream release touches that component.
A chart follows the size of its container by itself since ipecharts 1.4.2, also
in a container that changes width or starts hidden (a map MenuControl).
Require ipecharts>=1.4.2 and write no resize code.
Read docs/guides/ipecharts.md before creating any
chart. It covers both approaches (EChartsRawWidget for quick prototypes,
EChartsWidget for reactive dashboards), Solara integration via
.element(), event handling, theming, and common gotchas.
# Solara integration — mount with .element()
from ipecharts import EChartsWidget
from ipecharts.option import Option, XAxis, YAxis
from ipecharts.option.series import Bar
option = Option(
xAxis=XAxis(type="category", data=categories),
yAxis=YAxis(type="value"),
series=[Bar(data=values)],
)
EChartsWidget.element(option=option, style={"height": "300px"})
Call setup_logging("APP", config_path=...) from pysepal.logger first in the
entry point, before init_ee(). Name module loggers APP.<area> so they
inherit its level and handler, and add a [loggers.pysepal] table to the TOML to
see pysepal's own logs. eeclient at DEBUG logs every request: noisy, but the
quickest way to count requests while you click through the app.
use_task needs a running event loop at mount. Use
unittest.IsolatedAsyncioTestCase (or asyncio.run), or the render raises
"no running event loop".patcher.start() plus
self.addCleanup(patcher.stop). A re-render after a with patch(...) block
has exited builds the real component.children and the children of each v_slots entry to find widgets.
A slot added after mount is not on the page: see "Elements passed as props,
and slots".gee_interface whose *_async methods record their calls. Drive a MapApp
step with vue_click(None) on its drawer item: the widget with a vue_click
method and item_attributes["data-step-id"] == str(id).pysepal.__file__), and run the suite once against the release tag, for
example with a git worktree of the tag first on PYTHONPATH. Take
documentation screenshots the same way.Cause: a conditional sibling appeared before it and remounted it. The task keeps running unseen. Fix: see "Keep stateful siblings in place with keys".
TypeError: Expected element, not '<some text>'Cause: a function under @solara.component returned a value that is not an
element, often a plain helper that sits under a decorator meant for the next
function. Fix: move the decorator; a component returns None or an element.
RuntimeError: ... is bound to a different event loopCause: prefer_threaded=True on a use_task that calls GEE async methods,
or map_.add_ee_layer called from a sync use_effect handler. Solara's
use_task(prefer_threaded=True) creates a new asyncio.new_event_loop() per
invocation. EESession's asyncio primitives (Lock, BoundedSemaphore) and
httpx.AsyncClient(http2=True) bind to the first loop they see. A
start/cancel/start cycle hits a second loop → RuntimeError.
Fix:
prefer_threaded=False on the use_task — this runs the coroutine on
Solara's stable kernel event loop instead of a throwaway per-task loopadd_ee_layer into the async task via asyncio.to_thread:
await asyncio.to_thread(map_.add_ee_layer, fc, vis, "aoi", autocenter=True)
Cause: A helper like process_admin() is called without gee_interface=,
so it creates a throwaway GEEInterface() per call — each with its own event
loop + daemon thread. When GC collects them, __del__ logs the close.
Fix: Pass the shared session interface to all helpers that accept one:
result = await process_admin(
method=method,
admin_code=code,
gee=True,
gee_interface=get_current_gee_interface(),
)
TypeError: n[o].bind is not a functionCause: Object-style Vue watchers on Python-synced props in VuetifyTemplate.
Fix: Use simple function watchers, mounted() instead of immediate: true.
Reference: docs/guides/ipyvuetify-widgets.md
Cause: v.Widget(...) used inside with rv.Something(): context, or
solara.Column wrapping rv. elements.
Fix: Use rv.Widget(...) throughout, avoid mixing solara.Column with
rv. containers.
Collection.loadTable: Expected asset to be a Collection, found 'Image'Cause: ee.FeatureCollection(asset_id) called on an IMAGE asset, usually
from a race condition where selected_column holds a stale non-"ALL" value
after asset_id changed.
Fix: Guard column/value operations on asset_type.value == "TABLE".
Solara components use OriginalName + Component suffix:
| Component | Package |
|---|---|
FileInputComponent | pysepal.solara.components.inputs |
AssetSelectComponent | pysepal.solara.components.inputs |
PointsSelectorComponent | pysepal.solara.components.inputs |
VectorSelectorComponent | pysepal.solara.components.inputs |
TaskButtonComponent | pysepal.solara.components.task_button |
AoiView | pysepal.solara.components.aoi |
MapApp, ThemeToggle | pysepal.solara.components.map_app |
NotificationProvider | pysepal.solara.notifications |
AoiView and MapApp keep their legacy names. Run discovery for the full
current list — do not rely on this table.
docs/guides/)| Guide | When to read |
|---|---|
solara-gee-patterns.md | Any GEE work in Solara |
solara-app-builder.md | Scaffolding or restructuring an app |
solara-export.md | Adding export to EE asset / Drive / SEPAL workspace |
solara-mapapp-component.md | Every MapApp argument; moving from the legacy MapApp.element |
solara-migration.md | Converting ipyvuetify widget to Solara |
ipyvuetify-widgets.md | Creating a new v.VuetifyTemplate widget |
ipecharts.md | Creating charts/graphs (ipecharts is the standard for pysepal apps) |
local-tile-servers.md | Serving localtileserver / vectortileserver tiles to the browser |
migration-notes-v3.4.md | Auditing an existing app for stale patterns |
migration-v4.md | Moving a 3.x app to 4.0: sessions, locale, catalog() |
solara-upstream.md | What an upstream Solara release means for pysepal; why the pin sits where it does |
Tutorial: docs/source/tutorials/translate-app.rst — writing catalogues,
plural nodes, check().
When a Solara pattern is unclear, missing from pysepal docs, or you need to verify how a hook or component works under the hood, query the Solara source directly. Either browse the upstream repo (https://github.com/widgetti/solara) or, if you have a local checkout, inspect:
solara/ — core framework (hooks, components, server)solara/lab/ — experimental APIs (use_task, etc.)docs/ — official documentation and examplestests/ — test suite showing intended usage patternsIf any guide file is unreachable, STOP and ask the user for the correct pysepal repo path. Do not generate code against missing documentation.
When invoked with /pysepal audit, check the current project for:
asset_method, AssetSelector, PointsSelector, ShapeSelectorprefer_threaded=True (or missing prefer_threaded) on GEE use_task hooksprocess_admin() / process_asset() called without gee_interface= (creates throwaway instances)asyncio.to_thread(gee_interface. wrapping GEE callsadd_ee_layer called from sync use_effect handlersv.Widget(...) inside with rv.Something(): contextsloading parameter on AssetSelectComponentTaskButtonComponent instead)solara.Button with disabled=task.pending for async actions (use TaskButtonComponent)use_thread instead of use_task + asyncio.to_threadtask.value truthiness instead of task.value is not Noneuse_effect with incomplete dependency list (must include pending, finished, error, cancelled)pathlib, open() or SepalClient.files instead of get_current_filesystem() (breaks in one of the two deployments)gpd.read_file, pd.read_csv) directly in use_effect (use use_task + asyncio.to_thread)solara.Error() / solara.Success() / Alert() for event feedback (use use_notifications() + NotificationProvider; a lasting reason belongs in one text alert per section or a field hint)use_notifications() without required=False (it raises when rendered outside an app shell)NotificationProvider() mounted in the same component body that calls use_notifications(), or after it (the bus exists only once the provider element has rendered, so both raise)NotificationProvider() only in Page (the Voila ui.ipynb displays the shared component directly, so that path has no provider and raises)get_scoped_state() / has_scoped_state() / clear_scoped_state() or pysepal.solara.ui_state (removed in 4.0; the theme is a kernel store, read it with get_current_theme_state())bus.toasts.value or bus.tasks.value in a Solara render body (use Reactive.subscribe() in use_effect to avoid triggering parent re-renders)ThemeToggle() + theme.observe(...) wiring, or theme_toggle= on SepalMap / MapApp (use get_current_theme_state() + theme_state=)Translator(...), from component.message import ms, or ms. attribute lookups (use catalog() + msg("dotted.key"))use_locale(), LocaleState, locale_state=, LocaleSelect.bind_locale_state() (use current_locale() / set_locale(); pass locales= to MapApp){0}, {area:.2f}, {obj.attr}) (named {name} only; format in the caller)"layer(s)"-style strings where a plural node with count= belongsmsg() called inside asyncio.to_thread or an executor worker (return a key + named values; translate in the UI context)messages.check() == ()pysepal.sepalwidgets.vue_app.MapApp, as MapApp.element(...) or constructed directly (move to the native MapApp(...) from pysepal.solara.components.map_app; see solara-mapapp-component.md)model=, theme_toggle= or language_selector= on the native MapApp (it has none: use current_step / on_current_step, step_open / on_step_open, theme_state=, locales=)solara.FileBrowser / solara.FileBrowserMultiple anywhere in an app (they read the process filesystem and take no client, so they break on SEPAL; use FileInputComponent)use_task, with no .key() on either (the sibling remounts and loses its task)ExportSource.resolve making Earth Engine requests (it runs on every render)text alert per section or a field hintv_slots) added after the element mounted (the browser does not draw it)Read docs/guides/migration-notes-v3.4.md for the
full breaking changes list.
What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
npx claudepluginhub openforis/pysepal --plugin pysepalOther plugins' skills for the same job