Python BiDi
Bi-directional (BiDi) layout implementation in pure python
API
The algorithm starts with a single entry point bidi.algorithm.get_display.
Required arguments:
unicode_or_str: The orginal 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 encdoing. 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').
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)
History
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
Metadata
Release files for python-bidi 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-bidi-0.4.0.tar.gz | 38.6 kB | Without provenance | Details for python-bidi-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_bidi-0.4.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for python_bidi-0.4.0-py2.py3-none-any.whl |
Total release size: 56.3 kB
Release files / python-bidi-0.4.0.tar.gz
| Download URL | python-bidi-0.4.0.tar.gz |
|---|---|
| Size | 38.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a1b3dbee4a0b307c91a465ba4caa8baaaa178151acd20de50ba24f9385f7e13
|
|
BLAKE2b-256 checksum How to use checksums |
6788ac2eaff43046ad814ad4d9d0d693acd4da5a402effb0afb7f0af5478294d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / python_bidi-0.4.0-py2.py3-none-any.whl
| Download URL | python_bidi-0.4.0-py2.py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
58d5775d03f6f3be8356deec5e008e4095ef04f687d0b3329df69f0ea24a39bf
|
|
BLAKE2b-256 checksum How to use checksums |
e0a7ea6334b798546ed8584cb8cdc5d153c289294287b4ab46e9a4242480eae3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python-bidi 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.