Switch to louis-rs through louis-py in 2028.1

Open
#21,177 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python, rust

Research direction

Read louisHelper and the build and dependency configuration to understand how NVDA currently packages and calls liblouis. Then review the louis-py API and the linked parity and table distribution discussions; the work is complete when the dependency and table source are settled, louisHelper uses louis-py with the required search paths, and translation behavior is checked against the current implementation.

Written by the indexing model from the issue text.

Description

audience/nvda-dev blocked/needs-external-fix blocked/needs-product-decision needs-triage
Related issues, PRs or discussions
  • #20600 and #20666 made louisHelper the only module that calls liblouis.
  • #20736 proposes generating the braille table registry from liblouis table metadata.
  • liblouis/louis-py#3 covers publishing louis-py on PyPI and how the tables get distributed.
  • liblouis/louis-rs#61 asks where the tables will live.
  • The Rusty Braille add-on is a proof of concept, submitted to the store in nvaccess/addon-datastore#13064. It routes louisHelper.translate and louisHelper.backTranslate through louis-py.
What is the current state of the codebase?

NVDA builds liblouis from the include/liblouis submodule into liblouis.dll. The build needs clang-cl from the "C++ Clang tools for Windows" Visual Studio component. NVDA ships the liblouis Python bindings as the louis package, with the tables in louis/tables.

louisHelper wraps louis. It registers a ctypes table resolver and a ctypes log callback with liblouis. Since #20666, no other core module calls louis.

Why are changes required?

The liblouis maintainers are reimplementing liblouis in Rust as louis-rs. louis-rs reads the same tables and runs liblouis's own test suite. Its README says the manual memory management behind most liblouis CVEs is gone.

louis-py is the Python binding for louis-rs, mainly maintained by me, in the liblouis organization. It ships as a prebuilt wheel, including x64 and arm64 builds for Windows.

The switch gives NVDA:

  • A braille translator written in a memory safe language.
  • No C build of liblouis. Building NVDA no longer needs clang-cl and the bloat of LLVM that comes with it in Visual Studio.
  • Uv managed dependencies instead of a submodule, once the tables are on PyPI.
  • No ctypes callbacks in louisHelper. louis-py takes the table directories as search_path= and reports warnings through Python's logging.
  • A cut between translator and tables.

Users should notice no change in behaviour.

What technical changes are required?
  • Add louis-py as a dependency along with a dependency that still has to be settled on that will bundle the tables. Ideally they are provided on PyPI, but even if they aren't, we can keep the existing approach for table bundling.
  • Rewrite louisHelper on louis-py. It passes the custom table directories and the built-in table directory as search_path=, instead of the ctypes table resolver.
Are the proposed technical changes API breaking?

Yes, so this targets 2028.1.

  • The louis package and liblouis.dll are removed. Add-ons that import louis break.
  • louisHelper.LOUIS_TO_NVDA_LOG_LEVELS and louisHelper.louis_log are removed. They only serve the liblouis log callback.
Are there potential risks or issues with the proposed implementation?
  • louis-rs is in beta. Its parity report lists the liblouis tests it still fails, so some tables may translate differently. The Rusty Braille add-on lets users find such differences before the switch. We probably want to wait for a more stable release.
  • louis-rs deliberately differs from liblouis in table lookup. It searches only the directories it is given. A custom table can therefore not include a table from a third directory. A table next to a custom table also takes the place of the built-in table with the same name.
Dominant language
Python
Stars
2.7k
Forks
842
Avg merge
2d 4h
Merged PRs (30d)
56

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nvaccess/nvda

All issues in nvaccess/nvda

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.