# ShelfAtlas Python SDK — its own toolchain (uv), independent of the pnpm/turbo
# monorepo build. Python is pinned to 3.12 (pydantic-core wheels lag on Python
# pre-releases; 3.12 installs everything from wheels, no Rust).

PY := .venv/bin/python
PYTEST := .venv/bin/pytest

.PHONY: setup test smoke build clean openapi

setup:
	uv venv --python 3.12 .venv
	uv pip install --python $(PY) -e ".[dev]"

test:
	$(PYTEST) -q

# Live smoke: pass a real key, e.g. `make smoke CATALOG_API_KEY=sa_live_… CATALOG_API_BASE_URL=http://localhost:3210`
smoke:
	$(PYTEST) -q tests/test_smoke_live.py

build:
	uv build

# Regenerate the committed OpenAPI contract snapshot from the TS source of truth.
openapi:
	../../packages/db/node_modules/.bin/tsx -e "import {catalogOpenApiSpec} from '../../apps/web/lib/openapi/catalog-openapi.ts'; process.stdout.write(JSON.stringify(catalogOpenApiSpec, null, 2) + '\n')" > tests/openapi.json

clean:
	rm -rf dist .pytest_cache src/shelfatlas/__pycache__ tests/__pycache__ *.egg-info
