codarascan 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. codarascan-0.1.0/CHANGELOG.md +26 -0
  2. codarascan-0.1.0/CONTRIBUTING.md +60 -0
  3. codarascan-0.1.0/LICENSE +201 -0
  4. codarascan-0.1.0/MANIFEST.in +13 -0
  5. codarascan-0.1.0/MIGRATION.md +29 -0
  6. codarascan-0.1.0/NOTICE +5 -0
  7. codarascan-0.1.0/PKG-INFO +221 -0
  8. codarascan-0.1.0/README.md +169 -0
  9. codarascan-0.1.0/SECURITY.md +22 -0
  10. codarascan-0.1.0/THIRD_PARTY_NOTICES.md +24 -0
  11. codarascan-0.1.0/docs/API.md +89 -0
  12. codarascan-0.1.0/docs/COMPATIBILITY.md +44 -0
  13. codarascan-0.1.0/docs/KNOWN_LIMITATIONS.md +24 -0
  14. codarascan-0.1.0/docs/RELEASE.md +53 -0
  15. codarascan-0.1.0/docs/RELEASE_EVIDENCE_0.1.0.md +108 -0
  16. codarascan-0.1.0/docs/WORKER_PROTOCOL.md +36 -0
  17. codarascan-0.1.0/pyproject.toml +131 -0
  18. codarascan-0.1.0/setup.cfg +4 -0
  19. codarascan-0.1.0/setup.py +38 -0
  20. codarascan-0.1.0/src/codarascan/__init__.py +80 -0
  21. codarascan-0.1.0/src/codarascan/cli.py +289 -0
  22. codarascan-0.1.0/src/codarascan/core/__init__.py +28 -0
  23. codarascan-0.1.0/src/codarascan/core/contracts.py +232 -0
  24. codarascan-0.1.0/src/codarascan/documents.py +428 -0
  25. codarascan-0.1.0/src/codarascan/engines/__init__.py +83 -0
  26. codarascan-0.1.0/src/codarascan/engines/catalog.py +53 -0
  27. codarascan-0.1.0/src/codarascan/engines/common/__init__.py +28 -0
  28. codarascan-0.1.0/src/codarascan/engines/common/base.py +29 -0
  29. codarascan-0.1.0/src/codarascan/engines/common/classical_2d.py +1346 -0
  30. codarascan-0.1.0/src/codarascan/engines/common/classical_2d_extractor.py +340 -0
  31. codarascan-0.1.0/src/codarascan/engines/common/classical_2d_localizer.py +140 -0
  32. codarascan-0.1.0/src/codarascan/engines/common/classical_localizer.py +1987 -0
  33. codarascan-0.1.0/src/codarascan/engines/common/detection_classical_2d.py +4 -0
  34. codarascan-0.1.0/src/codarascan/engines/common/detection_sttg.py +4 -0
  35. codarascan-0.1.0/src/codarascan/engines/common/extraction_classical_2d.py +4 -0
  36. codarascan-0.1.0/src/codarascan/engines/common/extraction_vendored.py +4 -0
  37. codarascan-0.1.0/src/codarascan/engines/common/linear_recovery.py +621 -0
  38. codarascan-0.1.0/src/codarascan/engines/common/linear_review_gate_v2.py +4 -0
  39. codarascan-0.1.0/src/codarascan/engines/common/linear_review_gate_v3.py +4 -0
  40. codarascan-0.1.0/src/codarascan/engines/common/native/__init__.py +2 -0
  41. codarascan-0.1.0/src/codarascan/engines/common/native/loader.py +80 -0
  42. codarascan-0.1.0/src/codarascan/engines/common/native/sttg_localizer.py +1220 -0
  43. codarascan-0.1.0/src/codarascan/engines/common/native/sttg_native.cpp +1124 -0
  44. codarascan-0.1.0/src/codarascan/engines/common/pdfium_pages.py +79 -0
  45. codarascan-0.1.0/src/codarascan/engines/common/recovery/__init__.py +2 -0
  46. codarascan-0.1.0/src/codarascan/engines/common/recovery/adaptive.py +698 -0
  47. codarascan-0.1.0/src/codarascan/engines/common/recovery/hybrid.py +725 -0
  48. codarascan-0.1.0/src/codarascan/engines/common/recovery/locator.py +863 -0
  49. codarascan-0.1.0/src/codarascan/engines/common/recovery/matrix.py +922 -0
  50. codarascan-0.1.0/src/codarascan/engines/common/recovery/runtime.py +1505 -0
  51. codarascan-0.1.0/src/codarascan/engines/common/recovery/zxing.py +642 -0
  52. codarascan-0.1.0/src/codarascan/engines/common/review_gate.py +404 -0
  53. codarascan-0.1.0/src/codarascan/engines/common/tensor_decode.py +4 -0
  54. codarascan-0.1.0/src/codarascan/engines/common/tensor_decoder.py +374 -0
  55. codarascan-0.1.0/src/codarascan/engines/common/tensor_localizer.py +239 -0
  56. codarascan-0.1.0/src/codarascan/engines/common/vendored_decoder.py +360 -0
  57. codarascan-0.1.0/src/codarascan/engines/mosaic/__init__.py +33 -0
  58. codarascan-0.1.0/src/codarascan/engines/mosaic/detection.py +95 -0
  59. codarascan-0.1.0/src/codarascan/engines/mosaic/extraction.py +748 -0
  60. codarascan-0.1.0/src/codarascan/engines/registry.py +108 -0
  61. codarascan-0.1.0/src/codarascan/engines/tessera/__init__.py +33 -0
  62. codarascan-0.1.0/src/codarascan/engines/tessera/detection.py +382 -0
  63. codarascan-0.1.0/src/codarascan/engines/tessera/extraction.py +406 -0
  64. codarascan-0.1.0/src/codarascan/errors.py +59 -0
  65. codarascan-0.1.0/src/codarascan/formats.py +204 -0
  66. codarascan-0.1.0/src/codarascan/inputs.py +121 -0
  67. codarascan-0.1.0/src/codarascan/models.py +336 -0
  68. codarascan-0.1.0/src/codarascan/py.typed +1 -0
  69. codarascan-0.1.0/src/codarascan/scanner.py +564 -0
  70. codarascan-0.1.0/src/codarascan/schemas/result.decoded.example.json +30 -0
  71. codarascan-0.1.0/src/codarascan/schemas/result.localized.example.json +26 -0
  72. codarascan-0.1.0/src/codarascan/schemas/result.schema.json +195 -0
  73. codarascan-0.1.0/src/codarascan/schemas/stream.example.json +15 -0
  74. codarascan-0.1.0/src/codarascan/schemas/stream.schema.json +41 -0
  75. codarascan-0.1.0/src/codarascan/schemas/worker.schema.json +56 -0
  76. codarascan-0.1.0/src/codarascan/serialization.py +35 -0
  77. codarascan-0.1.0/src/codarascan/worker.py +407 -0
  78. codarascan-0.1.0/src/codarascan.egg-info/PKG-INFO +221 -0
  79. codarascan-0.1.0/src/codarascan.egg-info/SOURCES.txt +81 -0
  80. codarascan-0.1.0/src/codarascan.egg-info/dependency_links.txt +1 -0
  81. codarascan-0.1.0/src/codarascan.egg-info/entry_points.txt +2 -0
  82. codarascan-0.1.0/src/codarascan.egg-info/requires.txt +27 -0
  83. codarascan-0.1.0/src/codarascan.egg-info/top_level.txt +1 -0
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ All notable changes are recorded here. CodaraScan follows semantic versioning
4
+ after 1.0; during 0.x, breaking changes are identified explicitly.
5
+
6
+ ## 0.1.0 - Unreleased alpha
7
+
8
+ - Renamed the distribution and import package to `codarascan`.
9
+ - Added immutable, reusable Tessera/Mosaic `Scanner` APIs and cached one-off calls.
10
+ - Added image adapters, EXIF orientation, normalized ROI, full-image quads,
11
+ explicit statuses, raw-byte preservation, metadata, diagnostics, typed errors,
12
+ deterministic JSON, and published schemas.
13
+ - Exposed the concrete installed ZXing-C++ readable catalog: 27 linear and 13
14
+ matrix selections, with clean generated or Apache-2.0 fixtures.
15
+ - Added lazy native Tessera loading with an exact once-per-process warning and
16
+ tested Python-reference fallback.
17
+ - Replaced every installed Poppler runtime path with pypdfium2 native-raster
18
+ reuse or 300-DPI PDFium rendering.
19
+ - Added ordered document scanning/streaming, one-based page selection, bounded
20
+ workers, cancellation cleanup, and raise/collect error policies.
21
+ - Added human, JSON, and NDJSON CLI output plus a private framed-JSON worker.
22
+ - Added Apache-2.0 licensing, notices, typed-package metadata, compatibility and
23
+ release documentation, CI/release workflows, and artifact tests.
24
+
25
+ Known validation gaps are listed in `docs/KNOWN_LIMITATIONS.md`; 1.0 production
26
+ gates are not claimed by this alpha.
@@ -0,0 +1,60 @@
1
+ # Contributing
2
+
3
+ CodaraScan keeps public contracts separate from research-derived engine
4
+ implementations. Public behavior belongs in `scanner.py`, `documents.py`,
5
+ `models.py`, `formats.py`, `inputs.py`, `serialization.py`, `cli.py`, and
6
+ `worker.py`. Tessera, Mosaic, shared recovery, and native code live under
7
+ `src/codarascan/engines/`. Research and frozen historical versions remain in
8
+ `benchmarks/` and `archive/` and are excluded from installed artifacts.
9
+
10
+ ## Setup and checks
11
+
12
+ Use a supported CPython (3.11-3.14), initialize the pinned ZXing-C++ submodule,
13
+ and install the development dependencies:
14
+
15
+ ```bash
16
+ git submodule update --init --recursive
17
+ python3.11 -m venv .venv
18
+ .venv/bin/python -m pip install -U pip
19
+ .venv/bin/python -m pip install -e ".[dev]"
20
+ ```
21
+
22
+ Run all release-floor checks before proposing a change:
23
+
24
+ ```bash
25
+ .venv/bin/ruff check src/codarascan tests
26
+ .venv/bin/mypy
27
+ .venv/bin/python -m pytest
28
+ .venv/bin/python -m build
29
+ git diff --check
30
+ ```
31
+
32
+ Build the optional native extension in place with:
33
+
34
+ ```bash
35
+ .venv/bin/python setup.py build_ext --inplace
36
+ ```
37
+
38
+ Use `CODARASCAN_FORCE_PYTHON=1` for reference-backend tests. Native algorithm
39
+ changes require parity evidence; format or recovery changes require corpus
40
+ results and wrong-payload review. Do not weaken a valid behavior merely to make
41
+ a test pass.
42
+
43
+ ## Fixtures and repository hygiene
44
+
45
+ New fixtures need source, license, generator/version, payload, and expected
46
+ format recorded alongside the test or benchmark. The QR Model 1 fixture comes
47
+ from the pinned Apache-2.0 ZXing-C++ submodule; other clean catalog fixtures are
48
+ generated by the installed ZXing writer.
49
+
50
+ Never commit confidential documents, proprietary corpora, credentials, local
51
+ paths, virtual environments, caches, model downloads, debug output, rendered
52
+ pages, or unreviewed benchmark runs. Inputs and payloads may be sensitive.
53
+ Review wheel and sdist contents before every release.
54
+
55
+ ## Compatibility discipline
56
+
57
+ 0.x may make deliberate breaking changes, but each one must update the
58
+ changelog and migration notes. A selectable format is not removed silently.
59
+ Stable result fields, errors, schemas, CLI output, and worker protocol are
60
+ 1.0-gated contracts described in [docs/RELEASE.md](docs/RELEASE.md).
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Abderraouf FELLAHI
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,13 @@
1
+ include LICENSE NOTICE THIRD_PARTY_NOTICES.md
2
+ include README.md CHANGELOG.md CONTRIBUTING.md MIGRATION.md SECURITY.md
3
+ include pyproject.toml setup.py
4
+ recursive-include src/codarascan *.py *.json py.typed *.cpp
5
+ recursive-include docs *.md
6
+ prune archive
7
+ prune benchmarks/datasets
8
+ prune docs/barcode-report
9
+ prune reports
10
+ prune third_party
11
+ prune tests
12
+ global-exclude .DS_Store *.py[cod] *.so *.dylib *.dll *.o
13
+ global-exclude __pycache__
@@ -0,0 +1,29 @@
1
+ # Migration to CodaraScan 0.1
2
+
3
+ The former development distribution `barcode-detection` and import package
4
+ `barcode_detection` are replaced by `codarascan`. There is no compatibility
5
+ shim in 0.1.0.
6
+
7
+ ```python
8
+ # Before: private engine access
9
+ from barcode_detection.engines import get_engine
10
+
11
+ # After: public package contract
12
+ from codarascan import Scanner
13
+
14
+ scanner = Scanner(mode="fast", symbols="all", decode=True)
15
+ result = scanner.scan_image("page.png")
16
+ ```
17
+
18
+ Application code should not import `codarascan.engines`, recovery modules, or
19
+ the native extension directly. Use `Scanner`, public result/error types,
20
+ `supported_formats`, serialization helpers, CLI output, or the framed worker.
21
+
22
+ Poppler is no longer a runtime requirement. PDF callers should use
23
+ `scan_document` or `iter_document`; page numbers are one-based, duplicates are
24
+ invalid, and output follows requested order. `workers` now defaults explicitly
25
+ to 1.
26
+
27
+ Localization-only (`decode=False`) results intentionally have no `text`,
28
+ `value`, `raw_bytes`, or `format` attributes. Consumers must branch on status
29
+ or result type rather than expect null payload fields.
@@ -0,0 +1,5 @@
1
+ CodaraScan
2
+ Copyright 2026 Abderraouf FELLAHI
3
+
4
+ This product includes software developed by third parties. See
5
+ THIRD_PARTY_NOTICES.md for dependency provenance and license references.
@@ -0,0 +1,221 @@
1
+ Metadata-Version: 2.4
2
+ Name: codarascan
3
+ Version: 0.1.0
4
+ Summary: Offline barcode localization and decoding for images and PDF documents
5
+ Author: Abderraouf FELLAHI
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/flh-raouf/codarascan
8
+ Project-URL: Issues, https://github.com/flh-raouf/codarascan/issues
9
+ Project-URL: Source, https://github.com/flh-raouf/codarascan
10
+ Keywords: barcode,qr-code,data-matrix,pdf,zxing
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Operating System :: Microsoft :: Windows
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Multimedia :: Graphics :: Capture :: Scanners
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: <3.15,>=3.11
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ License-File: NOTICE
27
+ License-File: THIRD_PARTY_NOTICES.md
28
+ Requires-Dist: numpy<3,>=2.0
29
+ Requires-Dist: opencv-contrib-python-headless<6,>=4.10
30
+ Requires-Dist: zxing-cpp<4,>=3.0
31
+ Requires-Dist: Pillow<13,>=10
32
+ Requires-Dist: pypdfium2<6,>=4.30
33
+ Provides-Extra: test
34
+ Requires-Dist: build<2,>=1.2; extra == "test"
35
+ Requires-Dist: jsonschema<5,>=4.23; extra == "test"
36
+ Requires-Dist: pytest<10,>=8; extra == "test"
37
+ Requires-Dist: pytest-cov<8,>=6; extra == "test"
38
+ Provides-Extra: dev
39
+ Requires-Dist: codarascan[test]; extra == "dev"
40
+ Requires-Dist: mypy<2,>=1.15; extra == "dev"
41
+ Requires-Dist: numpy<2.5,>=2.0; extra == "dev"
42
+ Requires-Dist: ruff<1,>=0.12; extra == "dev"
43
+ Provides-Extra: benchmark
44
+ Requires-Dist: pytest<10,>=8; extra == "benchmark"
45
+ Requires-Dist: qrcode<9,>=7; extra == "benchmark"
46
+ Requires-Dist: torch<3,>=2.6; extra == "benchmark"
47
+ Provides-Extra: experiments
48
+ Requires-Dist: huggingface_hub<1,>=0.30; extra == "experiments"
49
+ Requires-Dist: torch<3,>=2.6; extra == "experiments"
50
+ Requires-Dist: ultralytics<9,>=8; extra == "experiments"
51
+ Dynamic: license-file
52
+
53
+ # CodaraScan
54
+
55
+ CodaraScan is an offline Python package for locating and decoding barcodes in
56
+ images and PDF documents. It combines two explicit engines behind one stable
57
+ API: Tessera for low latency (`mode="fast"`) and Mosaic for stronger recovery
58
+ (`mode="robust"`). Results preserve quadrilateral geometry, localization-only
59
+ and unresolved states, Unicode text, and original payload bytes.
60
+
61
+ > **0.1.0 is alpha software.** APIs and schemas may change during 0.x. Pin an
62
+ > exact version and evaluate your own corpus before production use. All
63
+ > concrete formats readable by the installed ZXing-C++ release are selectable,
64
+ > but degraded-image validation depth varies by format. Stable 1.0 remains
65
+ > blocked on the production gates in [release policy](docs/RELEASE.md).
66
+
67
+ ## Install
68
+
69
+ CodaraScan supports CPython 3.11 through 3.14.
70
+
71
+ ```bash
72
+ python -m pip install codarascan==0.1.0
73
+ ```
74
+
75
+ PDF support is included in the normal installation through pypdfium2. No
76
+ Poppler executable, server, network connection, runtime model download, or
77
+ Codara application is required.
78
+
79
+ ## Python API
80
+
81
+ ```python
82
+ from codarascan import Scanner
83
+
84
+ scanner = Scanner(
85
+ mode="fast", # Tessera; use "robust" for Mosaic
86
+ symbols="all", # "linear", "2d", or "all"
87
+ formats=["qr-code", "code-128"],
88
+ decode=True,
89
+ )
90
+ scanner.warm() # optional eager initialization
91
+
92
+ result = scanner.scan_image("shipping-label.png")
93
+ for symbol in result.symbols:
94
+ print(symbol.status, symbol.quad)
95
+ if hasattr(symbol, "text"):
96
+ print(symbol.format, symbol.text, symbol.raw_bytes)
97
+ ```
98
+
99
+ `scan_image` accepts image paths, encoded image bytes, Pillow images, 2-D
100
+ `uint8` grayscale arrays, and 3/4-channel `uint8` BGR/BGRA arrays. EXIF
101
+ orientation is applied when metadata exists. NumPy arrays are analyzed exactly
102
+ as supplied and copied to isolate scans from caller mutation.
103
+
104
+ PDF scanning uses one-based page numbers and keeps requested order even with
105
+ parallel analysis:
106
+
107
+ ```python
108
+ document = scanner.scan_document(
109
+ "batch.pdf",
110
+ pages=[3, 1, 2],
111
+ workers=4, # default 1; positive integer or "auto"
112
+ on_error="collect", # default "raise"
113
+ )
114
+
115
+ with scanner.iter_document("large.pdf", workers=2) as pages:
116
+ for page in pages:
117
+ persist(page)
118
+ print(pages.complete, pages.errors)
119
+ ```
120
+
121
+ `iter_document` keeps at most the selected worker count in flight and does not
122
+ accumulate returned pages. Both image and document calls accept an optional
123
+ normalized `(x, y, width, height)` ROI and opt-in diagnostics.
124
+
125
+ One-off `scan_image`, `scan_document`, and `iter_document` functions reuse
126
+ cached immutable scanner configurations. See the complete [API contract](docs/API.md).
127
+
128
+ ## Results
129
+
130
+ Stable symbol statuses are:
131
+
132
+ - `decoded`
133
+ - `localized_unresolved_linear`
134
+ - `localized_unresolved_matrix`
135
+ - `localized` when decoding is disabled
136
+ - `review_candidate`
137
+
138
+ Decoded results expose `text`, its `value` alias, exact `raw_bytes`, canonical
139
+ `format`, kind, confidence, sources, pixel quad, normalized quad, and analyzed
140
+ dimensions. Localization-only results do not have payload or format
141
+ attributes. Confidence is an engine-specific evidence score, not a probability
142
+ and not directly comparable across engines; status is the semantic signal.
143
+
144
+ `to_json(result)` is deterministic, rejects non-finite numbers, and serializes
145
+ raw bytes as Base64. Schemas and shared golden fixtures ship in
146
+ `codarascan/schemas` for consumer contract tests.
147
+
148
+ ## Formats
149
+
150
+ ```python
151
+ groups = Scanner.supported_formats()
152
+ print([item.name for item in groups["1d"]])
153
+ print([item.name for item in groups["2d"]])
154
+ ```
155
+
156
+ The capability is generated from the installed ZXing-C++ readable catalog and
157
+ contains 27 linear and 13 matrix selections in the pinned 0.1.0 dependency
158
+ range. It deliberately has no experimental/stability field. See
159
+ [compatibility and format status](docs/COMPATIBILITY.md) and the
160
+ [0.1.0 format evidence](benchmarks/results/FORMAT_STATUS_0.1.0.md).
161
+
162
+ ## CLI
163
+
164
+ ```bash
165
+ codarascan image label.png --mode fast --symbols all --json
166
+ codarascan document dossier.pdf --pages 1-4,7 --workers auto --ndjson
167
+ ```
168
+
169
+ Human output is the default. `--json` emits one shared-schema result;
170
+ `--ndjson` streams page objects and a final document summary. Standard output
171
+ is reserved for results. Warnings and debug-output locations use standard
172
+ error. Exit codes are 0 (symbols), 1 (successful no-symbol scan), 2 (invalid
173
+ usage/input), 3 (processing failure), and 4 (partial document result).
174
+
175
+ The private `codarascan _worker` command provides a persistent, versioned,
176
+ length-prefixed JSON protocol for backend adapters without opening a network
177
+ port. See [worker protocol](docs/WORKER_PROTOCOL.md).
178
+
179
+ ## Native Tessera acceleration
180
+
181
+ Official wheels are expected to contain `codarascan._sttg_native`. Source
182
+ installs build it when a supported compiler is available. If it cannot load,
183
+ scanning continues through the Python reference backend and emits exactly one
184
+ process-level warning:
185
+
186
+ > CodaraScan could not load the native Tessera extension. Falling back to the slower Python implementation.
187
+
188
+ Set `CODARASCAN_FORCE_PYTHON=1` to exercise the reference path. Result metadata
189
+ records `native` or `python-reference`.
190
+
191
+ ## Offline, privacy, and resources
192
+
193
+ Import, warm, image scanning, PDF rendering, CLI, and worker operations make no
194
+ network requests and emit no telemetry. Inputs, decoded payloads, rendered
195
+ pages, diagnostics, and explicit debug output may be sensitive. Default scans
196
+ leave no persistent crops, overlays, rendered pages, or payload files.
197
+
198
+ CodaraScan intentionally imposes no hidden limits on input bytes, dimensions,
199
+ pages, workers, CPU, memory, or results. Large images, 300-DPI PDFs, broad
200
+ format searches, diagnostics, and high worker counts can exhaust resources.
201
+ Callers own quotas, isolation, timeouts, admission control, and cancellation.
202
+
203
+ ## Development
204
+
205
+ ```bash
206
+ git submodule update --init --recursive
207
+ python3.11 -m venv .venv
208
+ .venv/bin/python -m pip install -e ".[dev]"
209
+ .venv/bin/ruff check src/codarascan tests
210
+ .venv/bin/mypy
211
+ .venv/bin/python -m pytest
212
+ .venv/bin/python -m build
213
+ ```
214
+
215
+ Research history remains under `archive/`, `benchmarks/`, and the authored
216
+ barcode report. Those assets are not installed as runtime package data. See
217
+ [contributing](CONTRIBUTING.md), [migration notes](MIGRATION.md),
218
+ [known limitations](docs/KNOWN_LIMITATIONS.md), and [changelog](CHANGELOG.md).
219
+
220
+ CodaraScan is licensed under Apache-2.0. Third-party provenance is recorded in
221
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).