hi-pdf-parser 0.0.5__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 (34) hide show
  1. hi_pdf_parser-0.0.5/.dockerignore +40 -0
  2. hi_pdf_parser-0.0.5/.github/workflows/publish-pypi.yml +57 -0
  3. hi_pdf_parser-0.0.5/.gitignore +446 -0
  4. hi_pdf_parser-0.0.5/.pre-commit-config.yaml +28 -0
  5. hi_pdf_parser-0.0.5/.python-version +1 -0
  6. hi_pdf_parser-0.0.5/Dockerfile +25 -0
  7. hi_pdf_parser-0.0.5/LICENSE +661 -0
  8. hi_pdf_parser-0.0.5/Makefile +3 -0
  9. hi_pdf_parser-0.0.5/PKG-INFO +69 -0
  10. hi_pdf_parser-0.0.5/README.md +49 -0
  11. hi_pdf_parser-0.0.5/hi_pdf_parser/__init__.py +0 -0
  12. hi_pdf_parser-0.0.5/hi_pdf_parser/__main__.py +288 -0
  13. hi_pdf_parser-0.0.5/hi_pdf_parser/app.py +61 -0
  14. hi_pdf_parser-0.0.5/hi_pdf_parser/artifact_writer.py +172 -0
  15. hi_pdf_parser-0.0.5/hi_pdf_parser/config.py +24 -0
  16. hi_pdf_parser-0.0.5/hi_pdf_parser/datamodel.py +69 -0
  17. hi_pdf_parser-0.0.5/hi_pdf_parser/envelope.py +62 -0
  18. hi_pdf_parser-0.0.5/hi_pdf_parser/errors.py +61 -0
  19. hi_pdf_parser-0.0.5/hi_pdf_parser/logging_setup.py +55 -0
  20. hi_pdf_parser-0.0.5/hi_pdf_parser/parser.py +1274 -0
  21. hi_pdf_parser-0.0.5/hi_pdf_parser/runner.py +175 -0
  22. hi_pdf_parser-0.0.5/hi_pdf_parser/settings.py +31 -0
  23. hi_pdf_parser-0.0.5/hi_pdf_parser/utils/__init__.py +0 -0
  24. hi_pdf_parser-0.0.5/hi_pdf_parser/utils/hash.py +51 -0
  25. hi_pdf_parser-0.0.5/hi_pdf_parser/utils/table.py +39 -0
  26. hi_pdf_parser-0.0.5/pyproject.toml +124 -0
  27. hi_pdf_parser-0.0.5/tests/fixtures/multipage.pdf +0 -0
  28. hi_pdf_parser-0.0.5/tests/fixtures/normal.pdf +0 -0
  29. hi_pdf_parser-0.0.5/tests/fixtures/not-a-pdf.jpeg +0 -0
  30. hi_pdf_parser-0.0.5/tests/test_app.py +57 -0
  31. hi_pdf_parser-0.0.5/tests/test_commands.py +136 -0
  32. hi_pdf_parser-0.0.5/tests/test_logging_setup.py +73 -0
  33. hi_pdf_parser-0.0.5/tests/test_parser_construction.py +41 -0
  34. hi_pdf_parser-0.0.5/uv.lock +993 -0
@@ -0,0 +1,40 @@
1
+ # Ignore Python cache files
2
+ __pycache__/
3
+ **/__pycache__/
4
+ *.pyc
5
+ *.pyo
6
+ *.pyd
7
+
8
+ # Ignore virtual environments
9
+ env/
10
+ venv/
11
+
12
+ # Ignore development artifacts
13
+ *.log
14
+ *.db
15
+ *.sqlite3
16
+
17
+ # Ignore configuration and sensitive files
18
+ **/.env
19
+ *.env
20
+ *.ini
21
+ *.cfg
22
+
23
+ # Ignore IDE and editor settings
24
+ .vscode/
25
+ .idea/
26
+ *.swp
27
+ *.swo
28
+
29
+ # Ignore Git files
30
+ .git/
31
+ .gitignore
32
+
33
+ # Ignore Docker files themselves (optional if not needed in the image)
34
+ .dockerignore
35
+ Dockerfile*
36
+
37
+ # Ignore build artifacts (if applicable)
38
+ build/
39
+ dist/
40
+ *.egg-info
@@ -0,0 +1,57 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v[0-9]+.[0-9]+.[0-9]+"
7
+ - "[0-9]+.[0-9]+.[0-9]+"
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ publish:
14
+ name: Build and publish
15
+ runs-on: ubuntu-latest
16
+ environment:
17
+ name: pypi
18
+ url: https://pypi.org/p/hi-pdf-parser
19
+ permissions:
20
+ contents: read
21
+ id-token: write
22
+
23
+ steps:
24
+ - name: Check out repository
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Set up Python
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: "3.11"
31
+
32
+ - name: Verify tag matches package version
33
+ run: |
34
+ python - <<'PY'
35
+ import os
36
+ import tomllib
37
+
38
+ ref_name = os.environ["GITHUB_REF_NAME"]
39
+ tag_version = ref_name[1:] if ref_name.startswith("v") else ref_name
40
+ with open("pyproject.toml", "rb") as file:
41
+ project_version = tomllib.load(file)["project"]["version"]
42
+
43
+ if tag_version != project_version:
44
+ raise SystemExit(
45
+ f"Tag version {tag_version!r} does not match "
46
+ f"pyproject.toml version {project_version!r}"
47
+ )
48
+ PY
49
+
50
+ - name: Install build tooling
51
+ run: python -m pip install --upgrade uv
52
+
53
+ - name: Build distributions
54
+ run: uv build
55
+
56
+ - name: Publish to PyPI
57
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,446 @@
1
+ model_artifacts/
2
+ scratch/
3
+ .md-lint
4
+ actionlint
5
+
6
+ # Created by https://www.toptal.com/developers/gitignore/api/python,macos,virtualenv,pycharm,visualstudiocode,emacs,vim,jupyternotebooks
7
+ # Edit at https://www.toptal.com/developers/gitignore?templates=python,macos,virtualenv,pycharm,visualstudiocode,emacs,vim,jupyternotebooks
8
+
9
+ ### Emacs ###
10
+ # -*- mode: gitignore; -*-
11
+ *~
12
+ \#*\#
13
+ /.emacs.desktop
14
+ /.emacs.desktop.lock
15
+ *.elc
16
+ auto-save-list
17
+ tramp
18
+ .\#*
19
+
20
+ # Org-mode
21
+ .org-id-locations
22
+ *_archive
23
+
24
+ # flymake-mode
25
+ *_flymake.*
26
+
27
+ # eshell files
28
+ /eshell/history
29
+ /eshell/lastdir
30
+
31
+ # elpa packages
32
+ /elpa/
33
+
34
+ # reftex files
35
+ *.rel
36
+
37
+ # AUCTeX auto folder
38
+ /auto/
39
+
40
+ # cask packages
41
+ .cask/
42
+ dist/
43
+
44
+ # Flycheck
45
+ flycheck_*.el
46
+
47
+ # server auth directory
48
+ /server/
49
+
50
+ # projectiles files
51
+ .projectile
52
+
53
+ # directory configuration
54
+ .dir-locals.el
55
+
56
+ # network security
57
+ /network-security.data
58
+
59
+
60
+ ### JupyterNotebooks ###
61
+ # gitignore template for Jupyter Notebooks
62
+ # website: http://jupyter.org/
63
+
64
+ .ipynb_checkpoints
65
+ */.ipynb_checkpoints/*
66
+
67
+ # IPython
68
+ profile_default/
69
+ ipython_config.py
70
+
71
+ # Remove previous ipynb_checkpoints
72
+ # git rm -r .ipynb_checkpoints/
73
+
74
+ ### macOS ###
75
+ # General
76
+ .DS_Store
77
+ .AppleDouble
78
+ .LSOverride
79
+
80
+ # Icon must end with two \r
81
+ Icon
82
+
83
+
84
+ # Thumbnails
85
+ ._*
86
+
87
+ # Files that might appear in the root of a volume
88
+ .DocumentRevisions-V100
89
+ .fseventsd
90
+ .Spotlight-V100
91
+ .TemporaryItems
92
+ .Trashes
93
+ .VolumeIcon.icns
94
+ .com.apple.timemachine.donotpresent
95
+
96
+ # Directories potentially created on remote AFP share
97
+ .AppleDB
98
+ .AppleDesktop
99
+ Network Trash Folder
100
+ Temporary Items
101
+ .apdisk
102
+
103
+ ### macOS Patch ###
104
+ # iCloud generated files
105
+ *.icloud
106
+
107
+ ### PyCharm ###
108
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
109
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
110
+
111
+ # User-specific stuff
112
+ .idea/**/workspace.xml
113
+ .idea/**/tasks.xml
114
+ .idea/**/usage.statistics.xml
115
+ .idea/**/dictionaries
116
+ .idea/**/shelf
117
+
118
+ # AWS User-specific
119
+ .idea/**/aws.xml
120
+
121
+ # Generated files
122
+ .idea/**/contentModel.xml
123
+
124
+ # Sensitive or high-churn files
125
+ .idea/**/dataSources/
126
+ .idea/**/dataSources.ids
127
+ .idea/**/dataSources.local.xml
128
+ .idea/**/sqlDataSources.xml
129
+ .idea/**/dynamic.xml
130
+ .idea/**/uiDesigner.xml
131
+ .idea/**/dbnavigator.xml
132
+
133
+ # Gradle
134
+ .idea/**/gradle.xml
135
+ .idea/**/libraries
136
+
137
+ # Gradle and Maven with auto-import
138
+ # When using Gradle or Maven with auto-import, you should exclude module files,
139
+ # since they will be recreated, and may cause churn. Uncomment if using
140
+ # auto-import.
141
+ # .idea/artifacts
142
+ # .idea/compiler.xml
143
+ # .idea/jarRepositories.xml
144
+ # .idea/modules.xml
145
+ # .idea/*.iml
146
+ # .idea/modules
147
+ # *.iml
148
+ # *.ipr
149
+
150
+ # CMake
151
+ cmake-build-*/
152
+
153
+ # Mongo Explorer plugin
154
+ .idea/**/mongoSettings.xml
155
+
156
+ # File-based project format
157
+ *.iws
158
+
159
+ # IntelliJ
160
+ out/
161
+
162
+ # mpeltonen/sbt-idea plugin
163
+ .idea_modules/
164
+
165
+ # JIRA plugin
166
+ atlassian-ide-plugin.xml
167
+
168
+ # Cursive Clojure plugin
169
+ .idea/replstate.xml
170
+
171
+ # SonarLint plugin
172
+ .idea/sonarlint/
173
+
174
+ # Crashlytics plugin (for Android Studio and IntelliJ)
175
+ com_crashlytics_export_strings.xml
176
+ crashlytics.properties
177
+ crashlytics-build.properties
178
+ fabric.properties
179
+
180
+ # Editor-based Rest Client
181
+ .idea/httpRequests
182
+
183
+ # Android studio 3.1+ serialized cache file
184
+ .idea/caches/build_file_checksums.ser
185
+
186
+ ### PyCharm Patch ###
187
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
188
+
189
+ # *.iml
190
+ # modules.xml
191
+ # .idea/misc.xml
192
+ # *.ipr
193
+
194
+ # Sonarlint plugin
195
+ # https://plugins.jetbrains.com/plugin/7973-sonarlint
196
+ .idea/**/sonarlint/
197
+
198
+ # SonarQube Plugin
199
+ # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
200
+ .idea/**/sonarIssues.xml
201
+
202
+ # Markdown Navigator plugin
203
+ # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
204
+ .idea/**/markdown-navigator.xml
205
+ .idea/**/markdown-navigator-enh.xml
206
+ .idea/**/markdown-navigator/
207
+
208
+ # Cache file creation bug
209
+ # See https://youtrack.jetbrains.com/issue/JBR-2257
210
+ .idea/$CACHE_FILE$
211
+
212
+ # CodeStream plugin
213
+ # https://plugins.jetbrains.com/plugin/12206-codestream
214
+ .idea/codestream.xml
215
+
216
+ # Azure Toolkit for IntelliJ plugin
217
+ # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
218
+ .idea/**/azureSettings.xml
219
+
220
+ ### Python ###
221
+ # Byte-compiled / optimized / DLL files
222
+ __pycache__/
223
+ *.py[cod]
224
+ *$py.class
225
+
226
+ # C extensions
227
+ *.so
228
+
229
+ # Distribution / packaging
230
+ .Python
231
+ build/
232
+ develop-eggs/
233
+ downloads/
234
+ eggs/
235
+ .eggs/
236
+ lib/
237
+ lib64/
238
+ parts/
239
+ sdist/
240
+ var/
241
+ wheels/
242
+ share/python-wheels/
243
+ *.egg-info/
244
+ .installed.cfg
245
+ *.egg
246
+ MANIFEST
247
+
248
+ # PyInstaller
249
+ # Usually these files are written by a python script from a template
250
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
251
+ *.manifest
252
+ *.spec
253
+
254
+ # Installer logs
255
+ pip-log.txt
256
+ pip-delete-this-directory.txt
257
+
258
+ # Unit test / coverage reports
259
+ htmlcov/
260
+ .tox/
261
+ .nox/
262
+ .coverage
263
+ .coverage.*
264
+ .cache
265
+ nosetests.xml
266
+ coverage.xml
267
+ *.cover
268
+ *.py,cover
269
+ .hypothesis/
270
+ .pytest_cache/
271
+ cover/
272
+
273
+ # Translations
274
+ *.mo
275
+ *.pot
276
+
277
+ # Django stuff:
278
+ *.log
279
+ local_settings.py
280
+ db.sqlite3
281
+ db.sqlite3-journal
282
+
283
+ # Flask stuff:
284
+ instance/
285
+ .webassets-cache
286
+
287
+ # Scrapy stuff:
288
+ .scrapy
289
+
290
+ # Sphinx documentation
291
+ docs/_build/
292
+
293
+ # PyBuilder
294
+ .pybuilder/
295
+ target/
296
+
297
+ # Jupyter Notebook
298
+
299
+ # IPython
300
+
301
+ # pyenv
302
+ # For a library or package, you might want to ignore these files since the code is
303
+ # intended to run in multiple environments; otherwise, check them in:
304
+ # .python-version
305
+
306
+ # pipenv
307
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
308
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
309
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
310
+ # install all needed dependencies.
311
+ #Pipfile.lock
312
+
313
+ # poetry
314
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
315
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
316
+ # commonly ignored for libraries.
317
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
318
+ #poetry.lock
319
+
320
+ # pdm
321
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
322
+ #pdm.lock
323
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
324
+ # in version control.
325
+ # https://pdm.fming.dev/#use-with-ide
326
+ .pdm.toml
327
+
328
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
329
+ __pypackages__/
330
+
331
+ # Celery stuff
332
+ celerybeat-schedule
333
+ celerybeat.pid
334
+
335
+ # SageMath parsed files
336
+ *.sage.py
337
+
338
+ # Environments
339
+ .env
340
+ .venv
341
+ env/
342
+ venv/
343
+ ENV/
344
+ env.bak/
345
+ venv.bak/
346
+
347
+ # Spyder project settings
348
+ .spyderproject
349
+ .spyproject
350
+
351
+ # Rope project settings
352
+ .ropeproject
353
+
354
+ # mkdocs documentation
355
+ /site
356
+
357
+ # mypy
358
+ .mypy_cache/
359
+ .dmypy.json
360
+ dmypy.json
361
+
362
+ # Pyre type checker
363
+ .pyre/
364
+
365
+ # pytype static type analyzer
366
+ .pytype/
367
+
368
+ # Cython debug symbols
369
+ cython_debug/
370
+
371
+ # PyCharm
372
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
373
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
374
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
375
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
376
+ .idea/
377
+
378
+ ### Python Patch ###
379
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
380
+ poetry.toml
381
+
382
+ # ruff
383
+ .ruff_cache/
384
+
385
+ ### Vim ###
386
+ # Swap
387
+ [._]*.s[a-v][a-z]
388
+ !*.svg # comment out if you don't need vector files
389
+ [._]*.sw[a-p]
390
+ [._]s[a-rt-v][a-z]
391
+ [._]ss[a-gi-z]
392
+ [._]sw[a-p]
393
+
394
+ # Session
395
+ Session.vim
396
+ Sessionx.vim
397
+
398
+ # Temporary
399
+ .netrwhist
400
+ # Auto-generated tag files
401
+ tags
402
+ # Persistent undo
403
+ [._]*.un~
404
+
405
+
406
+ ### Visual Studio Code ###
407
+ .vscode/
408
+
409
+ ### VirtualEnv ###
410
+ # Virtualenv
411
+ # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
412
+ [Bb]in
413
+ [Ii]nclude
414
+ [Ll]ib
415
+ [Ll]ib64
416
+ [Ll]ocal
417
+ pyvenv.cfg
418
+ pip-selfcheck.json
419
+
420
+ ### VisualStudioCode ###
421
+ .vscode/*
422
+ !.vscode/settings.json
423
+ !.vscode/tasks.json
424
+ !.vscode/launch.json
425
+ !.vscode/extensions.json
426
+ !.vscode/*.code-snippets
427
+
428
+ # Local History for Visual Studio Code
429
+ .history/
430
+
431
+ # Built Visual Studio Code Extensions
432
+ *.vsix
433
+
434
+ ### VisualStudioCode Patch ###
435
+ # Ignore all local history of files
436
+ .history
437
+ .ionide
438
+
439
+
440
+ # Docs
441
+ # docs/**/*.png
442
+ # docs/**/*.svg
443
+
444
+ # Makefile
445
+ .action-lint
446
+ .markdown-lint
@@ -0,0 +1,28 @@
1
+ fail_fast: true
2
+ repos:
3
+ - repo: https://github.com/astral-sh/ruff-pre-commit
4
+ rev: v0.9.6
5
+ hooks:
6
+ # Run the Ruff formatter.
7
+ - id: ruff-format
8
+ name: "Ruff formatter"
9
+ args: [--config=pyproject.toml]
10
+ files: '^(hi_pdf_parser|tests).*\.(py|ipynb)$'
11
+ # Run the Ruff linter.
12
+ - id: ruff
13
+ name: "Ruff linter"
14
+ args: [--exit-non-zero-on-fix, --fix, --config=pyproject.toml]
15
+ files: '^(hi_pdf_parser|tests).*\.(py|ipynb)$'
16
+ - repo: local
17
+ hooks:
18
+ - id: system
19
+ name: MyPy
20
+ entry: uv run --no-sync mypy hi_pdf_parser
21
+ pass_filenames: false
22
+ language: system
23
+ files: '\.py$'
24
+ - repo: https://github.com/astral-sh/uv-pre-commit
25
+ # uv version.
26
+ rev: 0.7.17
27
+ hooks:
28
+ - id: uv-lock
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,25 @@
1
+ ARG BASE_IMAGE=python:3.11-slim-bookworm
2
+
3
+ FROM ${BASE_IMAGE} AS exporter
4
+
5
+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
6
+
7
+ WORKDIR /app
8
+
9
+ ADD pyproject.toml uv.lock .
10
+
11
+ RUN /root/.local/bin/uv export --extra server --no-hashes --no-dev -o requirements.txt
12
+
13
+ FROM ${BASE_IMAGE}
14
+
15
+ COPY --from=exporter --chown=nobody:nogroup /app/requirements.txt .
16
+
17
+ RUN pip install -r requirements.txt
18
+
19
+ USER nobody:nogroup
20
+
21
+ WORKDIR /app
22
+
23
+ COPY hi_pdf_parser ./hi_pdf_parser
24
+
25
+ CMD ["python3", "-m", "hi_pdf_parser", "serve"]