Skip to main content

Helper for your tty interactions

Project description

wexample-prompt

Version: 0.0.98

Helper for your tty interactions

Table of Contents

Status & Compatibility

Maturity: Production-ready

Python Support: >=3.10

OS Support: Linux, macOS, Windows

Status: Actively maintained

Prompt IO Quickstart

WithIoManager: owning or sharing the IoManager

  • Any class that needs prompt output should inherit WithIoManager.
  • Call self.ensure_io_manager() to lazily create or reuse an IoManager.
  • To inherit a parent’s indentation/verbosity, call self.set_parent_io_handler(parent); every context you create is automatically nested +1.
  • If someone else instantiates the manager, call self.use_io_manager(io) to reuse it instead of creating a new instance.

WithIoMethods: direct method proxies

  • Mix in WithIoMethods when you want to call self.log(...), self.separator(...), etc., without reaching into self.io.
  • The mixin delegates missing attribute lookups to the underlying IoManager, and it automatically injects context=self.create_io_context() so nested logging just works.

Typical pattern

from wexample_prompt.mixins.with_io_methods import WithIoMethods

class Worker(WithIoMethods):
    def __attrs_post_init__(self):
        self.ensure_io_manager()          # Owns an IoManager

    def run(self):
        self.log("top level message")     # via WithIoMethods

class Child(WithIoMethods):
    def __attrs_post_init__(self, parent):
        self.set_parent_io_handler(parent)  # reuse & indent

    def run(self):
        self.log("nested message")

The executor or parent decides whether to create a fresh manager or cascade an existing one; children only call ensure_io_manager() and never worry about the init order.

Tests

Run the test suite:

pytest tests/

With coverage:

pytest --cov=wexample-prompt tests/

Known Limitations & Roadmap

Current limitations and planned features are tracked in the GitHub issues.

See the project roadmap for upcoming features and improvements.

Useful Links

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

wexample_prompt-0.0.98.tar.gz (90.3 kB view details)

Uploaded Source

Built Distribution

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

wexample_prompt-0.0.98-py3-none-any.whl (146.6 kB view details)

Uploaded Python 3

File details

Details for the file wexample_prompt-0.0.98.tar.gz.

File metadata

  • Download URL: wexample_prompt-0.0.98.tar.gz
  • Upload date:
  • Size: 90.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.9 CPython/3.12.3 Linux/6.8.0-101-generic

File hashes

Hashes for wexample_prompt-0.0.98.tar.gz
Algorithm Hash digest
SHA256 1e3c389bfb4735a479177775ef20f432c7043a2730f126bfa2404389cec3a244
MD5 6cb3202399d702870af2ebd5bc074ed2
BLAKE2b-256 6d1e638c62de6ef04267b7eff66cfadf1dc4c4af3a951547a5dad2838649ba65

See more details on using hashes here.

File details

Details for the file wexample_prompt-0.0.98-py3-none-any.whl.

File metadata

  • Download URL: wexample_prompt-0.0.98-py3-none-any.whl
  • Upload date:
  • Size: 146.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.9 CPython/3.12.3 Linux/6.8.0-101-generic

File hashes

Hashes for wexample_prompt-0.0.98-py3-none-any.whl
Algorithm Hash digest
SHA256 0d215413d805997c4e0c0c90e1e45a6dc862fec330428b0d83d8c86c14a2c3ce
MD5 daac93432d3a3e86176b2b152ce3a0e6
BLAKE2b-256 d9c5b64c29ce29534d8a7b312aa1f38d3604dc10e218b678d55f57cad473b30d

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