Metadata-Version: 2.4
Name: mongo-schematic
Version: 0.1.4.2
Summary: MongoSchematic CLI for MongoDB schema analysis, drift detection, and migrations
Author-email: Abdulazeez Abdulazeez Adeshina <abdulazeez@thecodecafe.co>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Database
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer[all]>=0.12.0
Requires-Dist: rich>=13.7.0
Requires-Dist: beanie>=1.25.0
Requires-Dist: motor>=3.4.0
Requires-Dist: pymongo>=4.6.1
Requires-Dist: pydantic>=2.6.0
Requires-Dist: pydantic-settings>=2.2.0
Requires-Dist: pyyaml>=6.0.1
Requires-Dist: jsonschema>=4.20.0
Requires-Dist: google-generativeai>=0.3.2
Requires-Dist: python-dotenv>=1.0.1
Requires-Dist: Faker>=24.0.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Dynamic: license-file

# MongoSchematic CLI

**MongoSchematic** is a modern, developer-first tool for MongoDB schema management. It helps you infer schemas from existing data, detect drift, generate code, and handle migrations with confidence.

![License](https://img.shields.io/badge/license-MIT-blue.svg)
![Python](https://img.shields.io/badge/python-3.8+-blue.svg)
![MongoDB](https://img.shields.io/badge/mongodb-4.4+-green.svg)

## Features

- **Schema Inference**: Automatically infer schemas from your MongoDB collections.
- **Full BSON Support**: All MongoDB types including `binData`, `regex`, `long`, `timestamp`, and union types.
- **Drift Detection**: Detect when your data deviates from your schema/models.
- **Code Generation**: Generate Pydantic models (Python) and TypeScript interfaces.
- **Documentation**: Build static HTML documentation for your database.
- **Data Seeding**: Populate your database with realistic dummy data.
- **Migrations**: Generate and execute versioned migration scripts.
- **Validation**: Validate documents against your defined schemas.
- **AI-Powered**: Optional Gemini AI integration for schema recommendations.

## Installation

```bash
pip install mongo-schematic
```

## Quick Start

### 1. Initialize

Generate a default configuration file:

```bash
mschema init
```

### 2. Analyze a Collection

Infer the schema from an existing collection and save it:

```bash
mschema analyze --collection users --save schemas/users.v1.yml
```

### 3. Generate Code

Create a Pydantic model for your application:

```bash
mschema generate models --schema schemas/users.v1.yml --type pydantic --out models/user.py
```

### 4. Detect Drift

Check if your live data matches your schema:

```bash
mschema drift detect --schema schemas/users.v1.yml --collection users
```

## Documentation

For full usage details including database-wide commands, CI/CD integration, and migration workflows, see the [Usage Guide](docs/USAGE.md).

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
