feat(styxkit): add cross-backend convenience package - #13
Merged
Conversation
feat(styxkit): add cross-backend convenience package styxkit sits on top of styxdefs and the backend packages, offering one-call runner selection (use_local/use_dry/use_docker/use_podman/ use_singularity/use_graph) plus use_auto()/resolve_runner() PATH auto-detection. Backends are imported lazily so styxkit hard-depends only on styxdefs; each use_* for a missing backend raises a friendly error naming the package/extra to install. This is the runtime home for the runner-config sugar that styx v1 generated into niwraps __init__.py (and which the v2 niwrap meta package dropped). The styx2 emitProject will re-export it instead of re-emitting the logic. - new package at packages/styxkit (0.1.0), MIT, py.typed, extras for docker/podman/singularity/graph/all - wired into uv workspace sources + publish/docs CI matrices - 10 tests; ruff/mypy/pytest green repo-wide @
fix(styxkit): address review - honest use_dry signature + don't mask transitive import errors - use_dry() takes no kwargs (DryRunner.__init__ is zero-arg; the old **kwargs signature would TypeError on any argument) - _runner_factory only translates ModuleNotFoundError when the backend package itself is missing (exc.name == module); a transitive missing dep inside an installed backend now surfaces as-is instead of a misleading "install styxkit[x]" - tests: guard real-backend tests with pytest.importorskip; the friendly -error test sets exc.name; new test locks in the transitive-error path @
Contributor
Author
Review summary (2 agents: correctness + packaging)Ran two adversarial review passes before merge. Correctness found two real bugs CI did not exercise, both now fixed in
Packaging verdict was mergeable; confirmed build-system / version pins / layout / README match the sibling packages, and the publish ( Test count 10 -> 11 (added |
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.
@
What
Adds
styxkit, a small convenience layer on top of the Styx runtime that offers one-call runner selection across whichever backend packages are installed.Why
The published
niwrap1.0.0 became a pure meta-package, soimport niwrap; niwrap.use_docker()(and the wholeuse_*()family) disappeared in the v2 migration. In v1 those were generated intoniwrap/__init__.py. Rather than re-emit that logic from the compiler, it belongs in the runtime - colocated with the runner classes it wraps, so a constructor change and its wrapper move together instead of drifting across repos. The generated niwrap will re-exportstyxkitinstead.Layering:
styxdefs(base contract) -> individual backends ->styxkiton top. Acyclic: nothing in the lower tiers imports styxkit, and styxkit imports backends lazily, so it hard-depends only onstyxdefs.Design
use_*()for a backend you have not installed raises aModuleNotFoundErrornaming the package/extra to install. Extras:docker/podman/singularity/graph/all.use_*()(saves aget_global_runner()round-trip).use_auto()/resolve_runner()pick the first container backend that is both installed and onPATH, passing the detected executable (apptainer vs singularity); falls back to local.use_graph(base=None)wraps the current global runner, sinceGraphRunnerdecorates rather than being a leaf runner.childmindresearch/rbc(the field-test). FreeSurfer-license and cache helpers intentionally left out as too domain-specific for the runtime.Tests / gates
ruff check+ruff format --check,mypy packages/,pytest packages/all green repo-wide (70 passed / 1 skipped).styxkit-v*), and the docs pdoc matrix.Follow-ups (separate)
emitProject: emit a thinniwrap/__init__.py=from styxkit import *+ the catalog@typedispatcher; depend onstyxkit[all]. Publish styxkit to PyPI before niwrap regenerates against it.styxcache.CachingRunnershould forward base-runner attributes (would retire rbc's_CacheProxyingRunnershim).@