Metadata-Version: 2.4
Name: tinycontracts
Version: 0.1.2
Summary: serve a folder of json/csv/parquet files as a rest api
Author-email: Aditya Kumar <adityakuma0308@gmail.com>
License-Expression: MIT
Keywords: api,cli,csv,fastapi,json,parquet,rest
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Requires-Python: >=3.11
Requires-Dist: fastapi>=0.128.0
Requires-Dist: pandas>=3.0.0
Requires-Dist: pyarrow>=23.0.0
Requires-Dist: rich>=14.3.2
Requires-Dist: typer>=0.21.1
Requires-Dist: uvicorn>=0.40.0
Description-Content-Type: text/markdown

# tinycontracts

Turn any folder of JSON, CSV, or Parquet files into a REST API instantly.

## Install

```bash
pip install tinycontracts
```

## Usage

```bash
tc ./data
```

That's it. Your files are now API endpoints.

## Options

```bash
tc ./data -p 8000           # custom port (default: 4242)
tc ./data -H 0.0.0.0        # expose to network
tc --version                # show version
```

## Example

```
data/
  users.json     ->  GET /users
  orders.csv     ->  GET /orders
  config.json    ->  GET /config
```

## Querying

```bash
# filter
curl "localhost:4242/users?active=true"

# pagination
curl "localhost:4242/orders?_limit=10&_offset=20"

# sort
curl "localhost:4242/orders?_sort=-created_at"

# combine
curl "localhost:4242/orders?status=pending&_limit=5"
```

## Endpoints

| Endpoint | Description |
|----------|-------------|
| `/{resource}` | List all rows |
| `/{resource}/{id}` | Get by ID |
| `/{resource}/_schema` | JSON schema |
| `/_help` | API documentation |
| `/_schema` | All schemas |
| `/docs` | Swagger UI |
