ansiwrap-hotoffthehamster


Nameansiwrap-hotoffthehamster JSON
Version 0.8.7 PyPI version JSON
download
home_page
Summarytextwrap, but savvy to ANSI colors and styles
upload_time2023-12-28 05:01:18
maintainerTally Bark LLC
docs_urlNone
authorLandon Bouma
requires_python>=3.8.1,<4.0.0
licenseApache
keywords text textwrap ansi colors
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            @@@@@@@@@@@@@@@@@@@@@@@@@
ansiwrap-hotoffthehamster
@@@@@@@@@@@@@@@@@@@@@@@@@

.. CXREF:
   https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge

.. image:: https://github.com/doblabs/ansiwrap-hotoffthehamster/actions/workflows/checks-unspecial.yml/badge.svg?branch=release
  :target: https://github.com/doblabs/ansiwrap-hotoffthehamster/actions/workflows/checks-unspecial.yml/badge.svg?branch=release
  :alt: Build Status

.. CXREF: https://app.codecov.io/github.com/doblabs/ansiwrap-hotoffthehamster/settings/badge

.. image:: https://codecov.io/gh/doblabs/ansiwrap-hotoffthehamster/branch/release/graph/badge.svg?token=XXX
  :target: https://app.codecov.io/gh/doblabs/ansiwrap-hotoffthehamster
  :alt: Coverage Status

.. image:: https://readthedocs.org/projects/ansiwrap-hotoffthehamster/badge/?version=latest
  :target: https://ansiwrap-hotoffthehamster.readthedocs.io/en/latest/
  :alt: Documentation Status

.. image:: https://img.shields.io/github/v/release/doblabs/ansiwrap-hotoffthehamster.svg?style=flat
  :target: https://github.com/doblabs/ansiwrap-hotoffthehamster/releases
  :alt: GitHub Release Status

.. image:: https://img.shields.io/pypi/v/ansiwrap-hotoffthehamster.svg
  :target: https://pypi.org/project/ansiwrap-hotoffthehamster/
  :alt: PyPI Release Status

.. image:: https://img.shields.io/pypi/pyversions/ansiwrap-hotoffthehamster.svg
  :target: https://pypi.org/project/ansiwrap-hotoffthehamster/
  :alt: PyPI Supported Python Versions

.. image:: https://img.shields.io/github/license/doblabs/ansiwrap-hotoffthehamster.svg?style=flat
  :target: https://github.com/doblabs/ansiwrap-hotoffthehamster/blob/release/LICENSE
  :alt: License Status

|

.. ISOFF/2023-12-16: Upstream (forked-from) badges:
..
.. | |travisci| |version| |versions| |impls| |wheel| |coverage|
..
.. .. |travisci| image:: https://api.travis-ci.org/jonathaneunice/ansiwrap.svg
..     :target: http://travis-ci.org/jonathaneunice/ansiwrap
..
.. .. |version| image:: http://img.shields.io/pypi/v/ansiwrap.svg?style=flat
..     :alt: PyPI Package latest release
..     :target: https://pypi.python.org/pypi/ansiwrap
..
.. .. |versions| image:: https://img.shields.io/pypi/pyversions/ansiwrap.svg
..     :alt: Supported versions
..     :target: https://pypi.python.org/pypi/ansiwrap
..
.. .. |impls| image:: https://img.shields.io/pypi/implementation/ansiwrap.svg
..     :alt: Supported implementations
..     :target: https://pypi.python.org/pypi/ansiwrap
..
.. .. |wheel| image:: https://img.shields.io/pypi/wheel/ansiwrap.svg
..     :alt: Wheel packaging support
..     :target: https://pypi.python.org/pypi/ansiwrap
..
.. .. |coverage| image:: https://img.shields.io/badge/test_coverage-99%25-0000FF.svg
..     :alt: Test line coverage
..     :target: https://pypi.python.org/pypi/ansiwrap

``ansiwrap`` wraps text, like the standard ``textwrap`` module.
But it also correctly wraps text that contains ANSI control
sequences that colorize or style text.

Where ``textwrap`` is fooled by the raw string length of those control codes,
``ansiwrap`` is not; it understands that however much those codes affect color
and display style, they have no logical length.

The API mirrors the ``wrap``, ``fill``, and ``shorten``
functions of ``textwrap``. For example::

    from __future__ import print_function
    from colors import *     # ansicolors on PyPI
    from ansiwrap import *

    s = ' '.join([red('this string'),
                  blue('is going on a bit long'),
                  green('and may need to be'),
                  color('shortened a bit', fg='purple')])

    print('-- original string --')
    print(s)
    print('-- now filled --')
    print(fill(s, 20))
    print('-- now shortened / truncated --')
    print(shorten(s, 20, placeholder='...'))

It also exports several other functions:

* ``ansilen`` (giving the effective length of a string, ignoring ANSI control codes)
* ``ansi_terminate_lines`` (propagates control codes though a list of strings/lines
  and terminates each line.)
* ``strip_color`` (removes ANSI control codes from a string)

See also the enclosed ``demo.py``.

.. image:: https://github.com/doblabs/ansiwrap-hotoffthehamster/blob/release/docs/assets/00000569.png
   :align: center


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ansiwrap-hotoffthehamster",
    "maintainer": "Tally Bark LLC",
    "docs_url": null,
    "requires_python": ">=3.8.1,<4.0.0",
    "maintainer_email": "doblabs@tallybark.com",
    "keywords": "text,textwrap,ANSI,colors",
    "author": "Landon Bouma",
    "author_email": "doblabs@tallybark.com",
    "download_url": "https://files.pythonhosted.org/packages/c4/3d/cd19ac1313ccaf2cfe2fb8f9f6c09de12cc8b0d1a8a4badc4591929ad51c/ansiwrap_hotoffthehamster-0.8.7.tar.gz",
    "platform": null,
    "description": "@@@@@@@@@@@@@@@@@@@@@@@@@\nansiwrap-hotoffthehamster\n@@@@@@@@@@@@@@@@@@@@@@@@@\n\n.. CXREF:\n   https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge\n\n.. image:: https://github.com/doblabs/ansiwrap-hotoffthehamster/actions/workflows/checks-unspecial.yml/badge.svg?branch=release\n  :target: https://github.com/doblabs/ansiwrap-hotoffthehamster/actions/workflows/checks-unspecial.yml/badge.svg?branch=release\n  :alt: Build Status\n\n.. CXREF: https://app.codecov.io/github.com/doblabs/ansiwrap-hotoffthehamster/settings/badge\n\n.. image:: https://codecov.io/gh/doblabs/ansiwrap-hotoffthehamster/branch/release/graph/badge.svg?token=XXX\n  :target: https://app.codecov.io/gh/doblabs/ansiwrap-hotoffthehamster\n  :alt: Coverage Status\n\n.. image:: https://readthedocs.org/projects/ansiwrap-hotoffthehamster/badge/?version=latest\n  :target: https://ansiwrap-hotoffthehamster.readthedocs.io/en/latest/\n  :alt: Documentation Status\n\n.. image:: https://img.shields.io/github/v/release/doblabs/ansiwrap-hotoffthehamster.svg?style=flat\n  :target: https://github.com/doblabs/ansiwrap-hotoffthehamster/releases\n  :alt: GitHub Release Status\n\n.. image:: https://img.shields.io/pypi/v/ansiwrap-hotoffthehamster.svg\n  :target: https://pypi.org/project/ansiwrap-hotoffthehamster/\n  :alt: PyPI Release Status\n\n.. image:: https://img.shields.io/pypi/pyversions/ansiwrap-hotoffthehamster.svg\n  :target: https://pypi.org/project/ansiwrap-hotoffthehamster/\n  :alt: PyPI Supported Python Versions\n\n.. image:: https://img.shields.io/github/license/doblabs/ansiwrap-hotoffthehamster.svg?style=flat\n  :target: https://github.com/doblabs/ansiwrap-hotoffthehamster/blob/release/LICENSE\n  :alt: License Status\n\n|\n\n.. ISOFF/2023-12-16: Upstream (forked-from) badges:\n..\n.. | |travisci| |version| |versions| |impls| |wheel| |coverage|\n..\n.. .. |travisci| image:: https://api.travis-ci.org/jonathaneunice/ansiwrap.svg\n..     :target: http://travis-ci.org/jonathaneunice/ansiwrap\n..\n.. .. |version| image:: http://img.shields.io/pypi/v/ansiwrap.svg?style=flat\n..     :alt: PyPI Package latest release\n..     :target: https://pypi.python.org/pypi/ansiwrap\n..\n.. .. |versions| image:: https://img.shields.io/pypi/pyversions/ansiwrap.svg\n..     :alt: Supported versions\n..     :target: https://pypi.python.org/pypi/ansiwrap\n..\n.. .. |impls| image:: https://img.shields.io/pypi/implementation/ansiwrap.svg\n..     :alt: Supported implementations\n..     :target: https://pypi.python.org/pypi/ansiwrap\n..\n.. .. |wheel| image:: https://img.shields.io/pypi/wheel/ansiwrap.svg\n..     :alt: Wheel packaging support\n..     :target: https://pypi.python.org/pypi/ansiwrap\n..\n.. .. |coverage| image:: https://img.shields.io/badge/test_coverage-99%25-0000FF.svg\n..     :alt: Test line coverage\n..     :target: https://pypi.python.org/pypi/ansiwrap\n\n``ansiwrap`` wraps text, like the standard ``textwrap`` module.\nBut it also correctly wraps text that contains ANSI control\nsequences that colorize or style text.\n\nWhere ``textwrap`` is fooled by the raw string length of those control codes,\n``ansiwrap`` is not; it understands that however much those codes affect color\nand display style, they have no logical length.\n\nThe API mirrors the ``wrap``, ``fill``, and ``shorten``\nfunctions of ``textwrap``. For example::\n\n    from __future__ import print_function\n    from colors import *     # ansicolors on PyPI\n    from ansiwrap import *\n\n    s = ' '.join([red('this string'),\n                  blue('is going on a bit long'),\n                  green('and may need to be'),\n                  color('shortened a bit', fg='purple')])\n\n    print('-- original string --')\n    print(s)\n    print('-- now filled --')\n    print(fill(s, 20))\n    print('-- now shortened / truncated --')\n    print(shorten(s, 20, placeholder='...'))\n\nIt also exports several other functions:\n\n* ``ansilen`` (giving the effective length of a string, ignoring ANSI control codes)\n* ``ansi_terminate_lines`` (propagates control codes though a list of strings/lines\n  and terminates each line.)\n* ``strip_color`` (removes ANSI control codes from a string)\n\nSee also the enclosed ``demo.py``.\n\n.. image:: https://github.com/doblabs/ansiwrap-hotoffthehamster/blob/release/docs/assets/00000569.png\n   :align: center\n\n",
    "bugtrack_url": null,
    "license": "Apache",
    "summary": "textwrap, but savvy to ANSI colors and styles",
    "version": "0.8.7",
    "project_urls": {
        "documentation": "https://ansiwrap-hotoffthehamster.readthedocs.io/en/latest",
        "download": "https://pypi.org/project/ansiwrap-hotoffthehamster/#files",
        "history": "https://github.com/doblabs/ansiwrap-hotoffthehamster/blob/release/HISTORY.rst",
        "homepage": "https://github.com/doblabs/ansiwrap-hotoffthehamster",
        "issues": "https://github.com/doblabs/ansiwrap-hotoffthehamster/issues"
    },
    "split_keywords": [
        "text",
        "textwrap",
        "ansi",
        "colors"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0007abd70163c49fe61e1991d24cd0c8c367769a42c27a81bc5168d24b1037f0",
                "md5": "11b6c38530cf499dedf176467f2a72d7",
                "sha256": "adcfa28d63393b2d50fb1186bfd3587cb8a6caf2a0039a115acecec71486c101"
            },
            "downloads": -1,
            "filename": "ansiwrap_hotoffthehamster-0.8.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "11b6c38530cf499dedf176467f2a72d7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<4.0.0",
            "size": 8140,
            "upload_time": "2023-12-28T05:01:16",
            "upload_time_iso_8601": "2023-12-28T05:01:16.409421Z",
            "url": "https://files.pythonhosted.org/packages/00/07/abd70163c49fe61e1991d24cd0c8c367769a42c27a81bc5168d24b1037f0/ansiwrap_hotoffthehamster-0.8.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c43dcd19ac1313ccaf2cfe2fb8f9f6c09de12cc8b0d1a8a4badc4591929ad51c",
                "md5": "7a5cb9d2501a7ce825f767c19df55c7b",
                "sha256": "caaf939682b9ba306c7a7c80dbf31ff9f2e460a0943c6899fc70660766447aa1"
            },
            "downloads": -1,
            "filename": "ansiwrap_hotoffthehamster-0.8.7.tar.gz",
            "has_sig": false,
            "md5_digest": "7a5cb9d2501a7ce825f767c19df55c7b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<4.0.0",
            "size": 31437,
            "upload_time": "2023-12-28T05:01:18",
            "upload_time_iso_8601": "2023-12-28T05:01:18.168577Z",
            "url": "https://files.pythonhosted.org/packages/c4/3d/cd19ac1313ccaf2cfe2fb8f9f6c09de12cc8b0d1a8a4badc4591929ad51c/ansiwrap_hotoffthehamster-0.8.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-28 05:01:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "doblabs",
    "github_project": "ansiwrap-hotoffthehamster",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "ansiwrap-hotoffthehamster"
}
        
Elapsed time: 0.58212s