vcdiff-decoder 0.1.0a1__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.
- vcdiff_decoder-0.1.0a1/LICENSE +204 -0
- vcdiff_decoder-0.1.0a1/PKG-INFO +285 -0
- vcdiff_decoder-0.1.0a1/README.md +260 -0
- vcdiff_decoder-0.1.0a1/pyproject.toml +53 -0
- vcdiff_decoder-0.1.0a1/vcdiff_decoder/__init__.py +43 -0
- vcdiff_decoder-0.1.0a1/vcdiff_decoder/addresscache.py +111 -0
- vcdiff_decoder-0.1.0a1/vcdiff_decoder/adler32.py +43 -0
- vcdiff_decoder-0.1.0a1/vcdiff_decoder/codetable.py +106 -0
- vcdiff_decoder-0.1.0a1/vcdiff_decoder/decoder.py +435 -0
- vcdiff_decoder-0.1.0a1/vcdiff_decoder/exceptions.py +56 -0
- vcdiff_decoder-0.1.0a1/vcdiff_decoder/types.py +112 -0
- vcdiff_decoder-0.1.0a1/vcdiff_decoder/varint.py +52 -0
|
@@ -0,0 +1,204 @@
|
|
|
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 granting the License.
|
|
13
|
+
|
|
14
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
15
|
+
other entities that control, are controlled by, or are under common
|
|
16
|
+
control with that entity. For the purposes of this definition,
|
|
17
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
18
|
+
direction or management of such entity, whether by contract or
|
|
19
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
20
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
21
|
+
|
|
22
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
23
|
+
exercising permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
26
|
+
including but not limited to software source code, documentation
|
|
27
|
+
source, and configuration files.
|
|
28
|
+
|
|
29
|
+
"Object" form shall mean any form resulting from mechanical
|
|
30
|
+
transformation or translation of a Source form, including but
|
|
31
|
+
not limited to compiled object code, generated documentation,
|
|
32
|
+
and conversions to other media types.
|
|
33
|
+
|
|
34
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
35
|
+
Object form, made available under the License, as indicated by a
|
|
36
|
+
copyright notice that is included in or attached to the work
|
|
37
|
+
(which shall not include the Communication Networks class of works).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based upon (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 any work of authorship, including
|
|
48
|
+
the original version of the Work and any modifications or additions
|
|
49
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
50
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
51
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
52
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
53
|
+
means any form of electronic, verbal, or written communication sent
|
|
54
|
+
to the Licensor or its representatives, including but not limited to
|
|
55
|
+
communication on electronic mailing lists, source code control
|
|
56
|
+
systems, and issue tracking systems that are managed by, or on behalf
|
|
57
|
+
of, the Licensor for the purpose of discussing and improving the Work,
|
|
58
|
+
but excluding communication that is conspicuously marked or otherwise
|
|
59
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
60
|
+
|
|
61
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
62
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
63
|
+
subsequently incorporated within the Work.
|
|
64
|
+
|
|
65
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
66
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
67
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
68
|
+
copyright license to use, reproduce, modify, publish, distribute,
|
|
69
|
+
sublicense, and/or sell copies of the Work, and to permit persons
|
|
70
|
+
to whom the Work is furnished to do so, subject to the following
|
|
71
|
+
conditions:
|
|
72
|
+
|
|
73
|
+
The above copyright notice and this permission notice shall be
|
|
74
|
+
included in all copies or substantial portions of the Work.
|
|
75
|
+
|
|
76
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
77
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
78
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
79
|
+
(except as stated in this section) patent license to make, have made,
|
|
80
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
81
|
+
where such license applies only to those patent claims licensable
|
|
82
|
+
by such Contributor that are necessarily infringed by their
|
|
83
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
84
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
85
|
+
institute patent litigation against any entity (including a
|
|
86
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
87
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
88
|
+
or contributory patent infringement, then any patent licenses
|
|
89
|
+
granted to You under this License for that Work shall terminate
|
|
90
|
+
as of the date such litigation is filed.
|
|
91
|
+
|
|
92
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
93
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
94
|
+
modifications, and in Source or Object form, provided that You
|
|
95
|
+
meet the following conditions:
|
|
96
|
+
|
|
97
|
+
(a) You must give any other recipients of the Work or
|
|
98
|
+
Derivative Works a copy of this License; and
|
|
99
|
+
|
|
100
|
+
(b) You must cause any modified files to carry prominent notices
|
|
101
|
+
stating that You changed the files; and
|
|
102
|
+
|
|
103
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
104
|
+
that You distribute, all copyright, trademark, patent,
|
|
105
|
+
attribution and other notices from the Source form of the Work,
|
|
106
|
+
excluding those notices that do not pertain to any part of
|
|
107
|
+
the Derivative Works; and
|
|
108
|
+
|
|
109
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
110
|
+
distribution, then any Derivative Works that You distribute must
|
|
111
|
+
include a readable copy of the attribution notices contained
|
|
112
|
+
within such NOTICE file, excluding those notices that do not
|
|
113
|
+
pertain to any part of the Derivative Works, in at least one
|
|
114
|
+
of the following places: within a NOTICE text file distributed
|
|
115
|
+
as part of the Derivative Works; within the Source form or
|
|
116
|
+
documentation, if provided along with the Derivative Works; or,
|
|
117
|
+
within a display generated by the Derivative Works, if and
|
|
118
|
+
wherever such third-party notices normally appear. The contents
|
|
119
|
+
of the NOTICE file are for informational purposes only and
|
|
120
|
+
do not modify the License. You may add Your own attribution
|
|
121
|
+
notices within Derivative Works that You distribute, alongside
|
|
122
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
123
|
+
that such additional attribution notices cannot be construed
|
|
124
|
+
as modifying the License.
|
|
125
|
+
|
|
126
|
+
You may add Your own copyright notice to Your modifications and
|
|
127
|
+
may provide additional or different license terms and conditions
|
|
128
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
129
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
130
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
131
|
+
the conditions stated in this License.
|
|
132
|
+
|
|
133
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
134
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
135
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
136
|
+
this License, without any additional terms or conditions.
|
|
137
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
138
|
+
the terms of any separate license agreement you may have executed
|
|
139
|
+
with Licensor regarding such Contributions.
|
|
140
|
+
|
|
141
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
142
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
143
|
+
except as required for reasonable and customary use in describing the
|
|
144
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
145
|
+
|
|
146
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
147
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
148
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
149
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
150
|
+
implied, including, without limitation, any warranties or conditions
|
|
151
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
152
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
153
|
+
appropriateness of using or redistributing the Work and assume any
|
|
154
|
+
risks associated with Your exercise of permissions under this License.
|
|
155
|
+
|
|
156
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
157
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
158
|
+
unless required by applicable law (such as deliberate and grossly
|
|
159
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
160
|
+
liable to You for damages, including any direct, indirect, special,
|
|
161
|
+
incidental, or consequential damages of any character arising as a
|
|
162
|
+
result of this License or out of the use or inability to use the
|
|
163
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
164
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
165
|
+
other commercial damages or losses), even if such Contributor
|
|
166
|
+
has been advised of the possibility of such damages.
|
|
167
|
+
|
|
168
|
+
9. Accepting Warranty or Additional Liability. When redistributing
|
|
169
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
170
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
171
|
+
or other liability obligations and/or rights consistent with this
|
|
172
|
+
License. However, in accepting such obligations, You may act only
|
|
173
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
174
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
175
|
+
defend, and hold each Contributor harmless for any liability
|
|
176
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
177
|
+
of your accepting any such warranty or additional liability.
|
|
178
|
+
|
|
179
|
+
END OF TERMS AND CONDITIONS
|
|
180
|
+
|
|
181
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
182
|
+
|
|
183
|
+
To apply the Apache License to your work, attach the following
|
|
184
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
185
|
+
replaced with your own identifying information. (Don't include
|
|
186
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
187
|
+
comment syntax for the file format. We also recommend that a
|
|
188
|
+
file or class name and description of purpose be included on the
|
|
189
|
+
same page as the copyright notice for easier identification within
|
|
190
|
+
third-party archives.
|
|
191
|
+
|
|
192
|
+
Copyright 2025 Ably Realtime Limited
|
|
193
|
+
|
|
194
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
195
|
+
you may not use this file except in compliance with the License.
|
|
196
|
+
You may obtain a copy of the License at
|
|
197
|
+
|
|
198
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
199
|
+
|
|
200
|
+
Unless required by applicable law or agreed to in writing, software
|
|
201
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
202
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
203
|
+
See the License for the specific language governing permissions and
|
|
204
|
+
limitations under the License.
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: vcdiff-decoder
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Python implementation of VCDIFF (RFC 3284) delta compression format
|
|
5
|
+
Home-page: https://ably.com
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Author: Ably
|
|
8
|
+
Author-email: support@ably.com
|
|
9
|
+
Requires-Python: >=3.7,<4.0
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Project-URL: Repository, https://github.com/ably/ably-python
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# VCDIFF Python Decoder
|
|
27
|
+
|
|
28
|
+
A Python implementation of a VCDIFF (RFC 3284) decoder library and command-line tool for efficient binary differencing and compression.
|
|
29
|
+
|
|
30
|
+
## Overview
|
|
31
|
+
|
|
32
|
+
The library provides a VCDIFF decoder that can decode delta files created according to RFC 3284 - The VCDIFF Generic Differencing and Compression Data Format. VCDIFF is a format for expressing one data stream as a variant of another data stream, commonly used for binary differencing, compression, and patch applications.
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- **Python Library**: RFC 3284 compliant VCDIFF decoding with clean, Pythonic API
|
|
37
|
+
- **Command-Line Tool**: Apply deltas and inspect VCDIFF file structure
|
|
38
|
+
- **Comprehensive Validation**: Support for all VCDIFF instruction types (ADD, COPY, RUN)
|
|
39
|
+
- **Address Caching**: Efficient decoding with proper address cache implementation
|
|
40
|
+
- **Checksum Validation**: Full Adler-32 checksum validation support
|
|
41
|
+
- **Robust Error Handling**: Detailed error messages for debugging malformed files
|
|
42
|
+
- **Extensive Testing**: 85 test cases with reference implementation validation
|
|
43
|
+
- **Type Safety**: Full type hints for better development experience
|
|
44
|
+
|
|
45
|
+
## Limitations
|
|
46
|
+
|
|
47
|
+
- **Application Headers**: This implementation does not handle application header information
|
|
48
|
+
- **Secondary Compression**: This decoder does not support secondary compression (e.g., gzip, bzip2)
|
|
49
|
+
- **Compatibility**: Works with VCDIFF deltas created using `xdelta3 -e -S -A` (no secondary compression, no application header)
|
|
50
|
+
|
|
51
|
+
## Checksum Support
|
|
52
|
+
|
|
53
|
+
- **VCD_ADLER32**: This implementation detects and parses the VCD_ADLER32 extension (bit 0x04 in window indicator)
|
|
54
|
+
- **Non-standard Extension**: The Adler-32 checksum is not part of RFC 3284 but is supported by some implementations
|
|
55
|
+
- **Validation**: Full Adler-32 checksum validation is implemented and performed during decoding
|
|
56
|
+
- **Display**: Checksums are displayed in the CLI output as `Adler32: 0x########`
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install vcdiff
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Development Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
poetry install
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Cloning with Test Suite
|
|
71
|
+
|
|
72
|
+
This repository includes the VCDIFF test suite as a git submodule. To clone the repository with all test cases:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone --recursive https://github.com/ably/vcdiff-py.git
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If you've already cloned the repository without the submodule, initialize it:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git submodule update --init --recursive
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
To update the test suite submodule to the latest version:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git submodule update --remote
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Quick Start
|
|
91
|
+
|
|
92
|
+
### Library Usage
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
import vcdiff
|
|
96
|
+
|
|
97
|
+
# Read the source file
|
|
98
|
+
with open("original.txt", "rb") as f:
|
|
99
|
+
source = f.read()
|
|
100
|
+
|
|
101
|
+
# Read the VCDIFF delta file
|
|
102
|
+
with open("changes.vcdiff", "rb") as f:
|
|
103
|
+
delta_data = f.read()
|
|
104
|
+
|
|
105
|
+
# Apply the delta to reconstruct the target
|
|
106
|
+
try:
|
|
107
|
+
result = vcdiff.decode(source, delta_data)
|
|
108
|
+
print(f"Decoded result: {result}")
|
|
109
|
+
except vcdiff.VCDIFFError as e:
|
|
110
|
+
print(f"Decoding failed: {e}")
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## API Reference
|
|
114
|
+
|
|
115
|
+
### Core Functions
|
|
116
|
+
|
|
117
|
+
#### `vcdiff.decode(source: bytes, delta: bytes) -> bytes`
|
|
118
|
+
|
|
119
|
+
Decodes a VCDIFF delta file using the provided source data and returns the reconstructed target data.
|
|
120
|
+
|
|
121
|
+
**Parameters:**
|
|
122
|
+
- `source`: The original source data (may be empty for deltas that don't reference source)
|
|
123
|
+
- `delta`: The VCDIFF delta file data
|
|
124
|
+
|
|
125
|
+
**Returns:**
|
|
126
|
+
- Decoded target data as bytes
|
|
127
|
+
|
|
128
|
+
**Raises:**
|
|
129
|
+
- `VCDIFFError`: If decoding fails (malformed delta, checksum validation failure, etc.)
|
|
130
|
+
|
|
131
|
+
#### `vcdiff.Decoder(source: bytes)`
|
|
132
|
+
|
|
133
|
+
Creates a new decoder instance with the specified source data. Useful for decoding multiple deltas against the same source.
|
|
134
|
+
|
|
135
|
+
**Parameters:**
|
|
136
|
+
- `source`: The source data for decoding operations
|
|
137
|
+
|
|
138
|
+
**Returns:**
|
|
139
|
+
- A `Decoder` instance that can be used to decode multiple deltas
|
|
140
|
+
|
|
141
|
+
#### `decoder.decode(delta: bytes) -> bytes`
|
|
142
|
+
|
|
143
|
+
Decodes a single VCDIFF delta using the decoder's source data.
|
|
144
|
+
|
|
145
|
+
### Error Handling
|
|
146
|
+
|
|
147
|
+
The decoder provides detailed error messages for various failure conditions:
|
|
148
|
+
- Invalid VCDIFF format or magic bytes
|
|
149
|
+
- Malformed varint encoding
|
|
150
|
+
- Out-of-bounds memory access attempts
|
|
151
|
+
- Checksum validation failures
|
|
152
|
+
- Truncated or corrupted delta files
|
|
153
|
+
|
|
154
|
+
**Exception Hierarchy:**
|
|
155
|
+
- `VCDIFFError`: Base exception for all VCDIFF-related errors
|
|
156
|
+
- `InvalidMagicError`: Invalid VCDIFF magic bytes
|
|
157
|
+
- `InvalidVersionError`: Unsupported VCDIFF version
|
|
158
|
+
- `InvalidFormatError`: Malformed delta structure
|
|
159
|
+
- `CorruptedDataError`: Data corruption detected
|
|
160
|
+
- `InvalidChecksumError`: Checksum validation failure
|
|
161
|
+
|
|
162
|
+
## Testing
|
|
163
|
+
|
|
164
|
+
### Prerequisites
|
|
165
|
+
|
|
166
|
+
For comprehensive testing, this project uses xdelta3 as a reference implementation to verify the correctness of the decoder.
|
|
167
|
+
|
|
168
|
+
#### Installing xdelta3
|
|
169
|
+
|
|
170
|
+
##### macOS (Homebrew)
|
|
171
|
+
```bash
|
|
172
|
+
brew install xdelta
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
##### Linux (Ubuntu/Debian)
|
|
176
|
+
```bash
|
|
177
|
+
sudo apt-get install xdelta3
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Running Tests
|
|
181
|
+
|
|
182
|
+
To run the Python unit tests:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
poetry run pytest
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
To run tests with coverage:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
poetry run pytest --cov=vcdiff tests/
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
To run the comprehensive test suite against the VCDIFF test cases (requires submodule):
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
poetry run pytest tests/test_vcdiff.py -v
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
The test suite includes:
|
|
201
|
+
- **20 general positive tests**: Valid VCDIFF files that should decode successfully
|
|
202
|
+
- **33 targeted negative tests**: Invalid VCDIFF files that should be rejected with appropriate errors
|
|
203
|
+
- **32 targeted positive tests**: Specific feature validation tests
|
|
204
|
+
- **Total**: 85 test cases with 100% pass rate
|
|
205
|
+
|
|
206
|
+
### Test Results
|
|
207
|
+
- **General Positive Tests**: 20/20 passed ✅
|
|
208
|
+
- **Targeted Negative Tests**: 33/33 passed ✅
|
|
209
|
+
- **Targeted Positive Tests**: 32/32 passed ✅
|
|
210
|
+
|
|
211
|
+
## Contributing
|
|
212
|
+
|
|
213
|
+
Contributions are welcomed. Please follow these guidelines:
|
|
214
|
+
|
|
215
|
+
### Getting Started
|
|
216
|
+
|
|
217
|
+
1. Fork the repository
|
|
218
|
+
2. Clone your fork with submodules: `git clone --recursive <your-fork-url>`
|
|
219
|
+
3. Create a feature branch: `git checkout -b feature/your-feature-name`
|
|
220
|
+
4. Make your changes
|
|
221
|
+
5. Test your changes thoroughly
|
|
222
|
+
6. Submit a pull request
|
|
223
|
+
|
|
224
|
+
### Development Guidelines
|
|
225
|
+
|
|
226
|
+
- **Code Style**: Follow PEP 8 formatting (`black .` for automatic formatting)
|
|
227
|
+
- **Type Hints**: All new code should include proper type annotations
|
|
228
|
+
- **Testing**: All new features must include tests
|
|
229
|
+
- **Documentation**: Update documentation for any API changes
|
|
230
|
+
- **Commits**: Use clear, descriptive commit messages
|
|
231
|
+
|
|
232
|
+
### Before Submitting
|
|
233
|
+
|
|
234
|
+
Ensure your contribution passes all checks:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Run all tests
|
|
238
|
+
pytest
|
|
239
|
+
|
|
240
|
+
# Format code
|
|
241
|
+
black .
|
|
242
|
+
|
|
243
|
+
# Lint code
|
|
244
|
+
flake8 vcdiff/
|
|
245
|
+
|
|
246
|
+
# Type checking
|
|
247
|
+
mypy vcdiff/
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Reporting Issues
|
|
251
|
+
|
|
252
|
+
When reporting bugs, please include:
|
|
253
|
+
- Python version
|
|
254
|
+
- Operating system
|
|
255
|
+
- Minimal reproduction case
|
|
256
|
+
- Expected vs actual behavior
|
|
257
|
+
- Sample VCDIFF files (if applicable)
|
|
258
|
+
|
|
259
|
+
### Feature Requests
|
|
260
|
+
|
|
261
|
+
For new features, please:
|
|
262
|
+
- Check existing issues first
|
|
263
|
+
- Describe the use case
|
|
264
|
+
- Provide RFC 3284 references if applicable
|
|
265
|
+
- Consider backwards compatibility
|
|
266
|
+
|
|
267
|
+
## Requirements
|
|
268
|
+
|
|
269
|
+
- **Python**: 3.8 or higher
|
|
270
|
+
- **Development Dependencies**:
|
|
271
|
+
- `pytest>=7.0.0`
|
|
272
|
+
- `pytest-cov>=4.0.0`
|
|
273
|
+
- `black>=22.0.0`
|
|
274
|
+
- `flake8>=5.0.0`
|
|
275
|
+
- `mypy>=1.0.0`
|
|
276
|
+
|
|
277
|
+
## License
|
|
278
|
+
|
|
279
|
+
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
|
|
280
|
+
|
|
281
|
+
## References
|
|
282
|
+
|
|
283
|
+
- [RFC 3284: The VCDIFF Generic Differencing and Compression Data Format](https://tools.ietf.org/html/rfc3284)
|
|
284
|
+
- [xdelta3: VCDIFF binary diff tool](https://github.com/jmacd/xdelta)
|
|
285
|
+
- [Go VCDIFF Implementation](https://github.com/ably/vcdiff-go) - Algorithmically compatible sibling project
|