Skip to main content

A multi-console TTY framework for complex CLI/TTY apps

Project description

Command Line Framework (V2: Web/RPC-ready)

中文

V2 extends the TTY core toward Web + RPC, while keeping the current codebase focused on the TTY runtime. At the moment, Web/RPC is planned but not yet implemented.

Quick Start (TTY Core)

  1. Define your consoles and commands (see examples in src/consoles/examples and src/commands/examples).
  2. Ensure console modules are imported so decorators can register them:
    • Update DEFAULT_CONSOLE_MODULES in src/consoles/loader.py, or
    • Call load_consoles([...]) manually.
  3. Start the factory:
from src.console_factory import ConsoleFactory

factory = ConsoleFactory(service=my_business_core)
factory.start()

The service instance is available in all consoles via console.service, and in commands via self.console.service. If service does not inherit UIEventSpeaker, a warning is emitted at startup.

Current Capabilities (TTY Core)

Console layer:

  • src/consoles/core.py: BaseConsole, MainConsole, SubConsole
  • src/consoles/manager.py and src/consoles/registry.py for lifecycle and registration

Commands layer:

  • src/commands/core.py: BaseCommands, CommandValidator
  • src/commands/registry.py: CommandRegistry, ArgSpec
  • src/commands/general.py: GeneralValidator, GeneralCompleter
  • src/commands/mixins.py: CommandMixin and built-in mixins

UI and utilities:

  • src/core/events.py: UIEvent, UIEventLevel, UIEventSpeaker
  • src/ui/output.py: proxy_print
  • src/utils/: tokenize.py, table.py, ui_logger.py

Roadmap (V2)

Planned milestones for Web + RPC:

  • M1: Meta Descriptor v1 + Exporter
  • M2: RPC proto v1 + local (de)serialization
  • M3: Meta Web Server (HTTP + WS)
  • M4: RPC Server (mTLS + allowlist + audit)
  • M5: Unified execution system (CommandExecutor)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_tty-0.1.0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_tty-0.1.0-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file python_tty-0.1.0.tar.gz.

File metadata

  • Download URL: python_tty-0.1.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for python_tty-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51fc655367872f21fe375fc7744561042017c2ca8e73615360a89bbbb0f192f7
MD5 e51049d1825362ba183b7d5176cb79f5
BLAKE2b-256 033e2c0203d7f8f5c49fa2de7e1878f5ff53d81ba85199a55d44791caca011fc

See more details on using hashes here.

File details

Details for the file python_tty-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_tty-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for python_tty-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1fdca1f1ea4f873850371b474b91132cd4ce949668a9cb26abb67efd4db3d811
MD5 e45f419d40b8a4cf4720b5a620cb48a2
BLAKE2b-256 49b8203f4dda64c2becbfa032860e90deb8762df4935689f7355c9500ccea779

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page