textwrap3


Nametextwrap3 JSON
Version 0.9.2 PyPI version JSON
download
home_pagehttps://github.com/jonathaneunice/textwrap3
Summarytextwrap from Python 3.6 backport (plus a few tweaks)
upload_time2019-01-23 21:57:08
maintainer
docs_urlNone
authorJonathan Eunice
requires_python
licensePython Software Foundation License
keywords text wrap fill textwrap
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            
| |travisci| |version| |versions| |impls| |wheel| |coverage|

.. |travisci| image:: https://api.travis-ci.org/jonathaneunice/textwrap3.svg
    :target: http://travis-ci.org/jonathaneunice/textwrap3

.. |version| image:: http://img.shields.io/pypi/v/textwrap3.svg?style=flat
    :alt: PyPI Package latest release
    :target: https://pypi.python.org/pypi/textwrap3

.. |versions| image:: https://img.shields.io/pypi/pyversions/textwrap3.svg
    :alt: Supported versions
    :target: https://pypi.python.org/pypi/textwrap3

.. |impls| image:: https://img.shields.io/pypi/implementation/textwrap3.svg
    :alt: Supported implementations
    :target: https://pypi.python.org/pypi/textwrap3

.. |wheel| image:: https://img.shields.io/pypi/wheel/textwrap3.svg
    :alt: Wheel packaging support
    :target: https://pypi.python.org/pypi/textwrap3

.. |coverage| image:: https://img.shields.io/badge/test_coverage-100%25-663399.svg
    :alt: Test line coverage
    :target: https://pypi.python.org/pypi/textwrap3


``textwrap3`` is a compatibility back-port of Python 3.6's ``textwrap``
module that supports Python 2.6 forward. (Though honestly, if you're not
already using *at least* 2.7, you're way behind the times!) 

This makes a few new
APIs such as ``shorten`` and the ``max_lines`` parameter available
in a compatible way to all Python versions typically in current use.

Import and use it like you would ``textwrap`` from the standard library::

    from textwrap3 import wrap

    text = 'long text here...'
    print(wrap(text, 40))

The standard `textwrap documentation <https://docs.python.org/3.6/library/textwrap.html>`_
is the best reference material.

Bias and Tweaks
===============

By design, Python 3 sensibilities and expectations rule. Especially when
processing text that includes Unicode characters, ``textwrap3``'s results may
differ a bit from those of the ``textwrap`` of the underlying Python version
(esp. 2.x). In particular, ``textwrap3`` uses the ``re.UNICODE`` flag so that
non-ASCII characters such as accented letters are considered legitimate word
characters.

It also adds one tweak, considering the Unicode em-dash
(``'\N{EM DASH}'`` or ``u'\u2014'``) identical to the simulated ASCII em-dash
``'--'``.

Notes
=====

* See ``CHANGES.yml`` for the Change Log.

* This module is almost entirely the work of Gregory P. Ward
  (``textwrap``'s original author) plus enhancements from the Python
  community.  This separate packaging is just a delivery and
  compatibility vehicle. It contributes cross-Python
  version compatibility shims, a few additional tests, and better
  handling of real em-dashes. The vast majority of functionality
  still comes from the standard ``textwrap`` code base, as of the
  Python 3.6 release.

Installation
============

To install or upgrade to the latest version::

    pip install -U textwrap3

You may need to prefix these with ``sudo`` to authorize
installation. In environments without super-user privileges, you may want to
use ``pip``'s ``--user`` option, to install only for a single user, rather
than system-wide. Depending on your system configuration, you may also
need to use separate ``pip2`` and ``pip3`` programs to install for Python
2 and 3 respectively.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jonathaneunice/textwrap3",
    "name": "textwrap3",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "text wrap fill textwrap",
    "author": "Jonathan Eunice",
    "author_email": "jonathan.eunice@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4d/02/cef645d4558411b51700e3f56cefd88f05f05ec1b8fa39a3142963f5fcd2/textwrap3-0.9.2.zip",
    "platform": "",
    "description": "\n| |travisci| |version| |versions| |impls| |wheel| |coverage|\n\n.. |travisci| image:: https://api.travis-ci.org/jonathaneunice/textwrap3.svg\n    :target: http://travis-ci.org/jonathaneunice/textwrap3\n\n.. |version| image:: http://img.shields.io/pypi/v/textwrap3.svg?style=flat\n    :alt: PyPI Package latest release\n    :target: https://pypi.python.org/pypi/textwrap3\n\n.. |versions| image:: https://img.shields.io/pypi/pyversions/textwrap3.svg\n    :alt: Supported versions\n    :target: https://pypi.python.org/pypi/textwrap3\n\n.. |impls| image:: https://img.shields.io/pypi/implementation/textwrap3.svg\n    :alt: Supported implementations\n    :target: https://pypi.python.org/pypi/textwrap3\n\n.. |wheel| image:: https://img.shields.io/pypi/wheel/textwrap3.svg\n    :alt: Wheel packaging support\n    :target: https://pypi.python.org/pypi/textwrap3\n\n.. |coverage| image:: https://img.shields.io/badge/test_coverage-100%25-663399.svg\n    :alt: Test line coverage\n    :target: https://pypi.python.org/pypi/textwrap3\n\n\n``textwrap3`` is a compatibility back-port of Python 3.6's ``textwrap``\nmodule that supports Python 2.6 forward. (Though honestly, if you're not\nalready using *at least* 2.7, you're way behind the times!) \n\nThis makes a few new\nAPIs such as ``shorten`` and the ``max_lines`` parameter available\nin a compatible way to all Python versions typically in current use.\n\nImport and use it like you would ``textwrap`` from the standard library::\n\n    from textwrap3 import wrap\n\n    text = 'long text here...'\n    print(wrap(text, 40))\n\nThe standard `textwrap documentation <https://docs.python.org/3.6/library/textwrap.html>`_\nis the best reference material.\n\nBias and Tweaks\n===============\n\nBy design, Python 3 sensibilities and expectations rule. Especially when\nprocessing text that includes Unicode characters, ``textwrap3``'s results may\ndiffer a bit from those of the ``textwrap`` of the underlying Python version\n(esp. 2.x). In particular, ``textwrap3`` uses the ``re.UNICODE`` flag so that\nnon-ASCII characters such as accented letters are considered legitimate word\ncharacters.\n\nIt also adds one tweak, considering the Unicode em-dash\n(``'\\N{EM DASH}'`` or ``u'\\u2014'``) identical to the simulated ASCII em-dash\n``'--'``.\n\nNotes\n=====\n\n* See ``CHANGES.yml`` for the Change Log.\n\n* This module is almost entirely the work of Gregory P. Ward\n  (``textwrap``'s original author) plus enhancements from the Python\n  community.  This separate packaging is just a delivery and\n  compatibility vehicle. It contributes cross-Python\n  version compatibility shims, a few additional tests, and better\n  handling of real em-dashes. The vast majority of functionality\n  still comes from the standard ``textwrap`` code base, as of the\n  Python 3.6 release.\n\nInstallation\n============\n\nTo install or upgrade to the latest version::\n\n    pip install -U textwrap3\n\nYou may need to prefix these with ``sudo`` to authorize\ninstallation. In environments without super-user privileges, you may want to\nuse ``pip``'s ``--user`` option, to install only for a single user, rather\nthan system-wide. Depending on your system configuration, you may also\nneed to use separate ``pip2`` and ``pip3`` programs to install for Python\n2 and 3 respectively.\n",
    "bugtrack_url": null,
    "license": "Python Software Foundation License",
    "summary": "textwrap from Python 3.6 backport (plus a few tweaks)",
    "version": "0.9.2",
    "split_keywords": [
        "text",
        "wrap",
        "fill",
        "textwrap"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "5955beca47bd9df9f015d9d3d9d7dc9e",
                "sha256": "bf5f4c40faf2a9ff00a9e0791fed5da7415481054cef45bb4a3cfb1f69044ae0"
            },
            "downloads": -1,
            "filename": "textwrap3-0.9.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5955beca47bd9df9f015d9d3d9d7dc9e",
            "packagetype": "bdist_wheel",
            "python_version": "3.6",
            "requires_python": null,
            "size": 12235,
            "upload_time": "2019-01-23T21:57:11",
            "upload_time_iso_8601": "2019-01-23T21:57:11.241758Z",
            "url": "https://files.pythonhosted.org/packages/77/9c/a53e561d496ee5866bbeea4d3a850b3b545ed854f8a21007c1e0d872e94d/textwrap3-0.9.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "fb3ce1d1b93adecd367a0f6c39f98306",
                "sha256": "5008eeebdb236f6303dcd68f18b856d355f6197511d952ba74bc75e40e0c3414"
            },
            "downloads": -1,
            "filename": "textwrap3-0.9.2.zip",
            "has_sig": false,
            "md5_digest": "fb3ce1d1b93adecd367a0f6c39f98306",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 24951,
            "upload_time": "2019-01-23T21:57:08",
            "upload_time_iso_8601": "2019-01-23T21:57:08.223626Z",
            "url": "https://files.pythonhosted.org/packages/4d/02/cef645d4558411b51700e3f56cefd88f05f05ec1b8fa39a3142963f5fcd2/textwrap3-0.9.2.zip",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2019-01-23 21:57:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "jonathaneunice",
    "github_project": "textwrap3",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "textwrap3"
}
        
Elapsed time: 0.01678s