Metadata-Version: 2.4
Name: sift-pdf
Version: 0.1.1
Summary: SiftPDF — stateless imposition planning solver for the Print With Synergy stack. Produces ImposePlans (grid, stagger, gang, nest) for compile-pdf to execute.
Project-URL: Homepage, https://github.com/printwithsynergy/sift-pdf
Project-URL: Repository, https://github.com/printwithsynergy/sift-pdf
Project-URL: Issues, https://github.com/printwithsynergy/sift-pdf/issues
Author-email: Print With Synergy <iam@quincy.codes>
License: AGPL-3.0-or-later
License-File: LICENSE
License-File: NOTICE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Requires-Dist: codex-pdf<2.0,>=1.21.1
Requires-Dist: fastapi>=0.115
Requires-Dist: httpx>=0.27
Requires-Dist: prometheus-client>=0.20
Requires-Dist: pydantic-settings>=2.2
Requires-Dist: pydantic>=2.8
Requires-Dist: python-ulid>=3.0
Requires-Dist: structlog>=24.1
Requires-Dist: uvicorn[standard]>=0.30
Provides-Extra: dev
Requires-Dist: mypy>=1.9; extra == 'dev'
Requires-Dist: ortools>=9.10; extra == 'dev'
Requires-Dist: pre-commit>=3.6; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest-cov>=4.1; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Requires-Dist: spyrrow>=0.9.0; extra == 'dev'
Provides-Extra: gang
Requires-Dist: ortools>=9.10; extra == 'gang'
Provides-Extra: geom
Requires-Dist: pyclipr>=0.1.8; extra == 'geom'
Provides-Extra: nest
Requires-Dist: spyrrow>=0.9.0; extra == 'nest'
Description-Content-Type: text/markdown

# sift-pdf

Stateless, deterministic imposition planning solver for the Print With Synergy stack.

Given SKU/job rules + press context, produces the most efficient **step-and-repeat / stagger / gang / nest layout** — the logic behind the SNR. Hands an `ImposePlan` to `compile-pdf.impose` for PDF generation; never writes bytes itself.

## Solver tiers

| Mode | Tier | Engine | Layouts |
|---|---|---|---|
| `grid` | T1 | codex tile_grid | Uniform + stagger cuts (half-drop-x, half-drop-y, custom offset) |
| `gang` | T2 | OR-Tools CP-SAT | Multi-SKU quantity balancing |
| `nest` | T3 | spyrrow/sparrow | True-shape irregular-die nesting |

## API

```
POST /v1/sift/solve      → SiftImposePlan
POST /v1/sift/suggest    → SiftImposePlan (substrate sweep)
POST /v1/sift/estimate   → EstimateManifest
GET  /v1/contract
GET  /healthz  /readyz
```

## Quick start

```bash
pip install "sift-pdf[gang]"
uvicorn sift_pdf.api.main:app --port 8100
```

```bash
curl -X POST http://localhost:8100/v1/sift/solve \
  -H "Content-Type: application/json" \
  -d '{
    "jobs": [{"id":"sku-1","die":{"type":"rect","width_pt":288,"height_pt":144},"quantity":1000}],
    "press_profile": {"id":"p1","web_width_pt":864,"repeat_model":{"type":"servo","min_repeat_pt":144,"max_repeat_pt":864}},
    "mode": "grid"
  }'
```

## Stagger cuts

```bash
curl -X POST http://localhost:8100/v1/sift/solve \
  -d '{ ..., "stagger_mode": "half-drop-x" }'
```

Supported: `half-drop-x`, `half-drop-y`, `custom` (with `stagger_offset_pt`).

## Development

```bash
uv sync --extra dev
uv run pytest --cov=sift_pdf --cov-fail-under=70
```

## License

AGPL-3.0-or-later. See LICENSE and NOTICE for dependency licenses.
