poetry2nix/tests/pytesseract/pyproject.toml
Tikhon Jelvis 9ecb2808f1 Add dependency on native Tesseract OCR executable for pytesseract
The pytesseract package needs to have the `tesseract` executable available at runtime to work.

By default, the Python package looks for the `tesseract` executable in the PATH. This doesn't work here, so we need to override the `tesseract_cmd` with the path to the `tesseract` executable we pulled in from Nix. I did this with a patch [based on how pytesseract is set up in Nixpkgs][1].

The patching code feels a bit fiddly. I don't know the idiomatic way to do this sort of thing.

I included a test that will fail if pytesseract cannot find the `tesseract` executable. The test passed for me with both `preferWheels = true` and `preferWheels = false`, but I only included one in the test suite here, not sure if it makes sense to have both—the actual patching code had to be a bit different depending on whether the source was a wheel or not.

[1]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/pytesseract/tesseract-binary.patch
2023-10-17 12:32:00 -07:00

9 lines
180 B
TOML

[tool.poetry]
name = "pytesseract-test"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
[tool.poetry.dependencies]
python = "^3.10"
pytesseract = "*"