knurl 0.1.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 (39) hide show
  1. knurl-0.1.0/.github/workflows/ci.yml +32 -0
  2. knurl-0.1.0/.github/workflows/publish.yml +51 -0
  3. knurl-0.1.0/.gitignore +27 -0
  4. knurl-0.1.0/FOSS_BURNDOWN.md +407 -0
  5. knurl-0.1.0/LICENSE +21 -0
  6. knurl-0.1.0/PKG-INFO +76 -0
  7. knurl-0.1.0/README.md +47 -0
  8. knurl-0.1.0/knurl/__init__.py +22 -0
  9. knurl-0.1.0/knurl/address.py +365 -0
  10. knurl-0.1.0/knurl/canon.py +164 -0
  11. knurl-0.1.0/knurl/chain.py +191 -0
  12. knurl-0.1.0/knurl/diff.py +292 -0
  13. knurl-0.1.0/knurl/diverge.py +186 -0
  14. knurl-0.1.0/knurl/hash.py +174 -0
  15. knurl-0.1.0/knurl/yield_.py +152 -0
  16. knurl-0.1.0/pyproject.toml +43 -0
  17. knurl-0.1.0/tests/__init__.py +0 -0
  18. knurl-0.1.0/tests/test_address.py +620 -0
  19. knurl-0.1.0/tests/test_canon.py +884 -0
  20. knurl-0.1.0/tests/test_chain.py +775 -0
  21. knurl-0.1.0/tests/test_chain_fingerprint_attacks.py +430 -0
  22. knurl-0.1.0/tests/test_diff.py +1522 -0
  23. knurl-0.1.0/tests/test_diff_breaks.py +321 -0
  24. knurl-0.1.0/tests/test_diff_crashes.py +611 -0
  25. knurl-0.1.0/tests/test_diff_exploits.py +614 -0
  26. knurl-0.1.0/tests/test_diff_oracle_gaps.py +161 -0
  27. knurl-0.1.0/tests/test_diverge.py +399 -0
  28. knurl-0.1.0/tests/test_diverge_gremlin.py +407 -0
  29. knurl-0.1.0/tests/test_diverge_oracle.py +334 -0
  30. knurl-0.1.0/tests/test_gremlin_attacks.py +183 -0
  31. knurl-0.1.0/tests/test_hash.py +464 -0
  32. knurl-0.1.0/tests/test_hash_comprehensive.py +655 -0
  33. knurl-0.1.0/tests/test_hash_oracle_additions.py +311 -0
  34. knurl-0.1.0/tests/test_yield.py +761 -0
  35. knurl-0.1.0/tests/test_yield_chaos.py +326 -0
  36. knurl-0.1.0/tests/test_yield_chaos_advanced.py +378 -0
  37. knurl-0.1.0/tests/test_yield_round2_bugs.py +190 -0
  38. knurl-0.1.0/tests/test_yield_round3_crashes.py +98 -0
  39. knurl-0.1.0/tests/test_yield_validation_gaps.py +184 -0
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ branches: [main, master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python-version: ["3.10", "3.11", "3.12"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install -e ".[dev]"
29
+
30
+ - name: Run tests
31
+ run: |
32
+ pytest tests/ -v
@@ -0,0 +1,51 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ id-token: write
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.12"
22
+
23
+ - name: Install build dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install build
27
+
28
+ - name: Build package
29
+ run: python -m build
30
+
31
+ - name: Upload build artifacts
32
+ uses: actions/upload-artifact@v4
33
+ with:
34
+ name: dist
35
+ path: dist/
36
+
37
+ publish:
38
+ needs: build
39
+ runs-on: ubuntu-latest
40
+ environment:
41
+ name: pypi
42
+ url: https://pypi.org/p/knurl
43
+ steps:
44
+ - name: Download build artifacts
45
+ uses: actions/download-artifact@v4
46
+ with:
47
+ name: dist
48
+ path: dist/
49
+
50
+ - name: Publish to PyPI
51
+ uses: pypa/gh-action-pypi-publish@release/v1
knurl-0.1.0/.gitignore ADDED
@@ -0,0 +1,27 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.so
5
+ .Python
6
+ build/
7
+ develop-eggs/
8
+ dist/
9
+ downloads/
10
+ eggs/
11
+ .eggs/
12
+ lib/
13
+ lib64/
14
+ parts/
15
+ sdist/
16
+ var/
17
+ wheels/
18
+ *.egg-info/
19
+ .installed.cfg
20
+ *.egg
21
+ .hypothesis/
22
+ .pytest_cache/
23
+ *.pyc
24
+
25
+ # Local development
26
+ .claude/
27
+ .skein/
@@ -0,0 +1,407 @@
1
+ # FOSS Burndown Brief: Publishing knurl to PyPI
2
+
3
+ **Goal**: Publish knurl as a FOSS package on PyPI for use as a shuttle dependency and general public consumption.
4
+
5
+ **Package Name**: `knurl` (VERIFIED AVAILABLE on PyPI - no existing package found)
6
+
7
+ **Current Status**: Private codebase, production-ready code, excellent test coverage (930 tests), no CI/CD
8
+
9
+ ---
10
+
11
+ ## Executive Summary
12
+
13
+ knurl is a rock-solid primitives library providing:
14
+ - Content-addressable hashing (SHA256)
15
+ - Chain fingerprinting (Merkle-like)
16
+ - Divergence detection
17
+ - JSON diffing (RFC 6902)
18
+ - Canonical JSON serialization (RFC 8785)
19
+ - SKEIN address parsing
20
+ - Yield data serialization
21
+
22
+ **Codebase Stats**:
23
+ - Source: ~1,546 lines across 8 modules
24
+ - Tests: ~10,628 lines across 30 test files
25
+ - Test count: 930 tests (comprehensive, includes property-based tests with Hypothesis)
26
+ - Dependencies: stdlib-only core + optional `jsonpatch` for diff module
27
+ - License declared: MIT (in pyproject.toml)
28
+ - Python: 3.10+ required
29
+
30
+ **Quality indicators**:
31
+ - Extensive test suite with gremlin, oracle, chaos testing
32
+ - Property-based tests (Hypothesis)
33
+ - Attack/exploit tests for security hardening
34
+ - Comprehensive edge case coverage
35
+ - Clean module structure with clear separation of concerns
36
+
37
+ ---
38
+
39
+ ## FOSS Blockers Assessment
40
+
41
+ ### 🟢 No Critical Blockers Found
42
+
43
+ **Private info search results**:
44
+ - ✅ No hardcoded credentials, tokens, or secrets
45
+ - ✅ No absolute paths (except test examples using "@patrick/speakbot" as EXAMPLE DATA only)
46
+ - ⚠️ "patrick" and "speakbot" appear in docstrings and tests as example usernames/projects
47
+ - This is SAFE - they're generic examples for the SKEIN address format
48
+ - Equivalent to using "alice@example.com" in email examples
49
+ - No actual personal information leaked
50
+
51
+ **Dependency audit**:
52
+ - ✅ Core modules: stdlib-only (no external deps)
53
+ - ✅ Optional: `jsonpatch>=1.32` (MIT licensed, widely used)
54
+ - ✅ Dev deps: pytest, hypothesis (standard testing tools)
55
+
56
+ **License compliance**:
57
+ - ✅ MIT license declared in pyproject.toml
58
+ - ❌ Missing LICENSE file (needs to be created)
59
+ - ✅ No license conflicts with dependencies
60
+
61
+ ---
62
+
63
+ ## Burndown Tasks
64
+
65
+ ### Phase 1: Legal & Licensing (CRITICAL PATH)
66
+
67
+ **[ ] Task 1.1: Create LICENSE file**
68
+ - Create `/home/patrick/projects/spiritengine/knurl/LICENSE`
69
+ - Use standard MIT license text
70
+ - Copyright holder: Decide on "Patrick <lastname>" vs "SpiritEngine Contributors" vs company name
71
+ - This is BLOCKING - PyPI best practices require LICENSE file
72
+
73
+ **[ ] Task 1.2: Add copyright headers (OPTIONAL but recommended)**
74
+ - Decision needed: Add SPDX headers to source files?
75
+ - Standard format: `# SPDX-License-Identifier: MIT` at top of each .py file
76
+ - Can be done post-launch if desired
77
+
78
+ **[ ] Task 1.3: Review README for private references**
79
+ - Current README uses "SpiritEngine" as header
80
+ - Decision: Keep "knurl" branding or mention SpiritEngine as origin?
81
+ - Recommendation: Use "knurl" as primary, note "Extracted from SpiritEngine" in description
82
+
83
+ ### Phase 2: Package Metadata & Branding
84
+
85
+ **[ ] Task 2.1: Update pyproject.toml metadata**
86
+ Current gaps:
87
+ - Missing `authors` field (required for good PyPI presence)
88
+ - Missing `keywords` field (helps discoverability)
89
+ - Missing `classifiers` (Python versions, dev status, license)
90
+ - Missing `repository` URL (link to GitHub/GitLab if applicable)
91
+ - Missing `documentation` URL (if applicable)
92
+ - Missing `homepage` URL (can be same as repository)
93
+
94
+ Example additions needed:
95
+ ```toml
96
+ [project]
97
+ authors = [
98
+ {name = "Your Name", email = "your.email@example.com"}
99
+ ]
100
+ keywords = ["hashing", "fingerprinting", "merkle", "content-addressable", "json-patch", "diffing"]
101
+ classifiers = [
102
+ "Development Status :: 4 - Beta", # or "5 - Production/Stable"
103
+ "Intended Audience :: Developers",
104
+ "License :: OSI Approved :: MIT License",
105
+ "Programming Language :: Python :: 3",
106
+ "Programming Language :: Python :: 3.10",
107
+ "Programming Language :: Python :: 3.11",
108
+ "Programming Language :: Python :: 3.12",
109
+ "Topic :: Software Development :: Libraries :: Python Modules",
110
+ "Topic :: Security :: Cryptography",
111
+ ]
112
+
113
+ [project.urls]
114
+ Homepage = "https://github.com/yourorg/knurl" # UPDATE THIS
115
+ Repository = "https://github.com/yourorg/knurl" # UPDATE THIS
116
+ Issues = "https://github.com/yourorg/knurl/issues" # UPDATE THIS
117
+ ```
118
+
119
+ **[ ] Task 2.2: Update README for public audience**
120
+ Current README is minimal. Consider adding:
121
+ - Installation instructions (already present - GOOD)
122
+ - More detailed usage examples
123
+ - API reference or link to docs
124
+ - Contributing guidelines (if accepting contributions)
125
+ - Link to issues/bug reports
126
+ - Badges (build status, PyPI version, license - add after CI setup)
127
+
128
+ **[ ] Task 2.3: Decide on repository URL**
129
+ Options:
130
+ 1. Create new `knurl` repo under personal GitHub
131
+ 2. Create under organization account
132
+ 3. Keep in spiritengine repo as subdirectory
133
+ 4. No public repo (PyPI only) - NOT RECOMMENDED
134
+
135
+ Decision impacts: metadata URLs, contribution workflow, issue tracking
136
+
137
+ **[ ] Task 2.4: Rename from "spiritengine" to "knurl" internally**
138
+ - ✅ Package name already "knurl" in pyproject.toml
139
+ - ✅ Import path already `knurl.*`
140
+ - ⚠️ README header says "# SpiritEngine" - should be "# knurl"
141
+ - ⚠️ .skein/config.json has `project_id: "spiritengine"` - KEEP (internal only, not published)
142
+
143
+ Update needed:
144
+ ```markdown
145
+ # knurl
146
+
147
+ Rock-solid primitives for content-addressable hashing, chain fingerprinting, and config diffing.
148
+
149
+ Extracted from the SpiritEngine project.
150
+ ```
151
+
152
+ ### Phase 3: CI/CD & Automation
153
+
154
+ **[ ] Task 3.1: Create GitHub Actions workflow (if using GitHub)**
155
+ Create `.github/workflows/test.yml`:
156
+ - Run tests on Python 3.10, 3.11, 3.12
157
+ - Run on ubuntu-latest (Linux), macos-latest, windows-latest
158
+ - Test both with and without optional jsonpatch dependency
159
+ - Upload coverage reports
160
+
161
+ **[ ] Task 3.2: Create GitHub Actions workflow for PyPI publishing**
162
+ Create `.github/workflows/publish.yml`:
163
+ - Trigger on git tags (e.g., `v0.1.0`)
164
+ - Build wheel and sdist
165
+ - Publish to PyPI using trusted publisher (no API tokens needed)
166
+ - Optional: publish to TestPyPI first for validation
167
+
168
+ **[ ] Task 3.3: Set up PyPI trusted publisher**
169
+ - Create PyPI account if needed
170
+ - Configure GitHub Actions as trusted publisher (no API tokens!)
171
+ - See: https://docs.pypi.org/trusted-publishers/
172
+
173
+ **[ ] Task 3.4: Add pre-commit hooks (OPTIONAL)**
174
+ - black (code formatting)
175
+ - isort (import sorting)
176
+ - flake8 or ruff (linting)
177
+ - mypy (type checking) - if adding type hints
178
+
179
+ ### Phase 4: Documentation
180
+
181
+ **[ ] Task 4.1: Add CHANGELOG.md**
182
+ - Start with 0.1.0 release notes
183
+ - Document public API surface
184
+ - Note any breaking changes vs internal SpiritEngine version
185
+
186
+ **[ ] Task 4.2: Add CONTRIBUTING.md (if accepting contributions)**
187
+ - How to set up dev environment
188
+ - How to run tests
189
+ - Code style guidelines
190
+ - How to submit PRs
191
+
192
+ **[ ] Task 4.3: Improve docstrings (ALREADY EXCELLENT)**
193
+ - Current docstrings are comprehensive ✅
194
+ - Consider adding type hints to match docstrings
195
+ - Consider generating API docs with Sphinx (OPTIONAL)
196
+
197
+ **[ ] Task 4.4: Create GitHub/GitLab Issues templates**
198
+ - Bug report template
199
+ - Feature request template
200
+
201
+ ### Phase 5: Code Quality & Polish
202
+
203
+ **[ ] Task 5.1: Add type hints (OPTIONAL but recommended)**
204
+ - Code already has some type hints in function signatures
205
+ - Could add full PEP 484 type hints for better IDE support
206
+ - Run mypy to validate
207
+
208
+ **[ ] Task 5.2: Add py.typed marker (if adding type hints)**
209
+ - Create empty `knurl/py.typed` file
210
+ - Enables type checkers to use your package's hints
211
+
212
+ **[ ] Task 5.3: Security audit**
213
+ - Review hash.py for timing attack resistance ✅ (already uses hmac.compare_digest)
214
+ - Review address.py for injection attacks ✅ (already has length limits, validation)
215
+ - Review diff.py for patch conflicts ✅ (already has comprehensive error handling)
216
+ - No obvious security issues found
217
+
218
+ **[ ] Task 5.4: Performance audit (OPTIONAL)**
219
+ - Benchmark canon.serialize for large objects
220
+ - Benchmark chain.fingerprint for long chains
221
+ - Document performance characteristics if relevant
222
+
223
+ ### Phase 6: Testing & Validation
224
+
225
+ **[ ] Task 6.1: Test package build locally**
226
+ ```bash
227
+ python -m build
228
+ # Check dist/ for wheel and sdist
229
+ ```
230
+
231
+ **[ ] Task 6.2: Test installation from built package**
232
+ ```bash
233
+ python -m pip install dist/knurl-0.1.0-py3-none-any.whl
234
+ python -c "from knurl import hash; print(hash.compute('test'))"
235
+ ```
236
+
237
+ **[ ] Task 6.3: Publish to TestPyPI first**
238
+ ```bash
239
+ python -m twine upload --repository testpypi dist/*
240
+ pip install --index-url https://test.pypi.org/simple/ knurl
241
+ ```
242
+
243
+ **[ ] Task 6.4: Smoke test installation from TestPyPI**
244
+ - Create fresh virtualenv
245
+ - Install from TestPyPI
246
+ - Run basic imports and function calls
247
+ - Verify optional dependencies work
248
+
249
+ **[ ] Task 6.5: Run full test suite on Python 3.10, 3.11, 3.12**
250
+ ```bash
251
+ # Already works locally with Python 3.12
252
+ # Test on 3.10 and 3.11 if available, or use CI
253
+ ```
254
+
255
+ ### Phase 7: Release & Publishing
256
+
257
+ **[ ] Task 7.1: Version number decision**
258
+ - Current: 0.1.0
259
+ - Recommendation: Start with 0.1.0 (indicates beta/pre-stable)
260
+ - Or use 1.0.0 if confident in API stability
261
+ - Shuttle dependency: ensure version pin is appropriate
262
+
263
+ **[ ] Task 7.2: Tag release in git**
264
+ ```bash
265
+ git tag -a v0.1.0 -m "Initial public release"
266
+ git push origin v0.1.0
267
+ ```
268
+
269
+ **[ ] Task 7.3: Publish to PyPI**
270
+ - Via GitHub Actions (if set up)
271
+ - Or manually: `python -m twine upload dist/*`
272
+
273
+ **[ ] Task 7.4: Verify PyPI listing**
274
+ - Check package page: https://pypi.org/project/knurl/
275
+ - Verify README renders correctly
276
+ - Verify metadata (author, license, links)
277
+ - Test installation: `pip install knurl`
278
+
279
+ **[ ] Task 7.5: Update shuttle to use PyPI knurl**
280
+ - Update shuttle's dependencies to `knurl>=0.1.0`
281
+ - Remove any local path references
282
+ - Test shuttle with PyPI knurl
283
+
284
+ ### Phase 8: Post-Launch
285
+
286
+ **[ ] Task 8.1: Add PyPI badge to README**
287
+ ```markdown
288
+ [![PyPI version](https://badge.fury.io/py/knurl.svg)](https://badge.fury.io/py/knurl)
289
+ ```
290
+
291
+ **[ ] Task 8.2: Announce release**
292
+ - Where? (internal team, mailing lists, social media, etc.)
293
+ - Include link to PyPI page and repository
294
+
295
+ **[ ] Task 8.3: Monitor for issues**
296
+ - Set up GitHub issue notifications
297
+ - Monitor PyPI download stats (if interested)
298
+
299
+ **[ ] Task 8.4: Plan maintenance strategy**
300
+ - Who maintains the package?
301
+ - How are issues triaged?
302
+ - Release cadence?
303
+
304
+ ---
305
+
306
+ ## Risk Assessment
307
+
308
+ ### Low Risk
309
+ - ✅ Package name available on PyPI
310
+ - ✅ No dependency conflicts
311
+ - ✅ Excellent test coverage
312
+ - ✅ Clean code structure
313
+ - ✅ No private data in code
314
+
315
+ ### Medium Risk
316
+ - ⚠️ First public release - expect early user feedback/issues
317
+ - ⚠️ No CI yet - need to set up before wide usage
318
+ - ⚠️ Docstrings use internal examples (speakbot, patrick) - minor clarity issue
319
+
320
+ ### Mitigations Needed
321
+ - Set up CI before official v1.0.0 release
322
+ - Consider starting with 0.x version to signal pre-stable
323
+ - Add clear contribution guidelines if accepting external PRs
324
+
325
+ ---
326
+
327
+ ## Open Questions / Decisions Needed
328
+
329
+ 1. **License copyright holder**: Personal name vs organization?
330
+ 2. **Repository location**: New repo or within spiritengine?
331
+ 3. **Public repository**: GitHub, GitLab, or just PyPI?
332
+ 4. **API stability**: Release as 0.1.0 (beta) or 1.0.0 (stable)?
333
+ 5. **Maintenance model**: Solo maintainer or team?
334
+ 6. **Contribution policy**: Accept external contributions or closed development?
335
+ 7. **Documentation hosting**: ReadTheDocs, GitHub Pages, or just README?
336
+ 8. **Type hints**: Add full type annotations before release?
337
+ 9. **SKEIN address module**: This is very SpiritEngine-specific - keep it or make it optional?
338
+ - Current: address module is in core exports
339
+ - Option A: Keep it (it's generic enough)
340
+ - Option B: Make it optional import
341
+ - Option C: Move to separate `knurl-skein` package
342
+
343
+ ---
344
+
345
+ ## Estimated Timeline
346
+
347
+ **Minimal viable FOSS release (0.1.0 beta)**:
348
+ - Phase 1 (Legal): 1 hour
349
+ - Phase 2 (Metadata): 2 hours
350
+ - Phase 6 (Testing): 1 hour
351
+ - Phase 7 (Release): 1 hour
352
+ - **Total: 5 hours (can be done in one session)**
353
+
354
+ **Full production release (1.0.0 with CI/CD)**:
355
+ - Add Phase 3 (CI/CD): 4 hours
356
+ - Add Phase 4 (Docs): 3 hours
357
+ - Add Phase 5 (Polish): 4 hours
358
+ - **Total: 16 hours (across 2-3 sessions)**
359
+
360
+ ---
361
+
362
+ ## Success Criteria
363
+
364
+ - [x] Package builds without errors
365
+ - [ ] Package installs from PyPI
366
+ - [ ] All 930 tests pass on Python 3.10, 3.11, 3.12
367
+ - [ ] shuttle can depend on PyPI knurl
368
+ - [ ] LICENSE file exists with correct copyright
369
+ - [ ] README accurately describes public API
370
+ - [ ] No private/internal references in published code
371
+ - [ ] CI runs on all commits (for v1.0.0)
372
+
373
+ ---
374
+
375
+ ## Notes
376
+
377
+ **SKEIN address module consideration**:
378
+ The `address` module is tightly coupled to SKEIN (internal SpiritEngine architecture). Options:
379
+ 1. Keep it - addresses are generic enough (Layer 1/2/3 addressing)
380
+ 2. Document it clearly as "SKEIN address parsing"
381
+ 3. Split into separate package later if needed
382
+
383
+ **Recommendation**: Keep it for initial release. It's well-tested, well-documented, and self-contained. If it causes confusion, can deprecate in future version.
384
+
385
+ **Testing note**:
386
+ The test suite includes "gremlin", "oracle", and "chaos" tests - this is EXCELLENT for a cryptographic/hashing library. Shows serious attention to security and edge cases. Highlight this in README/docs.
387
+
388
+ **Hypothesis usage**:
389
+ Property-based testing with Hypothesis shows high code quality. Consider mentioning this in package description to attract quality-conscious users.
390
+
391
+ ---
392
+
393
+ ## References
394
+
395
+ - PyPI package availability: VERIFIED (no existing "knurl" package found)
396
+ - Current MIT license declaration: pyproject.toml:7
397
+ - Test count: 930 tests collected
398
+ - Source LOC: 1,546 lines
399
+ - Test LOC: 10,628 lines
400
+ - Python requirement: 3.10+ (pyproject.toml:6)
401
+
402
+ ---
403
+
404
+ **Created**: 2026-01-31
405
+ **Status**: Draft - Ready for execution
406
+ **Owner**: TBD
407
+ **Target Launch**: TBD
knurl-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Patrick Smyth
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.
knurl-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: knurl
3
+ Version: 0.1.0
4
+ Summary: Rock-solid primitives for content-addressable hashing, chain fingerprinting, and config diffing
5
+ Project-URL: Homepage, https://github.com/spiritengine/knurl
6
+ Project-URL: Repository, https://github.com/spiritengine/knurl
7
+ Project-URL: Issues, https://github.com/spiritengine/knurl/issues
8
+ Author-email: Patrick Smyth <patricksmyth01@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: content-addressable,cryptography,diffing,fingerprinting,hashing,json-patch,merkle
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Security :: Cryptography
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Provides-Extra: dev
24
+ Requires-Dist: jsonpatch>=1.32; extra == 'dev'
25
+ Requires-Dist: pytest>=7.0; extra == 'dev'
26
+ Provides-Extra: diff
27
+ Requires-Dist: jsonpatch>=1.32; extra == 'diff'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # knurl
31
+
32
+ Rock-solid primitives for content-addressable hashing, chain fingerprinting, and config diffing.
33
+
34
+ Extracted from the SpiritEngine project.
35
+
36
+ ## Modules
37
+
38
+ - **canon** - Canonical JSON serialization (RFC 8785 inspired)
39
+ - **hash** - Content-addressable hashing
40
+ - **chain** - Merkle-like chain fingerprinting
41
+ - **diverge** - Divergence detection for fingerprint chains
42
+ - **diff** - JSON Patch (RFC 6902) diffs
43
+ - **yield_** - Yield data serialization
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ pip install knurl
49
+
50
+ # With diff support (requires jsonpatch)
51
+ pip install knurl[diff]
52
+ ```
53
+
54
+ ## Usage
55
+
56
+ ```python
57
+ from knurl import canon, hash, chain, diverge
58
+
59
+ # Canonical serialization
60
+ canonical_bytes = canon.serialize({"b": 1, "a": 2}) # b'{"a":2,"b":1}'
61
+
62
+ # Content-addressable hashing
63
+ content_hash = hash.compute("hello world") # 'sha256:...'
64
+
65
+ # Chain fingerprinting
66
+ fingerprints = chain.fingerprint([config1, config2, config3])
67
+
68
+ # Divergence detection
69
+ result = diverge.find(old_fingerprints, new_fingerprints)
70
+ ```
71
+
72
+ ## Requirements
73
+
74
+ - Python 3.10+
75
+ - No dependencies (stdlib only)
76
+ - Optional: `jsonpatch` for diff module
knurl-0.1.0/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # knurl
2
+
3
+ Rock-solid primitives for content-addressable hashing, chain fingerprinting, and config diffing.
4
+
5
+ Extracted from the SpiritEngine project.
6
+
7
+ ## Modules
8
+
9
+ - **canon** - Canonical JSON serialization (RFC 8785 inspired)
10
+ - **hash** - Content-addressable hashing
11
+ - **chain** - Merkle-like chain fingerprinting
12
+ - **diverge** - Divergence detection for fingerprint chains
13
+ - **diff** - JSON Patch (RFC 6902) diffs
14
+ - **yield_** - Yield data serialization
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ pip install knurl
20
+
21
+ # With diff support (requires jsonpatch)
22
+ pip install knurl[diff]
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```python
28
+ from knurl import canon, hash, chain, diverge
29
+
30
+ # Canonical serialization
31
+ canonical_bytes = canon.serialize({"b": 1, "a": 2}) # b'{"a":2,"b":1}'
32
+
33
+ # Content-addressable hashing
34
+ content_hash = hash.compute("hello world") # 'sha256:...'
35
+
36
+ # Chain fingerprinting
37
+ fingerprints = chain.fingerprint([config1, config2, config3])
38
+
39
+ # Divergence detection
40
+ result = diverge.find(old_fingerprints, new_fingerprints)
41
+ ```
42
+
43
+ ## Requirements
44
+
45
+ - Python 3.10+
46
+ - No dependencies (stdlib only)
47
+ - Optional: `jsonpatch` for diff module
@@ -0,0 +1,22 @@
1
+ # KNURL - Content-Addressable Primitives
2
+ #
3
+ # Provides rock-solid primitives for:
4
+ # - knurl.canon: Canonical serialization
5
+ # - knurl.hash: Content-addressable hashing
6
+ # - knurl.address: SKEIN address parsing
7
+ # - knurl.yield_: Yield serialization
8
+ # - knurl.diff: Diff computation & application
9
+ # - knurl.chain: Chain fingerprinting
10
+ # - knurl.diverge: Divergence detection
11
+
12
+ from .canon import serialize, CanonError
13
+ from .hash import compute, verify, HashError
14
+ from .address import parse, construct, validate, ParsedAddress, AddressError
15
+ from .chain import fingerprint, fingerprint_step, ChainError
16
+ from . import yield_
17
+ from . import diff
18
+ from . import chain
19
+ from . import diverge
20
+ from . import address
21
+ from .diff import DiffError, PatchConflictError, InvalidPatchError, PathNotFoundError
22
+ from .diverge import DivergenceResult