| 1 | # Liblouis Python ctypes bindings |
| 2 | |
| 3 | These bindings allow you to use liblouis from within Python. The |
| 4 | package is called "louis". See the documentation included in the |
| 5 | module for usage instructions. |
| 6 | |
| 7 | These bindings use `ctypes` to access the liblouis shared library. The |
| 8 | liblouis shared library needs to be located in the library search |
| 9 | path. In most cases, if liblouis has been installed in a standard |
| 10 | location on your system, this is already the case and the bindings |
| 11 | will work without any additional steps. |
| 12 | |
| 13 | A standard `pyproject.toml` script is provided for installation |
| 14 | tasks. To install this package for system wide use, after installing |
| 15 | `liblouis` itself, switch to the `python` directory and run (as root): |
| 16 | |
| 17 | ``` python |
| 18 | sudo pip install . |
| 19 | ``` |
| 20 | |
| 21 | Some tests are located in `tests`. Note that these require that |
| 22 | you have compiled `liblouis` with support for 32-bit Unicode |
| 23 | characters. See the top-level README for instructions on this option. |
| 24 | |
| 25 | Remain in the `python` directory and run the tests with the |
| 26 | following command. If successful, output will be brief, and note |
| 27 | that some tests are designed to have "expected failures". |
| 28 | |
| 29 | ``` console |
| 30 | sudo python3 tests/test_louis.py |
| 31 | ``` |
| 32 | |
| 33 | ## Python Virtual Environment |
| 34 | |
| 35 | If you have a Python virtual environment created with the |
| 36 | Python `venv` module, follow these instructions to make |
| 37 | the `louis` module available in your virtual environment. |
| 38 | |
| 39 | * If your Python is at version 3.12 or newer, the `distutils` |
| 40 | module is deprecated. You can make it available via a PIP |
| 41 | package with a command in your virtual environment like |
| 42 | ```console |
| 43 | pip3 install setuptools |
| 44 | ``` |
| 45 | * First, make yourself root or super-user with an |
| 46 | `su` or `sudo -s` command. |
| 47 | * Then, activate your virtual environment. |
| 48 | * Now do as above, but without `sudo`, since you are |
| 49 | already root. |
| 50 | ```console |
| 51 | python3 setup.py install |
| 52 | ``` |
| 53 | * You can now run the tests, as above, from within |
| 54 | your virtual environemnt. |