James R. Barlow and aider
a869a4ac42
fix: filter out None values from OCROptions kwargs
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
48a2fdb0f2
refactor: replace _kwargs_to_cmdline with direct OCROptions construction in experimental API functions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
91a2d39845
refactor: replace command line synthesis with direct OCROptions construction
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
cb22a35834
refactor: convert hOCR API entry points to use OCROptions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
1579337ebe
refactor: Create OCROptions model with Namespace compatibility
...
This commit introduces a new `OCROptions` class in `_options.py` that provides:
- Proper typing for OCRmyPDF options
- Pydantic validation
- Backward compatibility with `argparse.Namespace`
- Gradual migration support for the options system
Key changes:
- Added comprehensive option fields with type hints
- Implemented custom attribute access methods
- Created conversion methods between Namespace and OCROptions
- Updated type hints in multiple files to support both types
- Maintained existing validation logic
The new model allows for a step-by-step refactoring of the options handling throughout the project.
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:40:57 -08:00
James R. Barlow
a385cd967d
docs: Improve ocrmypdf.api
2025-11-10 15:58:47 -08:00
James R. Barlow and aider
ee47e986f3
docs: Improve module-level docstring for OCRmyPDF Python API
...
Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <aider@aider.chat >
2025-11-10 10:33:26 -08:00
Alina Bürge and GitHub
a9a8b39dba
Fix the use of the plugin_manager argument ( #1555 )
2025-08-18 13:00:39 -07:00
James R. Barlow
0f82d7223e
Fix some typing issues
2024-10-27 12:31:16 -07:00
James R. Barlow
7a8cc21e31
Add support for sidecar output to io.BytesIO
...
Closes #1252
2024-04-07 01:38:55 -07:00
James R. Barlow
3a3635f7f9
Python 3.10 cleanup, manual fixes
2024-02-14 12:48:17 -08:00
James R. Barlow
71166f7be8
Make hocr API experimental for now
...
This commit can be reverted when we are ready to release a new version.
2023-10-30 00:07:10 -07:00
James R. Barlow
db3df13e95
Remove ocrmypdf._sync
2023-10-24 00:54:31 -07:00
James R. Barlow
4dbc5e1dba
Fix some typing issues
2023-10-24 00:54:31 -07:00
James R. Barlow
f238e721ed
Improve documentation of new public hOCR APIs
2023-10-24 00:54:31 -07:00
James R. Barlow
23951c9e38
Working HOCR folder to PDF converter
2023-10-24 00:54:30 -07:00
James R. Barlow
e8ae370ceb
Eliminate api= kwarg and implicit creation of pluginmanager
2023-10-24 00:54:30 -07:00
James R. Barlow
68bb38d0ad
pdf_to_hocr: improve plugin handling
2023-10-24 00:52:31 -07:00
James R. Barlow
0443e87345
Introduce pdf_to_hocr API
2023-10-24 00:52:31 -07:00
James R. Barlow
b3de5833d3
Refactor conversion of ocrmypdf.ocr() arguments to cmdline
2023-10-24 00:52:31 -07:00
James R. Barlow
539f0ee0ce
Document some missing CLI options to API
2023-10-03 23:54:24 -07:00
James R. Barlow
f4c211fa2d
Use Python 3.9-style type hinting for tuple[] and AbstractSet -> Set
2023-10-01 00:09:05 -07:00
James R. Barlow
113a6b45bd
ruff autofixes (mostly typing.* -> collections.abc.*)
2023-10-01 00:02:53 -07:00
James R. Barlow
85e31d0a19
Tidy imports and line length
2023-09-25 01:04:01 -07:00
James R. Barlow
47b0f28564
Minor documentation and typing fixes
2023-09-25 00:19:48 -07:00
James R. Barlow
de2bb5ce8c
Remove tqdm dependency and TqdmConsole
...
Might be too aggressive? No deprecation warning....
2023-09-21 00:05:39 -07:00
James R. Barlow
19045c4f21
Replace coloredlogs and tqdm with rich
2023-08-11 01:47:42 -07:00
James R. Barlow
e8ed510543
Add stop on soft render errors and option to override
2023-06-01 23:49:34 -07:00
James R. Barlow
a99e40fa84
Update notes about ocrmypdf.ocr usage
2023-04-14 11:54:58 -07:00
James R. Barlow
9ce692a6f1
ruff: further fixes
2023-04-14 02:39:36 -07:00
James R. Barlow
33b70be7d5
ruff: more fixes, mainly missing docstrings
2023-04-14 02:16:38 -07:00
James R. Barlow
4924b11b6b
Additional ruff fixes
2023-04-14 01:25:16 -07:00
James R. Barlow
9b8d14d16e
Accept most of ruff's delinting
2023-04-14 00:45:34 -07:00
James R. Barlow
4d2f499f97
Remove optional status of coloredlogs
...
Everything optional is a possible complication.
Better to remove the option.
2022-08-04 04:15:56 -07:00
James R. Barlow
53db866ef9
Remove deprecated exception PdfMergeFailedError
2022-08-04 03:54:55 -07:00
James R. Barlow
80ed2117cc
Change to SPDX license tracking
2022-07-28 01:10:07 -07:00
James R. Barlow
dc6f1a266a
Modernize type annotations
2022-07-23 00:39:24 -07:00
James R. Barlow
db9a22c9dd
api: call enable_ansi_support unconditionally
...
coloredlogs documentation says this is (now?) permitted.
Also import it from the right place.
2022-06-12 00:31:01 -07:00
James R. Barlow
31683530f8
api/cli: replace private variable access with method
2022-06-12 00:31:01 -07:00
leonnicolas and GitHub
603da52026
Fix small typo in update api.py ( #963 )
...
[ci skip]
2022-05-14 21:45:23 -07:00
James R. Barlow
f91faf9795
Add new argument --tesseract-thresholding to control tesseract thresholding where available
...
Also add missing test for --tesseract-oem
2021-12-06 15:38:14 -08:00
James R. Barlow
30440104ba
Remove --threshold argument
...
Tesseract is now included better thresholding (binarization) in v5. Users that have
thresholding issues should try that first. If we find further problems
this can be brought back as a plugin.
2021-11-12 20:09:55 -08:00
James R. Barlow
c725bf79da
flake8 delinting
2021-09-21 16:37:03 -07:00
James R. Barlow
e402d5cb4b
typing: fix path and numeric issues
2021-08-27 00:23:38 -07:00
James R. Barlow
ec1d585d40
Merge branch 'feature/misc-breaking'
2021-04-01 16:51:04 -07:00
James R. Barlow
bccf2f423f
Stricter parameter checking for many public functions
2021-01-31 19:27:25 -08:00
James R. Barlow
206c675df6
docs: api
2021-01-31 19:26:35 -08:00
James R. Barlow
6c8f9223e9
Update awslambda to new pluginspec
2021-01-31 03:00:05 -08:00
James R. Barlow
b1da09f141
Add plugin for setting logging console
...
So that we are not tied to tqdm.
2021-01-31 02:29:11 -08:00
James R. Barlow
df157552f3
Make ocrmypdf.ocr take a threading lock
2021-01-01 01:37:09 -08:00