Metadata-Version: 2.4
Name: mocksql
Version: 0.1.1
Summary: TDD engine for Analytics Engineering — generate unit test data for SQL queries
License: MIT
Keywords: sql,testing,analytics,bigquery,duckdb,langgraph
Author: Adel Skhiri
Author-email: skhiriadel92@gmail.com
Requires-Python: >=3.11,<3.14
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Testing
Requires-Dist: bcrypt (>=4.2.0,<5.0.0)
Requires-Dist: db-dtypes (>=1.2.0,<2.0.0)
Requires-Dist: duckdb (>=1.5.0,<2.0.0)
Requires-Dist: fastapi (>=0.115.0,<1.0.0)
Requires-Dist: google-cloud-bigquery (>=3.41.0,<4.0.0)
Requires-Dist: google-cloud-bigquery-storage (>=2.25.0,<3.0.0)
Requires-Dist: google-cloud-secret-manager (>=2.20.1,<3.0.0)
Requires-Dist: itsdangerous (>=2.2.0,<3.0.0)
Requires-Dist: langchain (>=1.2.0,<2.0.0)
Requires-Dist: langchain-classic (==1.0.3)
Requires-Dist: langchain-google-genai (>=4.0.0,<5.0.0)
Requires-Dist: langgraph (>=1.1.0,<2.0.0)
Requires-Dist: pandas (>=2.2.2,<3.0.0)
Requires-Dist: passlib (>=1.7.4,<2.0.0)
Requires-Dist: pyarrow (>=22,<23)
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
Requires-Dist: pyyaml (>=6.0)
Requires-Dist: sqlglot[c] (>=30.4.0,<31.0.0)
Requires-Dist: sqlmesh (>=0.234.0,<0.235.0)
Requires-Dist: typer[all] (>=0.24.2,<0.25.0)
Requires-Dist: uvicorn (>=0.44.0,<0.45.0)
Project-URL: Homepage, https://github.com/skadel/mocksql
Project-URL: Repository, https://github.com/skadel/mocksql
Description-Content-Type: text/markdown

# MockSQL — Backend

**FastAPI + LangGraph + CLI**

Ce dossier contient le cœur de MockSQL : l'API REST, le graph LangGraph de génération de données, le CLI, et le package `mocksql-ui` (serveur web + assets React).

---

## Quickstart local

> Prérequis : Python ≥ 3.11, Poetry ≥ 1.8, un projet Google Cloud avec la facturation activée.

### 1. Authentification Google Cloud

```bash
gcloud auth application-default login
gcloud config set project <PROJECT_ID>
```

### 2. Variables d'environnement

```bash
cp .env.example .env   # puis compléter les valeurs
```

Variables minimales requises :

```dotenv
PROJECT_ID=<votre-projet-gcp>
GOOGLE_CLOUD_PROJECT=<votre-projet-gcp>
BQ_SCHEMA_BILLING_PROJECT=<votre-projet-gcp>
DEFAULT_MODEL_NAME=gemini-2.0-flash-lite
DUCKDB_PATH=data/mocksql.duckdb
SECRET_KEY=<générer avec : python -c "import secrets; print(secrets.token_hex(32))">
API_SECRET_KEY=<idem>
FRONT_URL=http://127.0.0.1:3000
```

### 3. Installation & lancement

```bash
python -m venv .venv

# Linux / macOS
source .venv/bin/activate

# Windows
.\.venv\Scripts\activate

pip install poetry && poetry install

# Lancer le serveur
uvicorn server:app --port 8080 --reload
```

L'API est accessible sur **http://localhost:8080**, le frontend sur **http://localhost:3000** (voir [../front/README.md](../front/README.md)).

---

## Commandes de développement

```bash
make style    # ruff check + ruff format --check + vulture (code mort)
make format   # ruff format + ruff check --fix (auto-correction)
make test     # pytest
make check    # style + test
```

Type checking :

```bash
poetry run mypy build_query/ app/
```

---

## Packaging

MockSQL produit deux wheels indépendants :

| Wheel | Contenu |
|-------|---------|
| `mocksql-*.whl` | CLI + LangGraph core (sans UI) |
| `mocksql_ui-*.whl` | Serveur web + assets React bundlés |

### Builder les wheels

```bash
# CLI uniquement
make build-cli

# CLI + UI (build React inclus — Node.js 18+ requis)
make build-ui
```

Les wheels sont générés dans `dist/`.

### Lancer l'UI depuis les wheels

```bash
pip install dist/mocksql-*.whl dist/mocksql_ui-*.whl
mocksql ui              # http://localhost:8080/static/
mocksql ui --port 4000
mocksql ui --no-browser
```

---

## Licence

Propriétaire — © 2025 Adel Skhiri. Contact : [skhiriadel92@gmail.com](mailto:skhiriadel92@gmail.com)

