Metadata-Version: 2.4
Name: pydantic-to-ts
Version: 0.1.0
Summary: A lightweight CLI tool to convert Python Pydantic models into TypeScript interfaces.
Author: Nivan Panghal
License: MIT
Keywords: pydantic,typescript,cli,codegen,python
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: typer>=0.9.0
Requires-Dist: rich>=13.0.0

```markdown
# pydantic-to-ts ⚡

> Automatically convert Python Pydantic models into clean TypeScript interfaces for your frontend.

[![PyPI version](https://badge.fury.io/py/pydantic-to-ts.svg)](https://badge.fury.io/py/pydantic-to-ts)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

---

## 📦 Installation

Install the package via `pip`:

```bash
pip install pydantic-to-ts

```

---

## 💡 How It Works

1. Create a Python models file (e.g., `models.py`):

```python
from pydantic import BaseModel
from typing import Optional

class User(BaseModel):
    id: str
    age: int
    is_active: bool
    email: Optional[str]

```

2. Run the CLI command pointing to your Python file:

```bash
pydantic-to-ts generate --input models.py --output types.ts

```

3. Check your generated `types.ts` file:

```typescript
// AUTO-GENERATED BY pydantic-to-ts

export interface User {
  id: string;
  age: number;
  is_active: boolean;
  email: string | null;
}

```

---

## 🛠️ Command Usage & Options

```bash
pydantic-to-ts generate [OPTIONS]

```

| Flag | Short | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `--input` | `-i` | **Yes** | — | Path to source Python file containing Pydantic models (`.py`) |
| `--output` | `-o` | No | `types.ts` | Target path where generated TypeScript interfaces will be saved |

### Example Usages:

* Generate into default `types.ts` file:
```bash
pydantic-to-ts generate -i backend/models.py

```


* Generate into a specific folder:
```bash
pydantic-to-ts generate -i backend/schemas/user.py -o frontend/src/types/user.ts

```




 
