Skip to main content

linecook: Prepare lines of text for easy consumption

https://img.shields.io/badge/License-BSD%203--Clause-blue.svg https://travis-ci.com/tonysyu/linecook.svg?branch=master https://codecov.io/gh/tonysyu/linecook/branch/master/graph/badge.svg https://readthedocs.org/projects/linecook/badge/

linecook is a command-line tool that transforms lines of text into a form that’s pleasant to consume.

Install

The recommended way of installing linecook is to use pip:

pip install linecook

Cooking up some beautiful text

The core goal of linecook is to make it easy to create your own transforms to parse whatever text you have. For example, take an app.log file that looks like:

docs/_static/images/app_log_raw.png

If you want to highlight the log type and mute the dates/times, then you can create a custom recipe in one of your configuration files like the following:

from linecook import patterns as rx
from linecook.transforms import color_text

LINECOOK_CONFIG = {
    'recipes': {
        'my-logs': [
             color_text(rx.any_of(rx.date, rx.time), color='blue'),
             color_text('INFO', color='cyan'),
             color_text('WARN', color='grey', on_color='on_yellow'),
             color_text('ERROR', on_color='on_red'),
        ],
    },
}

To use this recipe, you can just pipe the log output to linecook with your new recipe as an argument:

docs/_static/images/app_log_linecook.png

That’s all there is to it!

See Also

Metadata

Release files for linecook 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for linecook 0.4.0
File Size Uploaded Provenance Actions
linecook-0.4.0.tar.gz 14.9 kB Without provenance Details for linecook-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for linecook 0.4.0
File Interpreter ABI Platform Actions
linecook-0.4.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for linecook-0.4.0-py2.py3-none-any.whl

Total release size: 33.8 kB

Release files / linecook-0.4.0.tar.gz

Download URL linecook-0.4.0.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e689c01e03f3d7ee539f16bf477e087c9d390abcf4cbd3360e92998f718e79b7
BLAKE2b-256 checksum
How to use checksums
4737ec5d16a6a51fd9beef9b113e65141f7ca63105fcf518d317a48a19dc0a31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.16 CPython/3.6.8 Darwin/18.5.0

Release files / linecook-0.4.0-py2.py3-none-any.whl

Download URL linecook-0.4.0-py2.py3-none-any.whl
Size 18.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
dde115d4e10451abf5a3e9449b7bd5abbc5afc34ab943817151c51ddaa5911d5
BLAKE2b-256 checksum
How to use checksums
460e964f5cf67d63b90ff875262a77d8da95c45f940feca727ddcb5093185fd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.16 CPython/3.6.8 Darwin/18.5.0

Security for linecook 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page