Low-level Python bridge utilities via libpython-clj.
Copy-adapted from hive-agent-bridge.python.bridge — same pattern: lazy init, conda env detection, thin wrappers.
No asyncio needed: libtmux operations are synchronous.
Preflight status is a closed ADT (defadt PreflightStatus) with exhaustive adt-case matching for remediation hints.
Low-level Python bridge utilities via libpython-clj. Copy-adapted from hive-agent-bridge.python.bridge — same pattern: lazy init, conda env detection, thin wrappers. No asyncio needed: libtmux operations are synchronous. Preflight status is a closed ADT (defadt PreflightStatus) with exhaustive adt-case matching for remediation hints.
(->preflight-status kw__1708__auto__)Coerce a keyword to a PreflightStatus variant (no data fields). Returns nil if keyword is not a valid variant.
Coerce a keyword to a PreflightStatus variant (no data fields). Returns nil if keyword is not a valid variant.
(available?)(available? opts)Returns true if all preflight checks pass.
Returns true if all preflight checks pass.
(default-python-executable)Resolve the Python interpreter for libpython-clj.
Precedence:
PythonConfig/:python-executable (env-driven)Resolve the Python interpreter for libpython-clj. Precedence: 1. hive-di `PythonConfig/:python-executable` (env-driven) 2. HOME-relative conda env auto-detection 3. nil — caller lets libpython-clj autodetect.
(ensure-python!)(ensure-python! opts)Ensure Python is initialized and libtmux is importable. Idempotent.
Returns: true if Python is ready with libtmux available, false otherwise.
Ensure Python is initialized and libtmux is importable. Idempotent. Returns: true if Python is ready with libtmux available, false otherwise.
(preflight-status variant-kw__1705__auto__)(preflight-status variant-kw__1705__auto__ data__1706__auto__)Construct a PreflightStatus variant. (preflight-status variant-keyword) for enum variants (preflight-status variant-keyword data-map) for data variants
Throws ex-info for unknown variants.
Construct a PreflightStatus variant. (preflight-status variant-keyword) for enum variants (preflight-status variant-keyword data-map) for data variants Throws ex-info for unknown variants.
(preflight-status? x__1707__auto__)True if x is a PreflightStatus ADT value.
True if x is a PreflightStatus ADT value.
Closed set of preflight check outcomes. Each variant maps to a distinct failure mode with actionable remediation.
Closed set of preflight check outcomes. Each variant maps to a distinct failure mode with actionable remediation.
Malli :multi schema (dispatch :adt/variant) for PreflightStatus — generator-capable and EDN-safe wherever pred-sym->malli covers the declared field predicates.
Malli :multi schema (dispatch :adt/variant) for PreflightStatus — generator-capable and EDN-safe wherever pred-sym->malli covers the declared field predicates.
(py->clj py-obj)Convert a Python collection to Clojure-iterable while preserving Python object types. Uses as-jvm (not ->jvm) to avoid deep conversion that strips Python type info from list elements (e.g. libtmux Pane objects).
Convert a Python collection to Clojure-iterable while preserving Python object types. Uses as-jvm (not ->jvm) to avoid deep conversion that strips Python type info from list elements (e.g. libtmux Pane objects).
(py-attr obj attr)Get a Python object attribute.
Returns attribute value or nil on failure.
Get a Python object attribute. Returns attribute value or nil on failure.
(py-call obj method & args)Call a Python method on an object. Supports kwargs via keyword args (e.g. :window_name "foo"). Uses call-attr-kw to properly separate positional and keyword arguments.
Returns method return value. Throws ExceptionInfo on failure.
Call a Python method on an object. Supports kwargs via keyword args (e.g. :window_name "foo"). Uses call-attr-kw to properly separate positional and keyword arguments. Returns method return value. Throws ExceptionInfo on failure.
(py-dict m)Create a Python dict from a Clojure map.
Create a Python dict from a Clojure map.
(py-import module-name)Safely import a Python module. Patches IO encoding before import (idempotent) for libtmux compat.
Returns: Python module object or nil if unavailable.
Safely import a Python module. Patches IO encoding before import (idempotent) for libtmux compat. Returns: Python module object or nil if unavailable.
(remediation-hint status)Get user-facing remediation message for a preflight status ADT value. Exhaustive matching — compile-time safety via adt-case.
Get user-facing remediation message for a preflight status ADT value. Exhaustive matching — compile-time safety via adt-case.
(reset-python!)Reset initialization state. For testing.
Reset initialization state. For testing.
(run-preflight)(run-preflight opts)Run staged preflight checks. Returns PreflightStatus ADT value.
Check order (fail-fast):
Each stage fails fast with a distinct ADT variant.
Use remediation-hint for user-facing install instructions.
Run staged preflight checks. Returns PreflightStatus ADT value. Check order (fail-fast): 1. libpython-clj on classpath? 2. Python executable exists? 3. libpython-clj initializes? 4. libtmux importable? 5. tmux binary on PATH? Each stage fails fast with a distinct ADT variant. Use `remediation-hint` for user-facing install instructions.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |