Skip to content

Commit 0a694a8

Browse files
committed
fix: Resolve merge conflicts with unified API
Merged both branches: - Added new modules (quantizer, ml, hidden_dims, financial) from local - Kept schema alignment documentation from remote - Unified __init__.py with all exports - Resolved src/lib.rs conflicts with complete implementation Now includes: - Hidden dimensions: k = ⌈log₂(1/ε)⌉ - PythagoreanQuantizer with TERNARY/POLAR/TURBO/HYBRID modes - Holonomy verification for constraint consistency - ML integration (ConstraintEnforcedLayer, HiddenDimensionNetwork) - Financial applications (ExactMoney, PortfolioOptimizer) - Full schema alignment with Rust core
2 parents 58dc3a6 + 2628a37 commit 0a694a8

29 files changed

Lines changed: 7384 additions & 156 deletions

.github/workflows/ci.yml

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
RUST_BACKTRACE: 1
13+
14+
jobs:
15+
# =============================================================================
16+
# Rust Tests
17+
# =============================================================================
18+
rust-test:
19+
name: Rust Tests
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Install Rust
25+
uses: dtolnay/rust-toolchain@stable
26+
with:
27+
components: rustfmt, clippy
28+
29+
- name: Cache Cargo
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
~/.cargo/registry
34+
~/.cargo/git
35+
target
36+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
37+
restore-keys: |
38+
${{ runner.os }}-cargo-
39+
40+
- name: Check formatting
41+
run: cargo fmt -- --check
42+
43+
- name: Clippy
44+
run: cargo clippy -- -D warnings
45+
46+
- name: Run tests
47+
run: cargo test --verbose
48+
49+
# =============================================================================
50+
# Python Tests - Matrix
51+
# =============================================================================
52+
python-test:
53+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
54+
runs-on: ${{ matrix.os }}
55+
needs: rust-test
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
os: [ubuntu-latest, macos-latest, windows-latest]
60+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
61+
exclude:
62+
# Skip Python 3.8 on macOS ARM (not supported)
63+
- os: macos-latest
64+
python-version: '3.8'
65+
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Set up Python
70+
uses: actions/setup-python@v5
71+
with:
72+
python-version: ${{ matrix.python-version }}
73+
74+
- name: Install Rust
75+
uses: dtolnay/rust-toolchain@stable
76+
77+
- name: Cache Cargo
78+
uses: actions/cache@v4
79+
with:
80+
path: |
81+
~/.cargo/registry
82+
~/.cargo/git
83+
target
84+
key: ${{ runner.os }}-py${{ matrix.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
85+
restore-keys: |
86+
${{ runner.os }}-py${{ matrix.python-version }}-cargo-
87+
${{ runner.os }}-cargo-
88+
89+
- name: Install maturin
90+
run: pip install maturin
91+
92+
- name: Build extension
93+
run: maturin develop --release
94+
95+
- name: Install test dependencies
96+
run: pip install pytest pytest-cov numpy
97+
98+
- name: Run tests
99+
run: pytest tests/ -v --tb=short --cov=constraint_theory
100+
101+
- name: Upload coverage
102+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
103+
uses: codecov/codecov-action@v4
104+
with:
105+
files: ./coverage.xml
106+
fail_ci_if_error: false
107+
108+
# =============================================================================
109+
# Linting
110+
# =============================================================================
111+
lint:
112+
name: Python Linting
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/checkout@v4
116+
117+
- name: Set up Python
118+
uses: actions/setup-python@v5
119+
with:
120+
python-version: '3.11'
121+
122+
- name: Install linters
123+
run: pip install black isort mypy ruff
124+
125+
- name: Check formatting with black
126+
run: black --check constraint_theory/ tests/ examples/
127+
128+
- name: Check imports with isort
129+
run: isort --check-only constraint_theory/ tests/ examples/
130+
131+
- name: Lint with ruff
132+
run: ruff check constraint_theory/ tests/ examples/
133+
134+
- name: Type check with mypy
135+
run: mypy constraint_theory/ --ignore-missing-imports
136+
137+
# =============================================================================
138+
# Build Wheels
139+
# =============================================================================
140+
build-wheels:
141+
name: Build wheels on ${{ matrix.os }}
142+
runs-on: ${{ matrix.os }}
143+
needs: [rust-test, python-test]
144+
strategy:
145+
matrix:
146+
os: [ubuntu-latest, macos-latest, windows-latest]
147+
148+
steps:
149+
- uses: actions/checkout@v4
150+
151+
- name: Build wheels
152+
uses: PyO3/maturin-action@v1
153+
with:
154+
command: build
155+
args: --release --out dist
156+
manylinux: auto
157+
158+
- name: Upload wheels
159+
uses: actions/upload-artifact@v4
160+
with:
161+
name: wheels-${{ matrix.os }}
162+
path: dist/
163+
retention-days: 7
164+
165+
# =============================================================================
166+
# Build Source Distribution
167+
# =============================================================================
168+
build-sdist:
169+
name: Build source distribution
170+
runs-on: ubuntu-latest
171+
needs: [rust-test, python-test]
172+
173+
steps:
174+
- uses: actions/checkout@v4
175+
176+
- name: Install maturin
177+
run: pip install maturin
178+
179+
- name: Build sdist
180+
run: maturin sdist --out dist
181+
182+
- name: Upload sdist
183+
uses: actions/upload-artifact@v4
184+
with:
185+
name: sdist
186+
path: dist/
187+
retention-days: 7
188+
189+
# =============================================================================
190+
# Test Built Wheels
191+
# =============================================================================
192+
test-wheels:
193+
name: Test wheel on ${{ matrix.os }}
194+
runs-on: ${{ matrix.os }}
195+
needs: build-wheels
196+
strategy:
197+
matrix:
198+
os: [ubuntu-latest, macos-latest, windows-latest]
199+
200+
steps:
201+
- uses: actions/checkout@v4
202+
203+
- name: Set up Python
204+
uses: actions/setup-python@v5
205+
with:
206+
python-version: '3.11'
207+
208+
- name: Download wheels
209+
uses: actions/download-artifact@v4
210+
with:
211+
name: wheels-${{ matrix.os }}
212+
path: dist/
213+
214+
- name: Install wheel
215+
run: pip install dist/*.whl
216+
217+
- name: Test import
218+
run: |
219+
python -c "from constraint_theory import PythagoreanManifold, snap, generate_triples; print('Import successful')"
220+
python -c "from constraint_theory import __version__; print(f'Version: {__version__}')"
221+
222+
- name: Run basic tests
223+
run: |
224+
pip install pytest numpy
225+
pytest tests/ -v --tb=short -k "not compatibility"
226+
227+
# =============================================================================
228+
# Documentation Build
229+
# =============================================================================
230+
docs:
231+
name: Build Documentation
232+
runs-on: ubuntu-latest
233+
steps:
234+
- uses: actions/checkout@v4
235+
236+
- name: Check documentation
237+
run: |
238+
# Check that all referenced docs exist
239+
test -f README.md
240+
test -f docs/API.md
241+
test -f docs/PRODUCTION.md
242+
test -f docs/INTEGRATION.md
243+
244+
- name: Check links in docs
245+
run: |
246+
# Basic link check
247+
grep -r "https://" docs/ README.md | head -20 || true
248+
echo "Link check complete"

0 commit comments

Comments
 (0)