uniparser2 0.7.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 (142) hide show
  1. uniparser2-0.7.0/.github/workflows/ci.yml +55 -0
  2. uniparser2-0.7.0/.gitignore +222 -0
  3. uniparser2-0.7.0/CHANGELOG.md +655 -0
  4. uniparser2-0.7.0/CONTRIBUTING.md +22 -0
  5. uniparser2-0.7.0/LICENSE +21 -0
  6. uniparser2-0.7.0/PKG-INFO +387 -0
  7. uniparser2-0.7.0/README.md +347 -0
  8. uniparser2-0.7.0/examples/etl/01-csv-lines/expected.json +5 -0
  9. uniparser2-0.7.0/examples/etl/01-csv-lines/input.txt +4 -0
  10. uniparser2-0.7.0/examples/etl/01-csv-lines/story.json +17 -0
  11. uniparser2-0.7.0/examples/etl/02-log-lines/expected.json +20 -0
  12. uniparser2-0.7.0/examples/etl/02-log-lines/input.txt +3 -0
  13. uniparser2-0.7.0/examples/etl/02-log-lines/story.json +17 -0
  14. uniparser2-0.7.0/examples/etl/03-json-orders/expected.json +4 -0
  15. uniparser2-0.7.0/examples/etl/03-json-orders/input.txt +6 -0
  16. uniparser2-0.7.0/examples/etl/03-json-orders/story.json +16 -0
  17. uniparser2-0.7.0/examples/etl/04-html-table/expected.json +4 -0
  18. uniparser2-0.7.0/examples/etl/04-html-table/input.txt +11 -0
  19. uniparser2-0.7.0/examples/etl/04-html-table/story.json +15 -0
  20. uniparser2-0.7.0/examples/etl/05-xml-feed/expected.json +4 -0
  21. uniparser2-0.7.0/examples/etl/05-xml-feed/input.txt +5 -0
  22. uniparser2-0.7.0/examples/etl/05-xml-feed/story.json +15 -0
  23. uniparser2-0.7.0/examples/etl/06-article/expected.json +6 -0
  24. uniparser2-0.7.0/examples/etl/06-article/input.txt +8 -0
  25. uniparser2-0.7.0/examples/etl/06-article/story.json +15 -0
  26. uniparser2-0.7.0/examples/etl/07-dedupe-sort/expected.json +1 -0
  27. uniparser2-0.7.0/examples/etl/07-dedupe-sort/input.txt +4 -0
  28. uniparser2-0.7.0/examples/etl/07-dedupe-sort/story.json +11 -0
  29. uniparser2-0.7.0/examples/etl/08-typed-invoice/expected.json +1 -0
  30. uniparser2-0.7.0/examples/etl/08-typed-invoice/host.py +14 -0
  31. uniparser2-0.7.0/examples/etl/08-typed-invoice/input.txt +1 -0
  32. uniparser2-0.7.0/examples/etl/08-typed-invoice/story.json +9 -0
  33. uniparser2-0.7.0/examples/etl/09-udf-slug/expected.json +4 -0
  34. uniparser2-0.7.0/examples/etl/09-udf-slug/host.py +10 -0
  35. uniparser2-0.7.0/examples/etl/09-udf-slug/input.txt +1 -0
  36. uniparser2-0.7.0/examples/etl/09-udf-slug/story.json +15 -0
  37. uniparser2-0.7.0/examples/etl/10-nested-groups/expected.json +10 -0
  38. uniparser2-0.7.0/examples/etl/10-nested-groups/input.txt +6 -0
  39. uniparser2-0.7.0/examples/etl/10-nested-groups/story.json +22 -0
  40. uniparser2-0.7.0/examples/etl/11-optional-field/expected.json +1 -0
  41. uniparser2-0.7.0/examples/etl/11-optional-field/input.txt +1 -0
  42. uniparser2-0.7.0/examples/etl/11-optional-field/story.json +8 -0
  43. uniparser2-0.7.0/examples/etl/README.md +22 -0
  44. uniparser2-0.7.0/pyproject.toml +139 -0
  45. uniparser2-0.7.0/src/uniparser2/__init__.py +116 -0
  46. uniparser2-0.7.0/src/uniparser2/cli/__init__.py +1 -0
  47. uniparser2-0.7.0/src/uniparser2/cli/conformance.py +140 -0
  48. uniparser2-0.7.0/src/uniparser2/cli/main.py +867 -0
  49. uniparser2-0.7.0/src/uniparser2/cli/samples.py +314 -0
  50. uniparser2-0.7.0/src/uniparser2/core/__init__.py +107 -0
  51. uniparser2-0.7.0/src/uniparser2/core/ast.py +223 -0
  52. uniparser2-0.7.0/src/uniparser2/core/compile.py +801 -0
  53. uniparser2-0.7.0/src/uniparser2/core/conformance.py +100 -0
  54. uniparser2-0.7.0/src/uniparser2/core/errors.py +158 -0
  55. uniparser2-0.7.0/src/uniparser2/core/evaluator.py +235 -0
  56. uniparser2-0.7.0/src/uniparser2/core/export.py +199 -0
  57. uniparser2-0.7.0/src/uniparser2/core/limits.py +51 -0
  58. uniparser2-0.7.0/src/uniparser2/core/materialize.py +188 -0
  59. uniparser2-0.7.0/src/uniparser2/core/refs.py +451 -0
  60. uniparser2-0.7.0/src/uniparser2/core/registry.py +494 -0
  61. uniparser2-0.7.0/src/uniparser2/core/story.py +456 -0
  62. uniparser2-0.7.0/src/uniparser2/core/trace.py +292 -0
  63. uniparser2-0.7.0/src/uniparser2/core/types.py +153 -0
  64. uniparser2-0.7.0/src/uniparser2/core/udfs.py +83 -0
  65. uniparser2-0.7.0/src/uniparser2/core/values.py +226 -0
  66. uniparser2-0.7.0/src/uniparser2/host.py +58 -0
  67. uniparser2-0.7.0/src/uniparser2/net/__init__.py +28 -0
  68. uniparser2-0.7.0/src/uniparser2/net/cache.py +157 -0
  69. uniparser2-0.7.0/src/uniparser2/net/download.py +200 -0
  70. uniparser2-0.7.0/src/uniparser2/ops/__init__.py +32 -0
  71. uniparser2-0.7.0/src/uniparser2/ops/basic.py +97 -0
  72. uniparser2-0.7.0/src/uniparser2/ops/code.py +474 -0
  73. uniparser2-0.7.0/src/uniparser2/ops/ctx.py +245 -0
  74. uniparser2-0.7.0/src/uniparser2/ops/htmldom.py +392 -0
  75. uniparser2-0.7.0/src/uniparser2/ops/jsonquery.py +167 -0
  76. uniparser2-0.7.0/src/uniparser2/ops/node.py +65 -0
  77. uniparser2-0.7.0/src/uniparser2/ops/pyops.py +1457 -0
  78. uniparser2-0.7.0/src/uniparser2/ops/regex.py +221 -0
  79. uniparser2-0.7.0/src/uniparser2/ops/typeop.py +94 -0
  80. uniparser2-0.7.0/src/uniparser2/ops/udf.py +227 -0
  81. uniparser2-0.7.0/src/uniparser2/ops/xmlxpath.py +277 -0
  82. uniparser2-0.7.0/src/uniparser2/py.typed +2 -0
  83. uniparser2-0.7.0/src/uniparser2/store/__init__.py +135 -0
  84. uniparser2-0.7.0/src/uniparser2/store/base.py +362 -0
  85. uniparser2-0.7.0/src/uniparser2/store/file.py +248 -0
  86. uniparser2-0.7.0/src/uniparser2/store/fingerprint.py +39 -0
  87. uniparser2-0.7.0/src/uniparser2/store/gates.py +45 -0
  88. uniparser2-0.7.0/src/uniparser2/store/model.py +114 -0
  89. uniparser2-0.7.0/src/uniparser2/store/sqlite.py +291 -0
  90. uniparser2-0.7.0/tests/__init__.py +7 -0
  91. uniparser2-0.7.0/tests/chains/__init__.py +1 -0
  92. uniparser2-0.7.0/tests/chains/test_public_and_try.py +172 -0
  93. uniparser2-0.7.0/tests/chains/test_story.py +620 -0
  94. uniparser2-0.7.0/tests/chains/test_trace.py +291 -0
  95. uniparser2-0.7.0/tests/chains/test_type_registry.py +195 -0
  96. uniparser2-0.7.0/tests/ci/__init__.py +1 -0
  97. uniparser2-0.7.0/tests/ci/test_ci_config.py +26 -0
  98. uniparser2-0.7.0/tests/cli/__init__.py +1 -0
  99. uniparser2-0.7.0/tests/cli/test_cached_runs.py +228 -0
  100. uniparser2-0.7.0/tests/cli/test_cli.py +495 -0
  101. uniparser2-0.7.0/tests/cli/test_snapshot.py +418 -0
  102. uniparser2-0.7.0/tests/compile/__init__.py +1 -0
  103. uniparser2-0.7.0/tests/compile/test_errors.py +257 -0
  104. uniparser2-0.7.0/tests/conformance/__init__.py +1 -0
  105. uniparser2-0.7.0/tests/conformance/test_conformance.py +91 -0
  106. uniparser2-0.7.0/tests/core/__init__.py +1 -0
  107. uniparser2-0.7.0/tests/core/test_core_edges.py +491 -0
  108. uniparser2-0.7.0/tests/core/test_export_diff.py +77 -0
  109. uniparser2-0.7.0/tests/core/test_materialize.py +258 -0
  110. uniparser2-0.7.0/tests/examples/__init__.py +1 -0
  111. uniparser2-0.7.0/tests/examples/test_demo.py +31 -0
  112. uniparser2-0.7.0/tests/examples/test_etl_examples.py +79 -0
  113. uniparser2-0.7.0/tests/net/__init__.py +1 -0
  114. uniparser2-0.7.0/tests/net/test_net_runtime.py +302 -0
  115. uniparser2-0.7.0/tests/ops/__init__.py +5 -0
  116. uniparser2-0.7.0/tests/ops/test_code.py +369 -0
  117. uniparser2-0.7.0/tests/ops/test_code_gate.py +125 -0
  118. uniparser2-0.7.0/tests/ops/test_ctx.py +216 -0
  119. uniparser2-0.7.0/tests/ops/test_each.py +301 -0
  120. uniparser2-0.7.0/tests/ops/test_htmldom.py +404 -0
  121. uniparser2-0.7.0/tests/ops/test_jsonquery.py +192 -0
  122. uniparser2-0.7.0/tests/ops/test_node.py +69 -0
  123. uniparser2-0.7.0/tests/ops/test_predicates.py +263 -0
  124. uniparser2-0.7.0/tests/ops/test_pyops.py +721 -0
  125. uniparser2-0.7.0/tests/ops/test_regex.py +104 -0
  126. uniparser2-0.7.0/tests/ops/test_registry.py +169 -0
  127. uniparser2-0.7.0/tests/ops/test_typeop.py +123 -0
  128. uniparser2-0.7.0/tests/ops/test_udf.py +185 -0
  129. uniparser2-0.7.0/tests/ops/test_xmlxpath.py +273 -0
  130. uniparser2-0.7.0/tests/report/__init__.py +5 -0
  131. uniparser2-0.7.0/tests/report/test_catalogue.py +101 -0
  132. uniparser2-0.7.0/tests/report/test_rendering.py +159 -0
  133. uniparser2-0.7.0/tests/runtime/__init__.py +1 -0
  134. uniparser2-0.7.0/tests/runtime/test_runtime_errors.py +237 -0
  135. uniparser2-0.7.0/tests/serialization/__init__.py +1 -0
  136. uniparser2-0.7.0/tests/serialization/test_roundtrip.py +112 -0
  137. uniparser2-0.7.0/tests/snapshots/test_demo_case.py +90 -0
  138. uniparser2-0.7.0/tests/store/__init__.py +1 -0
  139. uniparser2-0.7.0/tests/store/test_model.py +77 -0
  140. uniparser2-0.7.0/tests/store/test_repair.py +85 -0
  141. uniparser2-0.7.0/tests/store/test_store.py +396 -0
  142. uniparser2-0.7.0/tests/store/test_store_errors.py +238 -0
@@ -0,0 +1,55 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master, main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ # Minimum permissions: CI only needs to read the repository.
10
+ permissions:
11
+ contents: read
12
+
13
+ concurrency:
14
+ group: ${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ test:
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ # 3.15 is an alpha (3.15.0a7 via uv at the time of writing); the optional engines already
24
+ # publish cp315/abi3 wheels, so the cell is usable. Drop the pre-release note once stable.
25
+ python-version: ["3.12", "3.13", "3.14", "3.15"]
26
+ steps:
27
+ - uses: actions/checkout@v7
28
+
29
+ # setup-uv stopped publishing floating major tags after v7, so this one is an exact tag.
30
+ - uses: astral-sh/setup-uv@v10.3.3
31
+ with:
32
+ python-version: ${{ matrix.python-version }}
33
+ enable-cache: true
34
+
35
+ # Install the supported optional dependencies: the behavioral assertions for
36
+ # css/xpath/json/HTML-to-Markdown have to run once with every dependency present.
37
+ # `code` (the in-chain code sandbox) is installed only in the 3.13 cell: it is a ~12 MB platform
38
+ # binary and there is no point pulling a copy into every matrix cell; in the other cells
39
+ # tests/ops/test_code.py is skipped as a whole module (isolation and limit cases cannot really
40
+ # run without the sandbox, and skipping is more honest than faking coverage with a stand-in),
41
+ # while tests/ops/test_code_gate.py still runs -- it verifies exactly the fact that without the
42
+ # dependency the operator must be unusable at compile time. The dev group does **not** pin
43
+ # pydantic-monty, otherwise every cell would install it.
44
+ - name: Sync
45
+ run: |
46
+ EXTRAS="--extra html --extra xml --extra json --extra md"
47
+ if [ "${{ matrix.python-version }}" = "3.13" ]; then
48
+ EXTRAS="$EXTRAS --extra code"
49
+ fi
50
+ uv sync $EXTRAS
51
+
52
+ # The suite is the gate: it holds the conformance audit, the committed sample chains and the
53
+ # catalogue freshness, so CI runs tests only (no separate lint/type/security steps).
54
+ - name: Test with core coverage gate
55
+ run: uv run pytest --cov=uniparser2.core --cov-fail-under=95 --cov-report=term-missing
@@ -0,0 +1,222 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+
220
+ # Agent tooling: local skills for this workspace. The workflow they implement is
221
+ # part of the repo (AGENTS.md, CONTRIBUTING.md, openspec/), the copies are not.
222
+ .agents/