rhombic 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 (62) hide show
  1. rhombic-0.1.0/.editorconfig +21 -0
  2. rhombic-0.1.0/.github/CODEOWNERS +8 -0
  3. rhombic-0.1.0/.github/FUNDING.yml +1 -0
  4. rhombic-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +37 -0
  5. rhombic-0.1.0/.github/ISSUE_TEMPLATE/config.yml +1 -0
  6. rhombic-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +22 -0
  7. rhombic-0.1.0/.github/dependabot.yml +7 -0
  8. rhombic-0.1.0/.github/pull_request_template.md +15 -0
  9. rhombic-0.1.0/.github/workflows/ci.yml +45 -0
  10. rhombic-0.1.0/.github/workflows/publish.yml +50 -0
  11. rhombic-0.1.0/.github/workflows/security.yml +28 -0
  12. rhombic-0.1.0/.gitignore +43 -0
  13. rhombic-0.1.0/.pre-commit-config.yaml +23 -0
  14. rhombic-0.1.0/CHANGELOG.md +42 -0
  15. rhombic-0.1.0/CLAUDE.md +73 -0
  16. rhombic-0.1.0/CODE_OF_CONDUCT.md +38 -0
  17. rhombic-0.1.0/CONTRIBUTING.md +48 -0
  18. rhombic-0.1.0/LICENSE +373 -0
  19. rhombic-0.1.0/PKG-INFO +205 -0
  20. rhombic-0.1.0/README.md +169 -0
  21. rhombic-0.1.0/SECURITY.md +37 -0
  22. rhombic-0.1.0/assets/banner.png +0 -0
  23. rhombic-0.1.0/data/.gitkeep +0 -0
  24. rhombic-0.1.0/docs/EXPERIMENTAL_LADDER.md +138 -0
  25. rhombic-0.1.0/docs/THESIS.md +147 -0
  26. rhombic-0.1.0/pyproject.toml +55 -0
  27. rhombic-0.1.0/results/SYNTHESIS.md +382 -0
  28. rhombic-0.1.0/results/index/INTERPRETATION.md +61 -0
  29. rhombic-0.1.0/results/index/RESULTS.md +35 -0
  30. rhombic-0.1.0/results/rung-1/INTERPRETATION.md +109 -0
  31. rhombic-0.1.0/results/rung-1/RESULTS.md +143 -0
  32. rhombic-0.1.0/results/rung-1/dashboard.png +0 -0
  33. rhombic-0.1.0/results/rung-2/INTERPRETATION.md +107 -0
  34. rhombic-0.1.0/results/rung-2/RESULTS.md +61 -0
  35. rhombic-0.1.0/results/rung-2/dashboard.png +0 -0
  36. rhombic-0.1.0/results/rung-3/INTERPRETATION.md +142 -0
  37. rhombic-0.1.0/results/rung-3/RESULTS.md +93 -0
  38. rhombic-0.1.0/results/rung-3/dashboard.png +0 -0
  39. rhombic-0.1.0/results/rung-4/INTERPRETATION.md +113 -0
  40. rhombic-0.1.0/results/rung-4/RESULTS.md +56 -0
  41. rhombic-0.1.0/results/rung-4/dashboard.png +0 -0
  42. rhombic-0.1.0/rhombic/__init__.py +12 -0
  43. rhombic-0.1.0/rhombic/benchmark.py +238 -0
  44. rhombic-0.1.0/rhombic/context.py +488 -0
  45. rhombic-0.1.0/rhombic/index.py +352 -0
  46. rhombic-0.1.0/rhombic/lattice.py +214 -0
  47. rhombic-0.1.0/rhombic/signal.py +335 -0
  48. rhombic-0.1.0/rhombic/spatial.py +367 -0
  49. rhombic-0.1.0/rhombic/visualize.py +270 -0
  50. rhombic-0.1.0/scripts/benchmark_index.py +141 -0
  51. rhombic-0.1.0/scripts/generate_banner.py +122 -0
  52. rhombic-0.1.0/scripts/generate_embeddings.py +54 -0
  53. rhombic-0.1.0/scripts/generate_rung2_dashboard.py +147 -0
  54. rhombic-0.1.0/scripts/generate_rung3_dashboard.py +154 -0
  55. rhombic-0.1.0/scripts/generate_rung4_dashboard.py +125 -0
  56. rhombic-0.1.0/tests/__init__.py +0 -0
  57. rhombic-0.1.0/tests/test_benchmark.py +52 -0
  58. rhombic-0.1.0/tests/test_context.py +170 -0
  59. rhombic-0.1.0/tests/test_index.py +204 -0
  60. rhombic-0.1.0/tests/test_lattice.py +104 -0
  61. rhombic-0.1.0/tests/test_signal.py +132 -0
  62. rhombic-0.1.0/tests/test_spatial.py +161 -0
@@ -0,0 +1,21 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ indent_style = space
7
+ indent_size = 4
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.{yml,yaml}]
12
+ indent_size = 2
13
+
14
+ [*.{json,js,ts}]
15
+ indent_size = 2
16
+
17
+ [*.md]
18
+ trim_trailing_whitespace = false
19
+
20
+ [Makefile]
21
+ indent_style = tab
@@ -0,0 +1,8 @@
1
+ # rhombic Code Owners
2
+ * @timm156
3
+
4
+ # Security-critical files
5
+ SECURITY.md @timm156
6
+ .pre-commit-config.yaml @timm156
7
+ .gitignore @timm156
8
+ .github/CODEOWNERS @timm156
@@ -0,0 +1 @@
1
+ github: [timm156]
@@ -0,0 +1,37 @@
1
+ name: Bug Report
2
+ description: Something isn't working as expected
3
+ labels: ["bug"]
4
+ body:
5
+ - type: textarea
6
+ id: description
7
+ attributes:
8
+ label: What happened?
9
+ description: Describe the bug clearly and concisely.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: expected
14
+ attributes:
15
+ label: What did you expect?
16
+ validations:
17
+ required: true
18
+ - type: textarea
19
+ id: reproduce
20
+ attributes:
21
+ label: Steps to reproduce
22
+ placeholder: |
23
+ 1. pip install rhombic
24
+ 2. python -m rhombic.benchmark
25
+ 3. ...
26
+ validations:
27
+ required: true
28
+ - type: input
29
+ id: python-version
30
+ attributes:
31
+ label: Python version
32
+ placeholder: e.g. 3.12.1
33
+ - type: input
34
+ id: os
35
+ attributes:
36
+ label: Operating system
37
+ placeholder: e.g. macOS 15.2, Windows 11, Ubuntu 24.04
@@ -0,0 +1 @@
1
+ blank_issues_enabled: true
@@ -0,0 +1,22 @@
1
+ name: Feature Request
2
+ description: Suggest a new topology, metric, or benchmark rung
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: What problem does this solve?
9
+ description: Describe the use case or research question.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: solution
14
+ attributes:
15
+ label: Proposed approach
16
+ description: How would you implement this? What topology, metric, or experiment?
17
+ validations:
18
+ required: true
19
+ - type: textarea
20
+ id: alternatives
21
+ attributes:
22
+ label: Alternatives considered
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ open-pull-requests-limit: 5
@@ -0,0 +1,15 @@
1
+ ## Summary
2
+
3
+ <!-- What does this change? -->
4
+
5
+ ## Results
6
+
7
+ <!-- If this adds or modifies benchmarks, include the numbers. -->
8
+
9
+ ## Checklist
10
+
11
+ - [ ] No secrets, API keys, tokens, or passwords
12
+ - [ ] Pre-commit hooks pass (`pre-commit run --all-files`)
13
+ - [ ] Tests pass (`pytest -v`)
14
+ - [ ] Cost reported alongside benefit (if adding benchmarks)
15
+ - [ ] Existing results still reproducible
@@ -0,0 +1,45 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ permissions:
6
+ contents: read
7
+
8
+ jobs:
9
+ test:
10
+ name: Tests (Python ${{ matrix.python-version }})
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12"]
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+
18
+ - name: Set up Python ${{ matrix.python-version }}
19
+ uses: actions/setup-python@v6
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+
23
+ - name: Install dependencies
24
+ run: pip install -e ".[all]"
25
+
26
+ - name: Run tests
27
+ run: pytest -v
28
+
29
+ benchmark:
30
+ name: Reproduce Results
31
+ runs-on: ubuntu-latest
32
+ needs: test
33
+ steps:
34
+ - uses: actions/checkout@v6
35
+
36
+ - name: Set up Python
37
+ uses: actions/setup-python@v6
38
+ with:
39
+ python-version: "3.12"
40
+
41
+ - name: Install dependencies
42
+ run: pip install -e ".[all]"
43
+
44
+ - name: Run benchmark suite
45
+ run: python -m rhombic.benchmark
@@ -0,0 +1,50 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+ id-token: write # Required for Trusted Publisher (OIDC)
10
+
11
+ jobs:
12
+ build:
13
+ name: Build distribution
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v6
20
+ with:
21
+ python-version: "3.12"
22
+
23
+ - name: Install build tools
24
+ run: pip install build
25
+
26
+ - name: Build package
27
+ run: python -m build
28
+
29
+ - name: Upload artifacts
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: dist
33
+ path: dist/
34
+
35
+ publish:
36
+ name: Publish to PyPI
37
+ runs-on: ubuntu-latest
38
+ needs: build
39
+ environment:
40
+ name: pypi
41
+ url: https://pypi.org/p/rhombic
42
+ steps:
43
+ - name: Download artifacts
44
+ uses: actions/download-artifact@v4
45
+ with:
46
+ name: dist
47
+ path: dist/
48
+
49
+ - name: Publish to PyPI
50
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,28 @@
1
+ name: Security Scan
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ gitleaks:
14
+ name: Secret Detection
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v6
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - name: Install gitleaks
22
+ run: |
23
+ curl -sSfL https://github.com/gitleaks/gitleaks/releases/download/v8.30.0/gitleaks_8.30.0_linux_x64.tar.gz -o /tmp/gitleaks.tar.gz
24
+ tar xzf /tmp/gitleaks.tar.gz -C /tmp
25
+ chmod +x /tmp/gitleaks
26
+
27
+ - name: Run gitleaks
28
+ run: /tmp/gitleaks detect --source . --verbose --redact
@@ -0,0 +1,43 @@
1
+ # --- Secrets & Credentials ---
2
+ .env
3
+ .env.*
4
+ !.env.example
5
+ *.pem
6
+ *.key
7
+ *.p12
8
+ id_rsa*
9
+ id_ed25519*
10
+ credentials.json
11
+ service-account*.json
12
+
13
+ # --- Claude Code ---
14
+ CLAUDE.local.md
15
+
16
+ # --- Python ---
17
+ __pycache__/
18
+ *.py[cod]
19
+ *$py.class
20
+ *.egg-info/
21
+ dist/
22
+ build/
23
+ *.egg
24
+ *.whl
25
+ .eggs/
26
+ venv/
27
+ .venv/
28
+ *.so
29
+
30
+ # --- Testing ---
31
+ .pytest_cache/
32
+ .coverage
33
+ htmlcov/
34
+
35
+ # --- OS & Editor ---
36
+ .DS_Store
37
+ Thumbs.db
38
+ desktop.ini
39
+ *.swp
40
+ *.swo
41
+ *~
42
+ .vscode/
43
+ .idea/
@@ -0,0 +1,23 @@
1
+ # rhombic pre-commit configuration
2
+ # Install: pip install pre-commit && pre-commit install
3
+ # Run manually: pre-commit run --all-files
4
+
5
+ repos:
6
+ # Gitleaks — secret detection
7
+ - repo: https://github.com/gitleaks/gitleaks
8
+ rev: v8.30.0
9
+ hooks:
10
+ - id: gitleaks
11
+
12
+ # Standard pre-commit hooks
13
+ - repo: https://github.com/pre-commit/pre-commit-hooks
14
+ rev: v6.0.0
15
+ hooks:
16
+ - id: check-added-large-files
17
+ args: ['--maxkb=500']
18
+ - id: check-case-conflict
19
+ - id: check-merge-conflict
20
+ - id: check-yaml
21
+ - id: detect-private-key
22
+ - id: end-of-file-fixer
23
+ - id: trailing-whitespace
@@ -0,0 +1,42 @@
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
+ ## [0.1.0] - 2026-03-04
9
+
10
+ ### Added
11
+
12
+ - **Rung 0: Lattice Library** — `CubicLattice` and `FCCLattice` classes with
13
+ matched node counts, interior degree verification, and NetworkX export
14
+ - **Rung 1: Graph Theory** — average shortest path, diameter, algebraic
15
+ connectivity, and clustering coefficient benchmarks across three scales
16
+ - **Rung 2: Spatial Operations** — flood fill, nearest-neighbor queries,
17
+ range queries, and locality-sensitive hashing benchmarks
18
+ - **Rung 3: Signal Processing** — 3D bandlimited signal reconstruction MSE
19
+ and directional isotropy analysis (Petersen-Middleton confirmation)
20
+ - **Rung 4: Context Architecture** — embedding neighbor recall, information
21
+ diffusion rate, and consensus convergence benchmarks
22
+ - **Rung 5: Synthesis** — "The Shape of the Cell" complete synthesis document
23
+ with cultural genealogy, cybernetic interpretation, and recommendations
24
+ - Visualization module with Vadrashinetal color palette
25
+ - Banner generation from library code (`scripts/generate_banner.py`)
26
+ - CI workflow (Python 3.10, 3.11, 3.12) with benchmark reproduction
27
+ - Security scanning (gitleaks)
28
+ - Full community health files (CONTRIBUTING, CODE_OF_CONDUCT, SECURITY)
29
+
30
+ ### Key Results
31
+
32
+ | Metric | FCC vs Cubic |
33
+ |--------|-------------|
34
+ | Average shortest path | 30% shorter |
35
+ | Graph diameter | 40% smaller |
36
+ | Algebraic connectivity | 2.4x higher |
37
+ | Flood fill reach | 55% more nodes |
38
+ | Signal reconstruction MSE | 5-10x lower |
39
+ | Embedding neighbor recall | +15-26pp at 1-hop |
40
+ | Edge cost | ~2x more edges |
41
+
42
+ [0.1.0]: https://github.com/promptcrafted/rhombic/releases/tag/v0.1.0
@@ -0,0 +1,73 @@
1
+ # rhombic — Project Identity
2
+
3
+ You are assisting with **rhombic**, a lattice topology benchmarking library
4
+ that compares cubic (6-connected) and FCC/rhombic dodecahedral (12-connected)
5
+ lattice topologies. Built by Promptcrafted.
6
+
7
+ ## The Thesis
8
+
9
+ The cubic lattice is the unexamined default of computation. This library
10
+ measures the alternative and publishes reproducible results showing that
11
+ the FCC lattice provides 30% shorter paths, 40% smaller diameter, and
12
+ 2.4x algebraic connectivity — at the cost of ~2x more edges.
13
+
14
+ See `docs/THESIS.md` for the full argument.
15
+ See `docs/EXPERIMENTAL_LADDER.md` for the 5-rung experimental plan.
16
+
17
+ ## Experimental Ladder
18
+
19
+ | Rung | Topic | Status |
20
+ |------|-------|--------|
21
+ | 0 | Lattice Library | Complete |
22
+ | 1 | Graph Theory Benchmarks | Complete |
23
+ | 2 | Spatial Operations | Complete |
24
+ | 3 | Signal Processing | Complete |
25
+ | 4 | Context Architecture | Complete |
26
+
27
+ ## How to Add a New Rung
28
+
29
+ 1. Create `rhombic/your_module.py` with benchmarks
30
+ 2. Add tests in `tests/test_your_module.py`
31
+ 3. Run benchmarks and save results to `results/rung-N/`
32
+ 4. Write `RESULTS.md` and `INTERPRETATION.md` in the results directory
33
+ 5. Update `README.md` with key findings
34
+ 6. Ensure `python -m rhombic.benchmark` still reproduces all results
35
+
36
+ ## How to Add a New Topology
37
+
38
+ The library compares cubic and FCC. To add another lattice topology
39
+ (BCC, HCP, diamond cubic, etc.):
40
+
41
+ 1. Add a class in `rhombic/lattice.py` following the CubicLattice/FCCLattice pattern
42
+ 2. Must implement: `__init__(n)`, `to_networkx()`, `stats()`
43
+ 3. Add to `matched_lattices()` in `benchmark.py`
44
+ 4. Add unit tests verifying node count, interior degree, and connectivity
45
+
46
+ ## Principles
47
+
48
+ - **Reproducible by default.** Every result has code that generates it.
49
+ - **The geometry is the argument.** The numbers are the evidence.
50
+ - **Cost is always reported alongside benefit.** The edge count ratio matters.
51
+ - **Sparse results are data, not failure.** If a rung shows no advantage, publish that.
52
+ - **Examine every default.** The project's thesis should inform how it's built.
53
+
54
+ ## Color Palette
55
+
56
+ The visualization palette derives from the 8-Law Weave:
57
+
58
+ ```python
59
+ CUBIC_COLOR = '#3D3D6B' # Fall of Neutral Events (prime 11)
60
+ FCC_COLOR = '#B34444' # Geometric Essence (prime 67)
61
+ ```
62
+
63
+ Do not change these without understanding their derivation. See
64
+ `rhombic/visualize.py` for the full palette.
65
+
66
+ ## Technical
67
+
68
+ - Python 3.10+
69
+ - Dependencies: numpy, networkx (core); matplotlib (visualization); pytest (dev)
70
+ - License: MPL-2.0
71
+ - Tests: `pytest -v`
72
+ - Benchmark: `python -m rhombic.benchmark`
73
+ - Banner: `python scripts/generate_banner.py` (generates from library code)
@@ -0,0 +1,38 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to a positive environment:
15
+
16
+ - Demonstrating empathy and kindness toward other people
17
+ - Being respectful of differing opinions, viewpoints, and experiences
18
+ - Giving and gracefully accepting constructive feedback
19
+ - Accepting responsibility and apologizing to those affected by our mistakes
20
+ - Focusing on what is best for the community
21
+
22
+ Examples of unacceptable behavior:
23
+
24
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
25
+ - Trolling, insulting or derogatory comments, and personal or political attacks
26
+ - Public or private harassment
27
+ - Publishing others' private information without explicit permission
28
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
29
+
30
+ ## Enforcement
31
+
32
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
33
+ reported to the project maintainers at **security@promptcrafted.com**. All
34
+ complaints will be reviewed and investigated promptly and fairly.
35
+
36
+ ## Attribution
37
+
38
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1.
@@ -0,0 +1,48 @@
1
+ # Contributing to rhombic
2
+
3
+ ## Security First
4
+
5
+ Before contributing, install the pre-commit hooks:
6
+
7
+ ```bash
8
+ pip install pre-commit
9
+ pre-commit install
10
+ ```
11
+
12
+ Every commit is scanned for accidentally included secrets.
13
+
14
+ ## How to Contribute
15
+
16
+ 1. Fork the repository
17
+ 2. Create a feature branch (`git checkout -b feature/your-feature`)
18
+ 3. Install pre-commit hooks (`pre-commit install`)
19
+ 4. Install dev dependencies: `pip install -e ".[all]"`
20
+ 5. Make your changes
21
+ 6. Run tests: `pytest`
22
+ 7. Commit with a descriptive message
23
+ 8. Push to your fork and open a Pull Request
24
+
25
+ ## What We're Looking For
26
+
27
+ - **New lattice topologies.** BCC, hexagonal close-packed, diamond cubic — any tessellation with a clear mathematical characterization.
28
+ - **New benchmark metrics.** Betweenness centrality, spectral gap, random walk cover time — anything that measures structural properties.
29
+ - **New rungs on the experimental ladder.** Spatial operations, signal processing, context architecture — see `docs/EXPERIMENTAL_LADDER.md`.
30
+ - **Performance improvements.** Faster lattice construction, GPU-accelerated metrics.
31
+ - **Bug fixes and documentation improvements.**
32
+
33
+ ## What We're Not Looking For
34
+
35
+ - Benchmarks that don't report cost alongside benefit. The edge count ratio matters.
36
+ - Topologies without clear mathematical definition.
37
+ - Changes that break reproducibility of existing results.
38
+
39
+ ## Philosophy
40
+
41
+ - Reproducible by default. Every result has code that generates it.
42
+ - The geometry is the argument. The numbers are the evidence.
43
+ - Cost is always reported alongside benefit.
44
+ - Sparse results are data, not failure.
45
+
46
+ ## Code of Conduct
47
+
48
+ This project follows the [Contributor Covenant](CODE_OF_CONDUCT.md).