Skip to content

Commit da3b5ba

Browse files
authored
Fix python 3.13 (#115)
1 parent 68eb83d commit da3b5ba

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

AGENTS.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,28 @@
33
- Use the **CMake** build system when interacting with this repository. Humans use Bazel.
44
- A bug in some LLM coding environments makes Bazel difficult to use, so agents should rely on CMake.
55
- Keep both the CMake and Bazel builds working at all times.
6+
7+
## Building the Python Wheel
8+
9+
To build the Python wheel for `tesseract_decoder` locally, you will need to use the `bazel build` command and provide the version and Python target version as command-line arguments. This is because the `py_wheel` rule in the `BUILD` file uses "Make" variable substitution, which expects these values to be defined at build time.
10+
11+
Use the following command:
12+
13+
```bash
14+
bazel build //:tesseract_decoder_wheel --define=VERSION=0.1.1 --define=TARGET_VERSION=py313
15+
```
16+
17+
- `--define=VERSION=0.1.1`: Sets the version of the wheel. You should replace `0.1.1` with the current version from the `_version.py` file.
18+
- `--define=TARGET_VERSION=py313`: Sets the Python version tag for the wheel. Replace `py313` with the appropriate tag for the Python version you are targeting (e.g., `py312` for Python 3.12).
19+
20+
The resulting wheel file will be located in the `bazel-bin/` directory.
21+
22+
## Updating Dependencies
23+
24+
If you change the Python version in `MODULE.bazel`, you will need to regenerate the `requirements_lock.txt` file to ensure all dependencies are compatible. To do this, run the following command:
25+
26+
```bash
27+
bazel run //src/py:requirements.update
28+
```
29+
30+
This will update the `src/py/requirements_lock.txt` file with the correct dependency versions for the new Python environment.

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ bazel_dep(name = "rules_python", version = "0.40.0")
66
bazel_dep(name = "rules_cc", version = "0.0.17")
77
bazel_dep(name = "pybind11_bazel", version = "2.13.6")
88

9-
DEFAULT_PYTHON_VERSION = "3.11"
9+
DEFAULT_PYTHON_VERSION = "3.13"
1010

1111
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
1212
python.toolchain(python_version = DEFAULT_PYTHON_VERSION, is_default = True)

src/py/requirements_lock.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.11
2+
# This file is autogenerated by pip-compile with Python 3.13
33
# by the following command:
44
#
55
# bazel run //src/py:requirements.update

0 commit comments

Comments
 (0)