Skip to main content

Cytolk

A cython wrapper over the tolk library.

Installation

You can install cytolk with

pip install cytolk

Building from source

make sure to clone this repository recursively, as this repository depends on the original tolk repo

git clone --recursive https://github.com/pauliyobo/cytolk

Then run

python setup.py install

Note: this will build the extension using the generated c code present in the repository. By doing so you are not required to have cython installed on your machine. If you would like to build directly from the .pyx file, you will have to install the requirements which as of now are only cython and setuptools

pip install -r requirements.txt

And set the environment variable BUILD_CYTOLK

set BUILD_CYTOLK=1

Usage

As of 0.1.7 it is now possible to use a context manager to utilize tolk's functionality. Using tolk.load() and tolk.unload() is still possible.

# This  example makes use of tolk's context manager
# The old example can be found in the examples directory in the file named tolk_example.py
# They are exactly the same, only difference being that the old one does not use the context manager

from cytolk import tolk

# No need to load or unload anything, let the manager handle it for us
with tolk.tolk():
    # detect the screenreader in use, in my case NVDA
    print(f"screenreader detected is {tolk.detect_screen_reader()}")

    # does this screenreader suport  speech and braille?
    if tolk.has_speech():
        print("this screenreader supports speech")
    if tolk.has_braille():
        print("this screenreader supports braille")

    # let's speak some text
    tolk.speak("hello")

    # good, let's now output some text on the braille display, if any in use
    tolk.braille("hello")

Note

The library will not work if it can not interface to your current screen reader. Therefore, you must place the appropriate DLL that interfaces to your screen reader in your working directory. Cytolk comes already packed with the NVDA DLLs.

Placing required DLLs

Note: as of cytolk 0.1.6 placing the DLLs is no longer required, as the library automatically modifies the search path to detect the DLLs that are packaged with the extension itself Cytolk needs to find the required DLLs so that the wrapped c library can interface to your current screen reader. For this to work, the libraries need to be placed in the directory where your program is running. Finding those libraries can be annoying some times, and so, the wheel you install already comes packaged with the libraries you will need based on your architecture. This means that if you are using a 32 bit version of python, the libraries you will find in the wheel you install will be only 32 bit. But how do we go about doing this? Easy. Cytolk provides also a command line interface, which allows you to just do that. What you are looking for is this:

python -m cytolk --place_dll

This command will just place the required libraries you will need in your current directory, avoiding you to have to copy them manually. Suggestion to make this process easier are welcome.

Using with PyInstaller

Cytolk can't normally be included in a pyinstaller bundled executable because pyinstaller does not know which libraries it needs to collect. To fix this, it is possible to use a hook that ells pyinstaller which libraries to collect.
To use the hook, you will have to manually copy pyinstaller_hooks/hook-cytolk.py in the pyinstaller hooks folder.

Using with Nuitka

As of 0.1.11 It is also possible to include cytolk in an application that uses nuitka to build an executable. However, while in pyinstaller's case it was a matter of just copying a file, with nuitka one more step must be applied. Due to the fact that when c extensions are linked to an executable they can not use the special __file__ attribute, you must disable the extension of the search path when loading cytolk. To do so you can either do:

tolk.load(False)
# code
tolk.unload()

Or

with tolk.tolk(False):
    # code

Assuming that is done, you can copy the plugin in the directory nuitka_plugins and to build the executable make sure to pass the option --user-plugin=path-to-plugin

Functions

Note: some, if not all of the documentation, has been added following the already present documentation on the original tolk documentation, adapting it to the name of the functions present on this extension. Should you be interested on more detailed documentation, you will be able to find so in the original tolk repository.
Second note: in version 0.1.7, calling functions will raise an exception if cytolk hasn't been loaded. The only functions which are not subject to this are

  • tolk.load
  • tolk.is_loaded
  • tolk.unload
  • tolk.try_sapi
  • tolk.prefer_sapi

tolk.load(extended_search_path: bool)

Initializes the tolk library and sets the current screenreader driver, assuming that it's present in the list of supported screenreaders. All the functions to interact with the screenreader driver must be used after tolk is initialized. to verify whether tolk is initialized, call tolk.is_loaded()
args:

  • extended_search_path: allows you to decide whether the library should load trying to automatically detect the DLL libraries it depends on or not. Defaults to True.
    Note: this same argument can be used in the context manager

tolk.is_loaded() -> bool

Verifies whether tolk has been initialized

tolk.unload()

deinitializes tolk.

tolk.try_sapi(try_sapi: bool)

Sets if Microsoft Speech API (SAPI) should be used in the screen reader auto-detection process. The function should be called before tolk is initialized

tolk.prefer_sapi(prefer_sapi: bool)

If auto-detection for SAPI has been turned on through tolk.try_sapi, sets if SAPI should be placed first (true) or last (false) in the screen reader detection list. Putting it last is the default and is good for using SAPI as a fallback option. Putting it first is good for ensuring SAPI is used even when a screen reader is running, but keep in mind screen readers will still be tried if SAPI is unavailable. This function triggers the screen reader detection process if needed. this function can be called before tolk is initialized

tolk.detect_screen_reader() -> Optional[str]

Returns the common name for the currently active screen reader driver, if one is set. If none is set, tries to detect the currently active screen reader before looking up the name. If no screen reader is active, None is returned. tolk.load must be called before using this function.

tolk.has_speech() -> bool

Returns true if the current screen reader driver supports speech output. This function must be called after tolk is initialized.

tolk.has_braille() -> bool

Returns true if the current screen reader driver supports braille output. This function must be called after tolk is initialized.

tolk.output(text: str, interrupt: bool = False) -> bool

Outputs text through the current screen reader driver. Tolk.output uses both speech and braille if supported. Returns True on success False if otherwise. This function must be called after tolk is initialized.
Args:

  • text: the text to output
  • interrupt: interrupts any previous speech.

tolk.speak(text: str, interrupt: bool = False) -> bool

speaks the text through the current screen reader driver. Returns True on success False if otherwise. This function must be called after tolk is initialized.
Args:

  • text: the text to speak
  • interrupt: interrupts any previous speech.

tolk.braille(text: str) -> bool

Brailles text through the current screen reader driver. Returns True on success False if otherwise. This function must be called after tolk is initialized.
Args:

  • text (str) text to braille

tolk.is_speaking() -> bool

Returns True if the current screen reader driver is speaking. This function must be called after tolk is initialized.

tolk.silence() -> bool

Silences the current screen reader driver. Returns True on success False if otherwise. This function must be called after tolk is initialized.

Metadata

Release files for cytolk 0.1.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for cytolk 0.1.13
File Actions
cytolk-0.1.13-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for cytolk-0.1.13-cp312-cp312-win_amd64.whl
cytolk-0.1.13-cp312-cp312-win32.whl CPython 3.12 CPython 3.12 Windows x86-32 Details for cytolk-0.1.13-cp312-cp312-win32.whl
cytolk-0.1.13-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for cytolk-0.1.13-cp311-cp311-win_amd64.whl
cytolk-0.1.13-cp311-cp311-win32.whl CPython 3.11 CPython 3.11 Windows x86-32 Details for cytolk-0.1.13-cp311-cp311-win32.whl
cytolk-0.1.13-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for cytolk-0.1.13-cp310-cp310-win_amd64.whl
cytolk-0.1.13-cp310-cp310-win32.whl CPython 3.10 CPython 3.10 Windows x86-32 Details for cytolk-0.1.13-cp310-cp310-win32.whl
cytolk-0.1.13-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for cytolk-0.1.13-cp39-cp39-win_amd64.whl
cytolk-0.1.13-cp39-cp39-win32.whl CPython 3.9 CPython 3.9 Windows x86-32 Details for cytolk-0.1.13-cp39-cp39-win32.whl
cytolk-0.1.13-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details for cytolk-0.1.13-cp38-cp38-win_amd64.whl
cytolk-0.1.13-cp38-cp38-win32.whl CPython 3.8 CPython 3.8 Windows x86-32 Details for cytolk-0.1.13-cp38-cp38-win32.whl

Total release size: 2.0 MB

Release files / cytolk-0.1.13-cp312-cp312-win_amd64.whl

Download URL cytolk-0.1.13-cp312-cp312-win_amd64.whl
Size 170.6 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
cb9ff1422d05e3176a7f1510ff2049a1d98e21f3a60da7cc5c5e82b8f6645478
BLAKE2b-256 checksum
How to use checksums
ffd58bbed08e5efdfa4c99bd81a0c5e9543968055253c72c3120375eca0d1ecd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / cytolk-0.1.13-cp312-cp312-win32.whl

Download URL cytolk-0.1.13-cp312-cp312-win32.whl
Size 211.4 kB
Tags CPython 3.12 Windows x86-32
SHA-256 checksum
How to use checksums
5843c025a497015b299266cd82d52632b46220103da56ca446e3987b06a86f65
BLAKE2b-256 checksum
How to use checksums
dcc368075be4c2f676bfb95aba59b1d3cfc642803c0a6ecaa158f8f45a490b26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / cytolk-0.1.13-cp311-cp311-win_amd64.whl

Download URL cytolk-0.1.13-cp311-cp311-win_amd64.whl
Size 172.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
feb3c7b72dfd75024a0d3ac54e30148510bfc47a87e897a31c140efb851faf14
BLAKE2b-256 checksum
How to use checksums
b55bdd52fa0a20d3d0214e70c2a3c5b0cdaa30832c30c43fcf2493b6180b7829
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / cytolk-0.1.13-cp311-cp311-win32.whl

Download URL cytolk-0.1.13-cp311-cp311-win32.whl
Size 213.1 kB
Tags CPython 3.11 Windows x86-32
SHA-256 checksum
How to use checksums
8acee8b09dc498c31ce4f3bdeddc1f4e5c0854e82a4c5dbd7b7b29487ee799d6
BLAKE2b-256 checksum
How to use checksums
03bce3dc9bf2c051ae8f2275d7df1c7f634da530927f4bbe46b65192512c6d25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / cytolk-0.1.13-cp310-cp310-win_amd64.whl

Download URL cytolk-0.1.13-cp310-cp310-win_amd64.whl
Size 172.8 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
0c33a9fdad3735378d44890a1564f60a106fc8e9ace4ed7b8a0b02d75e8ab1ab
BLAKE2b-256 checksum
How to use checksums
bdafb3c7fd50ced713c17abac3d9b9edec59ea321b3762f9f7820b857f38234c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / cytolk-0.1.13-cp310-cp310-win32.whl

Download URL cytolk-0.1.13-cp310-cp310-win32.whl
Size 213.1 kB
Tags CPython 3.10 Windows x86-32
SHA-256 checksum
How to use checksums
6d7d8f401095cf70a3c7d0409f00725bd48db9081da738093b1f0c31e2dceae3
BLAKE2b-256 checksum
How to use checksums
36e18e8818c056e0721187356f24c14f59f671c67d201b4618c211bd7c93f18c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / cytolk-0.1.13-cp39-cp39-win_amd64.whl

Download URL cytolk-0.1.13-cp39-cp39-win_amd64.whl
Size 181.1 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
492d8dc0e7e0e9b3a2a0ce318bdeba21d1ba8a183aad9cf5df47592e017dc4f4
BLAKE2b-256 checksum
How to use checksums
60c8f400325d2ba79891e4db49e5d490f70745051d31291d334f4138a3a7692d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / cytolk-0.1.13-cp39-cp39-win32.whl

Download URL cytolk-0.1.13-cp39-cp39-win32.whl
Size 218.6 kB
Tags CPython 3.9 Windows x86-32
SHA-256 checksum
How to use checksums
91892c53a0f971977ef996814212e3512953b914a0dd5378a5e3ba9ae4551eda
BLAKE2b-256 checksum
How to use checksums
93e4c3fb41b427117ba9a2861fa2bddc994e31737f2ce9ec6d689c2adf1ffe48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / cytolk-0.1.13-cp38-cp38-win_amd64.whl

Download URL cytolk-0.1.13-cp38-cp38-win_amd64.whl
Size 181.4 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
f4ea013b9dd50ddf996962bd19a24b03f0beb297345b17fed5fe69dfd3f360e3
BLAKE2b-256 checksum
How to use checksums
d7115bfed17aa2109bf978ec0648d472373b39d527f067749876c0d369e591f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / cytolk-0.1.13-cp38-cp38-win32.whl

Download URL cytolk-0.1.13-cp38-cp38-win32.whl
Size 218.5 kB
Tags CPython 3.8 Windows x86-32
SHA-256 checksum
How to use checksums
ceb1b86ecec05967946a7647b59114d1a9a03adaccea78688ae2c747a4c8552a
BLAKE2b-256 checksum
How to use checksums
f21409d1a18795078f84d90a9d25cb4a3f31155c017e7b5cfcbfaf149439b6c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for cytolk 0.1.13

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page