python-bidi


Namepython-bidi JSON
Version 0.4.2 PyPI version JSON
download
home_pagehttps://github.com/MeirKriheli/python-bidi
SummaryPure python implementation of the BiDi layout algorithm
upload_time2019-07-04 10:54:23
maintainer
docs_urlNone
authorMeir Kriheli
requires_python
licensehttp://www.gnu.org/licenses/lgpl.html
keywords bidi unicode layout
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ===============================
Python BiDi
===============================

.. image:: https://badge.fury.io/py/python-bidi.png
    :target: http://badge.fury.io/py/python-bidi

.. image:: https://travis-ci.org/MeirKriheli/python-bidi.png?branch=master
        :target: https://travis-ci.org/MeirKriheli/python-bidi

`Bi-directional`_ (BiDi) layout implementation in pure python

`Package documentation`_

.. _Bi-directional: http://en.wikipedia.org/wiki/Bi-directional_text
.. _Package documentation: http://python-bidi.readthedocs.org/en/latest/

API
----

The algorithm starts with a single entry point `bidi.algorithm.get_display`.

**Required arguments:**

* ``unicode_or_str``: The original unicode or string (i.e.: storage). If it's a string
  use the optional argument ``encoding`` to specify it's encoding.

**Optional arguments:**

* ``encoding``: If unicode_or_str is a string, specifies the encoding. The
  algorithm uses unicodedata_ which requires unicode. This encoding will be
  used to decode and encode back to string before returning
  (default: "utf-8").

* ``upper_is_rtl``: True to treat upper case chars as strong 'R' for
  debugging (default: False).

* ``base_dir``:  'L' or 'R', override the calculated base_level.

* ``debug``: True to display (using `sys.stderr`_) the steps taken with the
  algorithm (default: False).

Returns the display layout, either as unicode or ``encoding`` encoded string
(depending on the type of ``unicode_or_str'``).

.. _unicodedata: http://docs.python.org/library/unicodedata.html
.. _sys.stderr: http://docs.python.org/library/sys.html?highlight=sys.stderr#sys.stderr

Example::

    >>> from bidi.algorithm import get_display
    >>> get_display(u'car is THE CAR in arabic', upper_is_rtl=True)
    u'car is RAC EHT in arabic'


CLI
----

``pybidi`` is a command line utility (calling  ``bidi.main``) for running the
bidi algorithm. the script can get a string as a parameter or read text from
`stdin`. Usage::

    $ pybidi -h
    Usage: pybidi [options]

    Options:
      -h, --help            show this help message and exit
      -e ENCODING, --encoding=ENCODING
                            Text encoding (default: utf-8)
      -u, --upper-is-rtl    treat upper case chars as strong 'R' for debugging
                            (default: False).
      -d, --debug           Output to stderr steps taken with the algorithm
      -b BASE_DIR, --base-dir=BASE_DIR
                            Override base direction [L|R]


Examples::

    $ pybidi -u 'car is THE CAR in arabic'
    car is RAC EHT in arabic

    $ cat ~/Documents/example.txt | pybidi
    ...

Installation
-------------

See ``docs/INSTALL.rst``

Running tests
--------------

To run the tests::

    python setup.py test

Some explicit tests are failing right now (see TODO)





0.4.2
-----

* Type Fixes, thanks jwilk


History
=========

0.4.1
-----

* Merged Fix for mixed RTL and numbers, Thanks Just van Rossum

0.4.0
-----

* Move to cookiecutter template
* Python 3 support (py2.6, 2.7, 3.3, 3.4 and pypy)
* Better docs
* Travis integration
* Tox tests
* PEP8 cleanup

0.3.4
------

* Remove extra newline in console script output

0.3.3
------

* Implement overriding base paragraph direction
* Allow overriding base direction in pybidi console script
* Fix returning display in same encoding

0.3.2
------

* Test for surrogate pairs
* Fix indentation in documentations
* Specify license in setup.py

0.3.1
-----

* Added missing description
* docs/INSTALL.rst

0.3
---

* Apply bidi mirroring
* Move to back function based implementation

0.2
---

* Move the algorithm to a class based implementation

0.1
---

* Initial release



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/MeirKriheli/python-bidi",
    "name": "python-bidi",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "bidi unicode layout",
    "author": "Meir Kriheli",
    "author_email": "mkriheli@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7b/25/3372ce50082776134b0467a4616722ff7494f3bcd9cf11e1180d0eddb248/python-bidi-0.4.2.tar.gz",
    "platform": "",
    "description": "===============================\nPython BiDi\n===============================\n\n.. image:: https://badge.fury.io/py/python-bidi.png\n    :target: http://badge.fury.io/py/python-bidi\n\n.. image:: https://travis-ci.org/MeirKriheli/python-bidi.png?branch=master\n        :target: https://travis-ci.org/MeirKriheli/python-bidi\n\n`Bi-directional`_ (BiDi) layout implementation in pure python\n\n`Package documentation`_\n\n.. _Bi-directional: http://en.wikipedia.org/wiki/Bi-directional_text\n.. _Package documentation: http://python-bidi.readthedocs.org/en/latest/\n\nAPI\n----\n\nThe algorithm starts with a single entry point `bidi.algorithm.get_display`.\n\n**Required arguments:**\n\n* ``unicode_or_str``: The original unicode or string (i.e.: storage). If it's a string\n  use the optional argument ``encoding`` to specify it's encoding.\n\n**Optional arguments:**\n\n* ``encoding``: If unicode_or_str is a string, specifies the encoding. The\n  algorithm uses unicodedata_ which requires unicode. This encoding will be\n  used to decode and encode back to string before returning\n  (default: \"utf-8\").\n\n* ``upper_is_rtl``: True to treat upper case chars as strong 'R' for\n  debugging (default: False).\n\n* ``base_dir``:  'L' or 'R', override the calculated base_level.\n\n* ``debug``: True to display (using `sys.stderr`_) the steps taken with the\n  algorithm (default: False).\n\nReturns the display layout, either as unicode or ``encoding`` encoded string\n(depending on the type of ``unicode_or_str'``).\n\n.. _unicodedata: http://docs.python.org/library/unicodedata.html\n.. _sys.stderr: http://docs.python.org/library/sys.html?highlight=sys.stderr#sys.stderr\n\nExample::\n\n    >>> from bidi.algorithm import get_display\n    >>> get_display(u'car is THE CAR in arabic', upper_is_rtl=True)\n    u'car is RAC EHT in arabic'\n\n\nCLI\n----\n\n``pybidi`` is a command line utility (calling  ``bidi.main``) for running the\nbidi algorithm. the script can get a string as a parameter or read text from\n`stdin`. Usage::\n\n    $ pybidi -h\n    Usage: pybidi [options]\n\n    Options:\n      -h, --help            show this help message and exit\n      -e ENCODING, --encoding=ENCODING\n                            Text encoding (default: utf-8)\n      -u, --upper-is-rtl    treat upper case chars as strong 'R' for debugging\n                            (default: False).\n      -d, --debug           Output to stderr steps taken with the algorithm\n      -b BASE_DIR, --base-dir=BASE_DIR\n                            Override base direction [L|R]\n\n\nExamples::\n\n    $ pybidi -u 'car is THE CAR in arabic'\n    car is RAC EHT in arabic\n\n    $ cat ~/Documents/example.txt | pybidi\n    ...\n\nInstallation\n-------------\n\nSee ``docs/INSTALL.rst``\n\nRunning tests\n--------------\n\nTo run the tests::\n\n    python setup.py test\n\nSome explicit tests are failing right now (see TODO)\n\n\n\n\n\n0.4.2\n-----\n\n* Type Fixes, thanks jwilk\n\n\nHistory\n=========\n\n0.4.1\n-----\n\n* Merged Fix for mixed RTL and numbers, Thanks Just van Rossum\n\n0.4.0\n-----\n\n* Move to cookiecutter template\n* Python 3 support (py2.6, 2.7, 3.3, 3.4 and pypy)\n* Better docs\n* Travis integration\n* Tox tests\n* PEP8 cleanup\n\n0.3.4\n------\n\n* Remove extra newline in console script output\n\n0.3.3\n------\n\n* Implement overriding base paragraph direction\n* Allow overriding base direction in pybidi console script\n* Fix returning display in same encoding\n\n0.3.2\n------\n\n* Test for surrogate pairs\n* Fix indentation in documentations\n* Specify license in setup.py\n\n0.3.1\n-----\n\n* Added missing description\n* docs/INSTALL.rst\n\n0.3\n---\n\n* Apply bidi mirroring\n* Move to back function based implementation\n\n0.2\n---\n\n* Move the algorithm to a class based implementation\n\n0.1\n---\n\n* Initial release\n\n\n",
    "bugtrack_url": null,
    "license": "http://www.gnu.org/licenses/lgpl.html",
    "summary": "Pure python implementation of the BiDi layout algorithm",
    "version": "0.4.2",
    "project_urls": {
        "Homepage": "https://github.com/MeirKriheli/python-bidi"
    },
    "split_keywords": [
        "bidi",
        "unicode",
        "layout"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33b0f942d146a2f457233baaafd6bdf624eba8e0f665045b4abd69d1b62d097d",
                "md5": "d0deb6f98cc5aee35e996ccbe20b25d7",
                "sha256": "50eef6f6a0bbdd685f9e8c207f3c9050f5b578d0a46e37c76a9c4baea2cc2e13"
            },
            "downloads": -1,
            "filename": "python_bidi-0.4.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d0deb6f98cc5aee35e996ccbe20b25d7",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 30812,
            "upload_time": "2019-07-04T10:54:21",
            "upload_time_iso_8601": "2019-07-04T10:54:21.189004Z",
            "url": "https://files.pythonhosted.org/packages/33/b0/f942d146a2f457233baaafd6bdf624eba8e0f665045b4abd69d1b62d097d/python_bidi-0.4.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7b253372ce50082776134b0467a4616722ff7494f3bcd9cf11e1180d0eddb248",
                "md5": "a5af2ab2913eccbf9033ed3ce21b08c0",
                "sha256": "5347f71e82b3e9976dc657f09ded2bfe39ba8d6777ca81a5b2c56c30121c496e"
            },
            "downloads": -1,
            "filename": "python-bidi-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a5af2ab2913eccbf9033ed3ce21b08c0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 40373,
            "upload_time": "2019-07-04T10:54:23",
            "upload_time_iso_8601": "2019-07-04T10:54:23.135009Z",
            "url": "https://files.pythonhosted.org/packages/7b/25/3372ce50082776134b0467a4616722ff7494f3bcd9cf11e1180d0eddb248/python-bidi-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2019-07-04 10:54:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MeirKriheli",
    "github_project": "python-bidi",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "tox": true,
    "lcname": "python-bidi"
}
        
Elapsed time: 0.29184s