diffx-python 0.6.1__cp311-cp311-win_amd64.whl
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.
diffx_python/__init__.py
ADDED
|
Binary file
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: diffx-python
|
|
3
|
+
Version: 0.6.1
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Rust
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: Topic :: Text Processing
|
|
17
|
+
Classifier: Topic :: Utilities
|
|
18
|
+
Requires-Dist: pytest>=6.0 ; extra == 'dev'
|
|
19
|
+
Requires-Dist: pytest-cov ; extra == 'dev'
|
|
20
|
+
Requires-Dist: black ; extra == 'dev'
|
|
21
|
+
Requires-Dist: isort ; extra == 'dev'
|
|
22
|
+
Requires-Dist: mypy ; extra == 'dev'
|
|
23
|
+
Requires-Dist: ruff ; extra == 'dev'
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Summary: Python bindings for diffx - semantic diffing of JSON, YAML, TOML, XML, INI, and CSV files. Powered by Rust for blazing fast performance.
|
|
27
|
+
Keywords: diff,json,yaml,toml,xml,ini,csv,structured,semantic,comparison,devops,ci-cd,automation,data-analysis,pyo3,rust
|
|
28
|
+
Author: kako-jun
|
|
29
|
+
License-Expression: MIT
|
|
30
|
+
Requires-Python: >=3.8
|
|
31
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
32
|
+
Project-URL: Homepage, https://github.com/kako-jun/diffx-python
|
|
33
|
+
Project-URL: Repository, https://github.com/kako-jun/diffx-python
|
|
34
|
+
Project-URL: Issues, https://github.com/kako-jun/diffx-python/issues
|
|
35
|
+
Project-URL: Documentation, https://github.com/kako-jun/diffx-python#readme
|
|
36
|
+
|
|
37
|
+
# diffx-python
|
|
38
|
+
|
|
39
|
+
Python bindings for [diffx](https://github.com/kako-jun/diffx) - semantic diff for structured data (JSON, YAML, TOML, XML, INI, CSV). Powered by Rust via PyO3 for blazing fast performance.
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install diffx-python
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Supported Platforms
|
|
48
|
+
|
|
49
|
+
| Platform | Architecture |
|
|
50
|
+
|----------|--------------|
|
|
51
|
+
| Linux | x64 (glibc) |
|
|
52
|
+
| Linux | x64 (musl/Alpine) |
|
|
53
|
+
| Linux | ARM64 |
|
|
54
|
+
| macOS | x64 (Intel) |
|
|
55
|
+
| macOS | ARM64 (Apple Silicon) |
|
|
56
|
+
| Windows | x64 |
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
### Basic Diff
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import diffx_python as diffx
|
|
64
|
+
|
|
65
|
+
old = {"name": "Alice", "age": 30}
|
|
66
|
+
new = {"name": "Alice", "age": 31, "city": "Tokyo"}
|
|
67
|
+
|
|
68
|
+
results = diffx.diff(old, new)
|
|
69
|
+
|
|
70
|
+
for change in results:
|
|
71
|
+
print(f"{change['type']}: {change['path']}")
|
|
72
|
+
# Modified: age
|
|
73
|
+
# Added: city
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### With Options
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
results = diffx.diff(data1, data2,
|
|
80
|
+
epsilon=0.001, # Tolerance for float comparison
|
|
81
|
+
array_id_key='id', # Match array elements by ID
|
|
82
|
+
ignore_keys_regex='timestamp|updatedAt', # Ignore keys matching regex
|
|
83
|
+
path_filter='user', # Only show diffs in paths containing "user"
|
|
84
|
+
ignore_case=True, # Ignore case differences
|
|
85
|
+
ignore_whitespace=True, # Ignore whitespace differences
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Parsers
|
|
90
|
+
|
|
91
|
+
Parse various formats to Python objects:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
import diffx_python as diffx
|
|
95
|
+
|
|
96
|
+
json_obj = diffx.parse_json('{"name": "Alice"}')
|
|
97
|
+
yaml_obj = diffx.parse_yaml('name: Alice\nage: 30')
|
|
98
|
+
toml_obj = diffx.parse_toml('name = "Alice"')
|
|
99
|
+
csv_list = diffx.parse_csv('name,age\nAlice,30')
|
|
100
|
+
ini_obj = diffx.parse_ini('[user]\nname = Alice')
|
|
101
|
+
xml_obj = diffx.parse_xml('<user><name>Alice</name></user>')
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Format Output
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
import diffx_python as diffx
|
|
108
|
+
|
|
109
|
+
results = diffx.diff(old, new)
|
|
110
|
+
print(diffx.format_output(results, 'json')) # JSON format
|
|
111
|
+
print(diffx.format_output(results, 'yaml')) # YAML format
|
|
112
|
+
print(diffx.format_output(results, 'diffx')) # diffx format
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### File Comparison
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import diffx_python as diffx
|
|
119
|
+
|
|
120
|
+
# Compare files (auto-detects format from extension)
|
|
121
|
+
results = diffx.diff_files('old.json', 'new.json')
|
|
122
|
+
results = diffx.diff_files('config1.yaml', 'config2.yaml', epsilon=0.1)
|
|
123
|
+
|
|
124
|
+
# Compare strings
|
|
125
|
+
json1 = '{"name": "Alice", "age": 30}'
|
|
126
|
+
json2 = '{"name": "Alice", "age": 31}'
|
|
127
|
+
results = diffx.diff_strings(json1, json2, 'json')
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## API Reference
|
|
131
|
+
|
|
132
|
+
### `diff(old, new, **kwargs)`
|
|
133
|
+
|
|
134
|
+
Compare two values and return differences.
|
|
135
|
+
|
|
136
|
+
**Options (kwargs):**
|
|
137
|
+
| Option | Type | Description |
|
|
138
|
+
|--------|------|-------------|
|
|
139
|
+
| `epsilon` | float | Tolerance for floating-point comparisons |
|
|
140
|
+
| `array_id_key` | str | Key to identify array elements |
|
|
141
|
+
| `ignore_keys_regex` | str | Regex pattern for keys to ignore |
|
|
142
|
+
| `path_filter` | str | Only show diffs in matching paths |
|
|
143
|
+
| `output_format` | str | Output format ("diffx", "json", "yaml") |
|
|
144
|
+
| `ignore_whitespace` | bool | Ignore whitespace differences |
|
|
145
|
+
| `ignore_case` | bool | Ignore case differences |
|
|
146
|
+
| `brief_mode` | bool | Report only whether objects differ |
|
|
147
|
+
| `quiet_mode` | bool | Suppress normal output |
|
|
148
|
+
|
|
149
|
+
**Returns:** List of diff results:
|
|
150
|
+
```python
|
|
151
|
+
# For Added/Removed:
|
|
152
|
+
{"type": "Added", "path": "key", "value": ...}
|
|
153
|
+
{"type": "Removed", "path": "key", "value": ...}
|
|
154
|
+
|
|
155
|
+
# For Modified/TypeChanged:
|
|
156
|
+
{"type": "Modified", "path": "key", "old_value": ..., "new_value": ...}
|
|
157
|
+
{"type": "TypeChanged", "path": "key", "old_value": ..., "new_value": ...}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Parsers
|
|
161
|
+
|
|
162
|
+
- `parse_json(content: str) -> Any`
|
|
163
|
+
- `parse_yaml(content: str) -> Any`
|
|
164
|
+
- `parse_toml(content: str) -> dict`
|
|
165
|
+
- `parse_csv(content: str) -> list[dict]`
|
|
166
|
+
- `parse_ini(content: str) -> dict`
|
|
167
|
+
- `parse_xml(content: str) -> dict`
|
|
168
|
+
|
|
169
|
+
### Utility Functions
|
|
170
|
+
|
|
171
|
+
- `format_output(results: list, format: str) -> str` - Format diff results as string
|
|
172
|
+
- `diff_files(file1: str, file2: str, **kwargs) -> list` - Compare two files
|
|
173
|
+
- `diff_strings(str1: str, str2: str, format: str, **kwargs) -> list` - Compare two strings
|
|
174
|
+
|
|
175
|
+
### Exception
|
|
176
|
+
|
|
177
|
+
- `DiffError` - Raised when diff operations fail
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Setup
|
|
183
|
+
uv sync --all-extras
|
|
184
|
+
|
|
185
|
+
# Build
|
|
186
|
+
uv run maturin develop
|
|
187
|
+
|
|
188
|
+
# Test
|
|
189
|
+
uv run pytest -v
|
|
190
|
+
|
|
191
|
+
# Format & Lint
|
|
192
|
+
cargo fmt --check
|
|
193
|
+
cargo clippy
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT
|
|
199
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
diffx_python-0.6.1.dist-info/METADATA,sha256=1KGOh6rBjsSMf9k597hyvFPd-D2lV8Z5Dx0FOZ-iqEA,6043
|
|
2
|
+
diffx_python-0.6.1.dist-info/WHEEL,sha256=_VPPvUclC3MhfkWOFBHNyWiipF8PVIsIyXlb9TrMHeA,97
|
|
3
|
+
diffx_python-0.6.1.dist-info/licenses/LICENSE,sha256=JmhTl0sEaaBl59TVvnWVCdjn-C6HfIpoRZkB0rgubQo,1086
|
|
4
|
+
diffx_python/__init__.py,sha256=h6VbYpqtuHT_EHX_bhTUWJq-kGH4LVgxV5i-RDGpzmQ,131
|
|
5
|
+
diffx_python/diffx_python.cp311-win_amd64.pyd,sha256=miwgKhOfHkLpai2HEFONL_HNB673_I3pWMjwyJuF5Cc,2698240
|
|
6
|
+
diffx_python-0.6.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 kako-jun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|