feat(scripts): replace SepalClient with pysepal-api shim#992
Open
dfguerrerom wants to merge 3 commits into
Open
feat(scripts): replace SepalClient with pysepal-api shim#992dfguerrerom wants to merge 3 commits into
dfguerrerom wants to merge 3 commits into
Conversation
pysepal.scripts.sepal_client now re-exports pysepal_api.compat.SepalClient. Existing call sites (FileInput, export_engine, SessionManager, notebooks) keep working unchanged; the new class emits a DeprecationWarning at construction time pointing at pysepal_api.SepalClient as the long-term import path. The shim is scheduled for removal in pysepal v4. Also tighten the pysepal-api version pin to >=0.1.0.dev0,<1 so the dev pre-release wheel (not yet on PyPI) satisfies the constraint, and update noxfile.py to pre-install the local sibling-repo wheel before the main .[test] install so CI can resolve the dependency without PyPI access.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the in-tree
pysepal.scripts.sepal_client.SepalClientwith a thin shim that re-exportspysepal_api.compat.SepalClientfrom the new pysepal-api package (v0.1.0). The compat class is a byte-for-byte drop-in for the legacy class: same positional constructor, same legacy methods (list_files,get_file,set_file,get_remote_dir,sanitize_path), same public attributes (cookiesdict,headers,BASE_REMOTE_PATH,results_path,module_name,base_url,verify_ssl), and aDeprecationWarningat construction time pointing callers atpysepal_api.SepalClientfor new code.Motivation
The new SEPAL sandbox API key (openforis/sepal@6a1c2022) lets code inside a sandbox authenticate to SEPAL services without browser cookies. That unlocks non-Solara contexts (Jupyter notebooks, Voila apps, CLI scripts, background jobs) that pysepal's UI-bound
SepalClientcouldn't serve. The newpysepal-apipackage owns the HTTP layer (user-files, tasks, processing-recipes) with sync + async clients, while pysepal remains the UI library. This PR is the integration step: pysepal depends onpysepal-apiand the existingSepalClientimport path keeps working unchanged.Changes
pyproject.toml— addpysepal-api>=0.1.0.dev0,<1to runtime dependencies (PEP 440 pin admits the dev pre-release that's currently published locally).pysepal/scripts/sepal_client.py— replaced 208-line implementation with a 14-line shim re-exportingpysepal_api.compat.SepalClient.pysepal/solara/session_manager.py—cleanup_session()now callssepal_client.close()on kernel teardown so the new persistenthttpx.Clientconnection pool is released cleanly.noxfile.py— added_preinstall_pysepal_api()helper that builds a wheel from a../pysepal-apisibling repo (if present) and installs it before.[test], so the test sessions can resolvepysepal-apibefore it's on PyPI. No-op once published.Removal timeline
The shim and compat surface stay until pysepal v4. Callers are encouraged to migrate to
from pysepal_api import SepalClientfor the modern API.Test plan
nox -s test→ 349 passed, 1 skipped locally (no regressions vs. main)from pysepal.scripts.sepal_client import SepalClient; SepalClient.__module__ == "pysepal_api.compat"SepalClient(session_id, module_name, sepal_host=...)emitsDeprecationWarningand preserves all legacy attributesnoxfile.py)from pysepal_api import SepalClient; with SepalClient() as s: s.user_files.list("/")Coordinated work
pysepal-apiv0.1.0 is tagged locally but not yet pushed to a GitHub repo or PyPI. This PR depends on it being published before CI can resolve the dependency.