Skip to main content

Making development of console-based apps a little more convenient

Project description

cozyconsole

Caveat

This package exists to support my other projects. Those may require breaking changes in here. Consequently, cozyconsole may never become "stable", never reach v1.0.0. Considering how little is in here at the moment, it is probably not worth your time.

If you are still reading

cozyconsole currently contains:

cozyconsole.consolex.ConsoleX is a trivial wrapper around rich.console.Console. It exists to avoid code duplication anti-patterns in my other projects.

cozyconsole.activity.Activity is a context manager for operations that run for a few seconds each. It displays a message while a piece of code is executing. When the execution is complete, its status is shown.

from time import sleep
from cozyconsole.activity import Activity
with Activity("Updating dependencies") as act:
   sleep(3)   # simulating the actual code
   act.success = True

This displays

Collecting dependencies...

until the code finishes (here: 3 seconds), then updates that to show

Collecting dependencies - done

Activity can handle warnings, errors, and expections in various ways. Run

% python3 -m cozyconsole.demo

to see more.

Ideas for v0.5.0 and beyond

  • Evaluate if Activity should use rich.status.
  • Activity and ConsoleX error and warning colors should be configurable via a TOML config file.
  • A Rich-based horizontal barchart "widget".

Credits

Rich

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

cozyconsole-0.4.1.tar.gz (13.7 kB view hashes)

Uploaded Source

Built Distribution

cozyconsole-0.4.1-py3-none-any.whl (10.3 kB view hashes)

Uploaded Python 3

Supported by

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