mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-06 09:41:39 -05:00

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
9 lines
180 B
TOML
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 = "*"
|