Build a Custom rapidocr Wheel
RapidOCR now uses pyproject.toml + setuptools-scm to build wheels. The build environment requires Python >=3.9; the resulting wheel can be installed on Python >=3.8.
1. Enter the Python package directory¶
2. Install the build tools and asset preparation dependencies¶
If you also need to run tests or prepare the default models, you can install the full dependencies:
3. Prepare the default model assets¶
This step will:
- Derive the default Det / Cls / Rec models from
rapidocr/config.yaml - Read the download URLs and SHA256 values from
rapidocr/default_models.yaml - Download or verify the model files
- Generate
MANIFEST.into make sure these models are included in the wheel
If you only want to check whether the models are ready:
4. Specify the version and build the wheel¶
The build output is written to:
For example:
5. Verify the wheel version¶
Expected output:
6. Verify that the models are included in the wheel¶
You should see the default model files.
If you do not specify a version manually, you can also build from a Git tag:
When the current commit is exactly on the v3.1.0 tag, setuptools-scm derives version 3.1.0. If the current commit is not on a tag, a development version is generated.