https://github.com/apparebit/konsole

Readable, pleasing console output for Python

https://github.com/apparebit/konsole

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.0%) to scientific vocabulary

Keywords

ansi-escape-codes color console logger logging python
Last synced: 5 months ago · JSON representation

Repository

Readable, pleasing console output for Python

Basic Info
  • Host: GitHub
  • Owner: apparebit
  • License: apache-2.0
  • Language: Python
  • Default Branch: boss
  • Homepage:
  • Size: 466 KB
Statistics
  • Stars: 51
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 8
Topics
ansi-escape-codes color console logger logging python
Created about 4 years ago · Last pushed over 2 years ago
Metadata Files
Readme Changelog License

README.md

konsole: readable, pleasing console output

When you are writing a Python command line tool and your head is on fire because of overly rich frameworks that just don’t click.

An interactive Python session using
konsole

konsole is a simple logger built on top of Python's logging framework that prints to standard error and, if the underlying terminal is amenable to it, does so with the judicious use of bold and light type as well as a dash of color. This package's interface stands on its own, no experience or direct interaction with logging required. At the same time, this package plays equally well with other loggers, just leave ~~konsole~~ 🙄 console output to it.

Using konsole

In order to use konsole, you need to go through the usual motions of installing

shell (venv) project % python3 -m pip install konsole

and then importing the package

python import konsole

konsole automatically integrates itself with Python’s logging system the first time the module is imported into an application. Notably, it registers a handler that prints messages to standard error with the root logger, replaces the current logger class with a subclass that supports the detail keyword argument, and enables the capture of Python warnings through the logging system.

konsole's public API follows below. It consists of one function to update the configuration, one function to access the __main__ application logger, and six functions to print messages at different priority levels. konsole includes type annotations, which have been validated with mypy.

Configuring konsole

  • Change the minimum level for printing messages and/or the flag for forcing colors on/off.

    python def config( *, level: Optional[int] = None, use_color: Optional[bool] = None, volume: Optional[int] = None, ) -> None: ...

    konsole starts out with INFO as minimum level and uses color if standard error is a TTY. The volume argument provides an alternative means for setting the output level, with larger volumes printing more information and 0 corresponding to the `W

Logging Messages

  • Get the __main__ application logger. konsole uses it for writing messages.

    python def logger() -> logging.Logger

    The logger, like any other logger created after the initialization of konsole, supports the detail keyword argument (see below).

  • Log a message at the given level.

    python def critical(msg: str, *args: object, **kwargs: object) -> None: ... def error(msg: str, *args: object, **kwargs: object) -> None: ... def warning(msg: str, *args: object, **kwargs: object) -> None: ... def info(msg: str, *args: object, **kwargs: object) -> None: ... def debug(msg: str, *args: object, **kwargs: object) -> None: ... def log(level: int, msg: str, *args: object, **kwargs: object) -> None: ...

    The message string is the first and only mandatory argument. If the message string contains % format specifiers, the necessary values must follow as positional arguments.

    Valid keyword arguments include those supported by Python's logging framework, notably exc_info for including an exception's stacktrace. They also include detail for supplemental data. konsole prints the mapping, sequence, or scalar value on separate, indented lines after the message but before an exception's stacktrace.

    konsole defines ALL CAPS constants, e.g., WARNING, for the five levels above. They have the same values as the corresponding constants in Python's logging package.


© 2022 Robert Grimm. Subject to Apache 2.0 license. On GitHub. On PyPI.

Owner

  • Name: Robert Grimm
  • Login: apparebit
  • Kind: user
  • Location: New York City

Software engineer by day. Apocalyptic prophet at night.

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 31
  • Total Committers: 1
  • Avg Commits per committer: 31.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 2
  • Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Robert Grimm a****t@g****m 31

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: about 24 hours
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 4.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • saveshodhan (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 146 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 3
    (may contain duplicates)
  • Total versions: 9
  • Total maintainers: 1
pypi.org: konsole

konsole: readable, pleasing console output

  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 3
  • Downloads: 146 Last month
Rankings
Dependent repos count: 9.0%
Stargazers count: 9.4%
Dependent packages count: 10.0%
Average: 18.9%
Forks count: 29.8%
Downloads: 36.3%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: konsole
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 34.0%
Stargazers count: 43.7%
Average: 47.5%
Dependent packages count: 51.2%
Forks count: 61.1%
Last synced: 6 months ago

Dependencies

pyproject.toml pypi