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).
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 Display the steps taken with the algorithm
Examples:
$ pybidi -u 'car is THE CAR in arabic' car is RAC EHT in arabic $ cat ~/Documents/example.txt | pybidi ... Running tests --------------
To run the tests:
python -m bidi.tests
Some explicit tests are failing right now (see TODO)
Changelog
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
TODO
Some explicit tests are failing
Arabic shaping
Metadata
Release files for python-bidi 0.3
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 | |
|---|---|---|---|---|
| python-bidi-0.3.tar.gz | 29.1 kB | Without provenance | Details |
Release files / python-bidi-0.3.tar.gz
| Download URL | python-bidi-0.3.tar.gz |
|---|---|
| Size | 29.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b7b5ca80b418072b8fdc8775039e4eb84d2dbd9b699d257124a72f1ad18a5ee
|
|
BLAKE2b-256 checksum How to use checksums |
03ca3b57cd4ba1bb5da489334aa2f7e72fc16c2ee729c74de8cd47b732eeb6b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python-bidi 0.3
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.