jolt-py 1.0.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.
@@ -0,0 +1,19 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.pyo
4
+ *.pyd
5
+ *.so
6
+ *.egg
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ .eggs/
11
+ .venv/
12
+ venv/
13
+ .mypy_cache/
14
+ .ruff_cache/
15
+ .pytest_cache/
16
+ htmlcov/
17
+ .coverage
18
+ coverage.xml
19
+ *.log
@@ -0,0 +1,60 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] — 2024-04-10
9
+
10
+ ### Added
11
+
12
+ **Core transforms (full Java JOLT parity)**
13
+
14
+ - `Shift` — re-map fields with full spec language support:
15
+ - Literal key matching
16
+ - Wildcard `*` matching (prefix/suffix combinable, e.g. `prefix_*_suffix`)
17
+ - OR patterns (`a|b`)
18
+ - Self-reference `@` — uses the current input node as its own value
19
+ - `$` / `$N` — emits the matched key name N levels up as a value
20
+ - `#literal` — emits a constant string as a value
21
+ - Output path tokens: `&`/`&N` back-references, `&(N,M)` capture groups,
22
+ `@(N,path)` value lookups, `[]` array-append
23
+ - Array-of-objects slot coordination — multiple fields from the same wildcard
24
+ iteration land in the same output list element
25
+ - Multiple output paths (list of strings)
26
+
27
+ - `Default` — fill absent or `null` fields; wildcard `*` applies to every key;
28
+ list-aware (`{"key": {"*": sub_spec}}` applies `sub_spec` to each list element)
29
+
30
+ - `Remove` — delete specified fields; `"*"` removes all keys at a level
31
+
32
+ - `Sort` — recursively sort all dict keys alphabetically
33
+
34
+ - `Cardinality` — enforce `ONE` (scalar) or `MANY` (list) cardinality
35
+
36
+ - `ModifyOverwrite` / `ModifyDefault` — apply functions or literal values to
37
+ fields; 39 built-in functions covering type conversions, string manipulation,
38
+ numeric operations, and collection utilities:
39
+ `toInteger`, `toLong`, `toDouble`, `toFloat`, `toString`, `toBoolean`,
40
+ `trim`, `toUpperCase`, `toLowerCase`, `abs`, `min`, `max`, `intSum`,
41
+ `doubleSum`, `longSum`, `floatSum`, `sum`, `avg`, `sqrt`, `not`,
42
+ `size`, `concat`, `join`, `split`, `leftPad`, `rightPad`, `substring`,
43
+ `startsWith`, `endsWith`, `contains`, `squashNulls`, `recursivelySquashNulls`,
44
+ `toList`, `firstElement`, `lastElement`, `elementAt`, `indexOf`, `coalesce`,
45
+ `noop`
46
+
47
+ - `Chainr` — chain multiple transforms sequentially; supports both direct
48
+ instantiation and JOLT-spec lists (`from_spec`)
49
+
50
+ **Packaging**
51
+
52
+ - PEP 561 `py.typed` marker — full inline type annotations
53
+ - `pyproject.toml` with hatchling build backend, classifiers, URLs
54
+ - Python 3.10–3.13 support
55
+
56
+ **Tests**
57
+
58
+ - 193 tests across all transforms and real-world integration scenarios
59
+
60
+ [1.0.0]: https://github.com/sthitaprajnas/pyjolt/releases/tag/v1.0.0
@@ -0,0 +1,62 @@
1
+ # Contributing to PyJolt
2
+
3
+ Thank you for your interest in contributing! We welcome bug reports, feature
4
+ requests, and pull requests.
5
+
6
+ ## Development setup
7
+
8
+ ```bash
9
+ git clone https://github.com/sthitaprajnas/pyjolt.git
10
+ cd pyjolt
11
+ python -m venv .venv && source .venv/bin/activate
12
+ pip install -e ".[dev]"
13
+ ```
14
+
15
+ ## Running tests
16
+
17
+ ```bash
18
+ # All tests
19
+ pytest
20
+
21
+ # With coverage
22
+ pytest --cov=pyjolt --cov-report=term-missing
23
+
24
+ # Single file
25
+ pytest tests/test_shift.py -v
26
+ ```
27
+
28
+ ## Code quality
29
+
30
+ ```bash
31
+ # Lint + auto-fix
32
+ ruff check src/pyjolt --fix
33
+
34
+ # Type check
35
+ mypy src/pyjolt
36
+ ```
37
+
38
+ Both must pass with zero errors before a PR is merged.
39
+
40
+ ## Submitting a pull request
41
+
42
+ 1. Fork the repository and create a branch from `main`.
43
+ 2. Add or update tests that cover your change.
44
+ 3. Ensure `pytest`, `ruff check`, and `mypy` all pass.
45
+ 4. Open a pull request with a clear description and reference any related issues.
46
+
47
+ ## Reporting issues
48
+
49
+ Use [GitHub Issues](https://github.com/sthitaprajnas/pyjolt/issues). For
50
+ security vulnerabilities, see [SECURITY.md](SECURITY.md).
51
+
52
+ ## Coding conventions
53
+
54
+ - Follow existing code style (enforced by ruff).
55
+ - Full type annotations on all public functions.
56
+ - Docstrings on public classes and methods.
57
+ - No runtime dependencies beyond the Python standard library.
58
+
59
+ ## License
60
+
61
+ By contributing you agree that your contributions will be licensed under the
62
+ [Apache License 2.0](LICENSE).
jolt_py-1.0.0/LICENSE ADDED
@@ -0,0 +1,186 @@
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 made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submit" means any form of electronic, verbal, or
51
+ written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent contributions
76
+ Licensable by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or contributory
82
+ patent infringement, then any patent licenses granted to You under this
83
+ License for that Work shall terminate as of the date such litigation is
84
+ filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or in addition to the
115
+ NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the
117
+ License.
118
+
119
+ You may add Your own license statement for Your modifications and
120
+ may provide additional grant of rights to use, copy, modify, merge,
121
+ publish, distribute, sublicense, and/or sell copies of the
122
+ Derivative Works, as opposed to the original Work.
123
+
124
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
125
+ any Contribution intentionally submitted for inclusion in the Work
126
+ by You to the Licensor shall be under the terms and conditions of
127
+ this License, without any additional terms or conditions.
128
+ Notwithstanding the above, nothing herein shall supersede or modify
129
+ the terms of any separate license agreement you may have executed
130
+ with Licensor regarding such Contributions.
131
+
132
+ 6. Trademarks. This License does not grant permission to use the trade
133
+ names, trademarks, service marks, or product names of the Licensor,
134
+ except as required for reasonable and customary use in describing the
135
+ origin of the Work and reproducing the content of the NOTICE file.
136
+
137
+ 7. Disclaimer of Warranty. Unless required by applicable law or
138
+ agreed to in writing, Licensor provides the Work (and each
139
+ Contributor provides its Contributions) on an "AS IS" BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
141
+ implied, including, without limitation, any conditions of TITLE,
142
+ MERCHANTIBILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
143
+ responsible for determining the appropriateness of using or
144
+ redistributing the Work and assume any risks associated with Your
145
+ exercise of permissions under this License.
146
+
147
+ 8. Limitation of Liability. In no event and under no legal theory,
148
+ whether in tort (including negligence), contract, or otherwise,
149
+ unless required by applicable law (such as deliberate and grossly
150
+ negligent acts) or agreed to in writing, shall any Contributor be
151
+ liable to You for damages, including any direct, indirect, special,
152
+ incidental, or exemplary damages of any character arising as a
153
+ result of this License or out of the use or inability to use the
154
+ Work (even if such Contributor has been advised of the possibility
155
+ of such damages).
156
+
157
+ 9. Accepting Warranty or Additional Liability. While redistributing
158
+ the Work or Derivative Works thereof, You may choose to offer, and
159
+ charge a fee for, acceptance of support, warranty, indemnity,
160
+ or other liability obligations and/or rights consistent with this
161
+ License. However, in accepting such obligations, You may offer only
162
+ conditions consistent with this License and charge a reasonable fee.
163
+
164
+ END OF TERMS AND CONDITIONS
165
+
166
+ APPENDIX: How to apply the Apache License to your work.
167
+
168
+ To apply the Apache License to your work, attach the following
169
+ boilerplate notice, with the fields enclosed by brackets "[]"
170
+ replaced with your own identifying information. (Don't include
171
+ the brackets!) The text should be enclosed in the appropriate
172
+ comment syntax for the file format in question.
173
+
174
+ Copyright [yyyy] [name of copyright owner]
175
+
176
+ Licensed under the Apache License, Version 2.0 (the "License");
177
+ you may not use this file except in compliance with the License.
178
+ You may obtain a copy of the License at
179
+
180
+ http://www.apache.org/licenses/LICENSE-2.0
181
+
182
+ Unless required by applicable law or agreed to in writing, software
183
+ distributed under the License is distributed on an "AS IS" BASIS,
184
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
185
+ See the License for the specific language governing permissions and
186
+ limitations under the License.
jolt_py-1.0.0/NOTICE ADDED
@@ -0,0 +1,9 @@
1
+ PyJolt
2
+ Copyright 2024 Sthitaprajna Sahoo and contributors
3
+
4
+ This product includes software developed at the PyJolt project
5
+ (https://github.com/sthitaprajnas/pyjolt).
6
+
7
+ This software is a Python implementation inspired by the JOLT library
8
+ (https://github.com/bazaarvoice/jolt), originally developed by Bazaarvoice, Inc.
9
+ and licensed under the Apache License, Version 2.0.