On this page
expose-interface
Prev: compose-application | Up: projects | Next: expose-api
Rel: wispsy, Frameworks, recipes
Ref: wispsy on GitHub
Tags: #public #wispsy #project #frameworks #tier/core
Role
Export ordinary Python functions and bound methods as command-line programs using only the standard library (Python 3.11+, zero runtime dependencies), with nested Interface mounts, Context injection, and sync/async invocation.
Install
python -m pip install expose-interface==0.1.0
Quickstart
from expose_interface import Interface, argument, flag, option
app = Interface("hello", description="Greeting programs.")
@app.program
@argument("name")
@option("--count", "-n", help="Number of greetings.")
@flag("--color", "-G", help="Enable color.")
def greet(name: str, *, count: int = 1, color: bool = False):
for _ in range(count):
print(f"Hello, {name}!")
main = app.main
When to Reach for It
- Turning plain, typed Python functions into clean CLI commands while keeping direct Python calls intact.
- Exposing nested command trees and
pyproject.toml[project.scripts]entry points with zero third-party CLI deps.
Gotchas & Pitfalls
- Type annotations drive CLI parsing: Function signatures and type hints determine flags, positional arguments, and conversion—unannotated parameters default to raw strings.
Contextinjection parameter: Declare theContextparameter cleanly soexpose-interfaceinjects it rather than exposing it as a user-facing CLI flag.- Python 3.11+ & direct-call preservation: Decorated or mounted functions remain callable as ordinary Python functions; avoid mutating global
sys.argvinside handlers so tests stay clean.
Pairs With
- hidden-moves — Powers the
hidden-moves/hmCLI surface. - escape-colors — Adds portable terminal styling to exposed CLI output.
Metadata
type: project-card
slug: expose-interface
org: wispsy
repo: wispsy/expose-interface
package: expose-interface
version: 0.1.0
requires_python: ">=3.11"
layer: frameworks
topic: wispsy-framework
status: active
language: python
source_docs: README.md, docs/
Linked from
- tuts/third_party/python3/wispsy
- wiki/compatibility
- wiki/families
- wiki/orgs/ellainng
- wiki/orgs/wispsy
- wiki/principles
- wiki/projects
- wiki/projects/compose-application
- wiki/projects/ellainng
- wiki/projects/engl
- wiki/projects/escape-colors
- wiki/projects/expose-api
- wiki/projects/expose-protocol
- wiki/projects/function-sequence
- wiki/projects/hidden-moves
- wiki/projects/hypnosis
- wiki/projects/parsethon
- wiki/projects/prettynb
- wiki/recipes
- wiki/stack/frameworks
Related notes
- wiki/projects/expose-api Linked here; links to this page; shared tags: #frameworks, #project, #tier, #wispsy
- wiki/projects/compose-application Linked here; links to this page; shared tags: #project, #tier, #wispsy
- wiki/projects/escape-colors Linked here; links to this page; shared tags: #project, #tier, #wispsy
- wiki/projects/hidden-moves Linked here; links to this page; shared tags: #project, #tier, #wispsy
- wiki/stack/frameworks Linked here; links to this page; shared tags: #frameworks, #tier, #wispsy
- wiki/orgs/wispsy Linked here; links to this page; shared tags: #tier, #wispsy
- wiki/projects Linked here; links to this page; shared tags: #wispsy
- wiki/recipes Linked here; links to this page; shared tags: #wispsy
- wiki/projects/hypnosis links to this page; shared tags: #frameworks, #project, #tier, #wispsy
- wiki/projects/ellainng links to this page; shared tags: #project, #tier, #wispsy