Metadata-Version: 2.4
Name: covet
Version: 0.1.0b6
Summary: A high-performance Python web framework with Rust-optimized components for modern async applications
Author: Vipin Kumar
Maintainer: Vipin Kumar
License: Proprietary
Project-URL: Author, https://github.com/vipin08
Project-URL: Documentation, https://github.com/vipin08/Covet-doc
Keywords: rest-api,http,api,python-rust,async,asgi,web-framework,graphql,websocket,high-performance,rust-extensions,orm,database,jwt-auth
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Rust
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE_HEADER
Requires-Dist: pydantic>=2.12.0
Requires-Dist: prometheus-client>=0.23.1
Requires-Dist: psutil>=7.1.0
Requires-Dist: PyJWT>=2.8.0
Requires-Dist: uvicorn[standard]>=0.37.0
Provides-Extra: dev
Requires-Dist: pytest>=8.4.2; extra == "dev"
Requires-Dist: pytest-asyncio>=1.2.0; extra == "dev"
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
Requires-Dist: pytest-mock>=3.15.1; extra == "dev"
Requires-Dist: pytest-benchmark>=5.1.0; extra == "dev"
Requires-Dist: black>=25.9.0; extra == "dev"
Requires-Dist: ruff>=0.14.0; extra == "dev"
Requires-Dist: mypy>=1.7.1; extra == "dev"
Requires-Dist: pre-commit>=3.5.0; extra == "dev"
Requires-Dist: httpx>=0.28.1; extra == "dev"
Requires-Dist: maturin>=1.9.4; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5.3; extra == "docs"
Requires-Dist: mkdocs-material>=9.5.32; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
Provides-Extra: test
Requires-Dist: pytest>=8.4.2; extra == "test"
Requires-Dist: pytest-asyncio>=1.2.0; extra == "test"
Requires-Dist: pytest-cov>=7.0.0; extra == "test"
Requires-Dist: pytest-mock>=3.15.1; extra == "test"
Requires-Dist: pytest-benchmark>=5.1.0; extra == "test"
Requires-Dist: httpx>=0.28.1; extra == "test"
Provides-Extra: security
Requires-Dist: pyotp>=2.9.0; extra == "security"
Requires-Dist: passlib[bcrypt]>=1.7.4; extra == "security"
Requires-Dist: validators>=0.22.0; extra == "security"
Requires-Dist: bleach>=6.2.0; extra == "security"
Requires-Dist: limits>=3.7.0; extra == "security"
Requires-Dist: python-multipart>=0.0.6; extra == "security"
Requires-Dist: email-validator>=2.1.0; extra == "security"
Provides-Extra: web
Requires-Dist: pydantic>=2.12.0; extra == "web"
Requires-Dist: pydantic-settings>=2.11.0; extra == "web"
Provides-Extra: database
Requires-Dist: sqlalchemy>=2.0.43; extra == "database"
Requires-Dist: alembic>=1.16.5; extra == "database"
Requires-Dist: asyncpg>=0.30.0; extra == "database"
Requires-Dist: aiomysql>=0.2.0; extra == "database"
Provides-Extra: production
Requires-Dist: asyncpg>=0.30.0; extra == "production"
Requires-Dist: aiomysql>=0.2.0; extra == "production"
Requires-Dist: redis>=6.4.0; extra == "production"
Requires-Dist: aiomemcache>=0.8.0; extra == "production"
Requires-Dist: passlib[bcrypt]>=1.7.4; extra == "production"
Requires-Dist: python-dotenv>=1.1.1; extra == "production"
Provides-Extra: graphql
Requires-Dist: strawberry-graphql>=0.209.0; extra == "graphql"
Provides-Extra: orm
Requires-Dist: sqlalchemy>=2.0.43; extra == "orm"
Requires-Dist: alembic>=1.16.5; extra == "orm"
Provides-Extra: rust
Requires-Dist: maturin>=1.9.4; extra == "rust"
Provides-Extra: monitoring
Requires-Dist: opentelemetry-api>=1.21.0; extra == "monitoring"
Requires-Dist: opentelemetry-sdk>=1.21.0; extra == "monitoring"
Requires-Dist: structlog>=23.2.0; extra == "monitoring"
Provides-Extra: full
Requires-Dist: pydantic>=2.12.0; extra == "full"
Requires-Dist: pydantic-settings>=2.11.0; extra == "full"
Requires-Dist: httpx>=0.28.1; extra == "full"
Requires-Dist: sqlalchemy>=2.0.43; extra == "full"
Requires-Dist: alembic>=1.16.5; extra == "full"
Requires-Dist: asyncpg>=0.30.0; extra == "full"
Requires-Dist: aiomysql>=0.2.0; extra == "full"
Requires-Dist: redis>=6.4.0; extra == "full"
Requires-Dist: aiomemcache>=0.8.0; extra == "full"
Requires-Dist: strawberry-graphql>=0.283.2; extra == "full"
Requires-Dist: passlib[bcrypt]>=1.7.4; extra == "full"
Requires-Dist: validators>=0.22.0; extra == "full"
Requires-Dist: bleach>=6.2.0; extra == "full"
Requires-Dist: limits>=5.5.0; extra == "full"
Requires-Dist: python-multipart>=0.0.20; extra == "full"
Requires-Dist: email-validator>=2.3.0; extra == "full"
Requires-Dist: click>=8.3.0; extra == "full"
Requires-Dist: rich>=14.2.0; extra == "full"
Requires-Dist: prometheus-client>=0.23.1; extra == "full"
Requires-Dist: opentelemetry-api>=1.37.0; extra == "full"
Requires-Dist: opentelemetry-sdk>=1.37.0; extra == "full"
Requires-Dist: structlog>=25.4.0; extra == "full"
Requires-Dist: python-dotenv>=1.1.1; extra == "full"
Requires-Dist: pyyaml>=6.0.3; extra == "full"
Requires-Dist: jinja2>=3.1.6; extra == "full"
Requires-Dist: maturin>=1.9.4; extra == "full"
Dynamic: license-file

# CovetPy - High-Performance Python Web Framework

A high-performance Python web framework with Rust-optimized components, featuring a Django/Flask-style ORM and modern async capabilities.

## Features

- **Rust-Optimized Performance**: Optional Rust extensions for high-performance routing and HTTP parsing
- **Django/Flask-Style ORM**: Intuitive QuerySet API with full type safety
- **Advanced Query Capabilities**: Q objects for complex OR/AND/NOT queries
- **High-Performance Bulk Operations**: Optimized create, update, and delete operations
- **Built-in Security**: SQL injection prevention, DoS protection, XSS protection, JWT authentication
- **Type-Safe Fields**: MoneyField, DateTimeField, EmailField with automatic validation
- **17+ Field Lookups**: `__gt`, `__gte`, `__contains`, `__in`, `__startswith`, and more
- **Production-Ready Database Support**: MySQL, PostgreSQL, SQLite
- **ASGI 3.0 Native**: Full async/await support throughout
- **Enterprise Features**: Connection pooling, health checks, Prometheus metrics, rate limiting

## Installation

```bash
pip install covet
```

With optional features:

```bash
# With database support
pip install covet[database]

# With security features
pip install covet[security]

# Full installation (all features)
pip install covet[full]
```

## Quick Start

### Hello World

```python
from covet import Covet

app = Covet()

@app.route('/')
async def hello(request):
    return {'message': 'Hello World'}

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8000)
```

### Django/Flask-Style ORM

```python
from decimal import Decimal
from covet.database.adapters.mysql import MySQLAdapter
from covet.database.orm import Model, Q
from covet.database.orm.fields import (
    AutoField, CharField, EmailField, IntegerField,
    BooleanField, MoneyField, Money, DateTimeField
)
from covet.database.orm.managers import ModelManager
from covet.database.orm.adapter_registry import register_adapter

# Setup database connection
adapter = MySQLAdapter(
    host='localhost',
    user='root',
    password='password',
    database='myapp'
)
await adapter.connect()
register_adapter('default', adapter)

# Define model
class User(Model):
    id = AutoField()
    username = CharField(max_length=50, unique=True)
    email = EmailField(unique=True)
    age = IntegerField()
    is_active = BooleanField(default=True)
    balance = MoneyField(max_digits=10, decimal_places=2, currency='USD')
    created_at = DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'users'
        ordering = ['-created_at']

# Setup model manager
User._adapter = adapter
User.objects = ModelManager(User)

# Create user
user = User(
    username='john_doe',
    email='john@example.com',
    age=30,
    is_active=True,
    balance=Money(Decimal('1000.00'), 'USD')
)
await user.save()

# Query with field lookups
active_users = await User.objects.filter(
    is_active=True,
    age__gte=18
)

# Complex queries with Q objects
from covet.database.orm import Q

users = await User.objects.filter(
    Q(username__startswith='john') | Q(email__contains='example.com')
)
```

### RESTful API with JWT Authentication

```python
from covet import Covet
from covet.security.jwt import JWTAuth

app = Covet()
jwt_auth = JWTAuth(secret_key='your-secret-key')

@app.route('/api/auth/login', methods=['POST'])
async def login(request):
    data = await request.json()
    # Validate user credentials
    token = jwt_auth.create_token(user_id=1, username='john_doe')
    return {'token': token}

@app.route('/api/protected', methods=['GET'])
async def protected(request):
    token = request.headers.get('Authorization', '').replace('Bearer ', '')
    payload = jwt_auth.verify_token(token)
    return {'user_id': payload['user_id']}

if __name__ == '__main__':
    app.run()
```

### High-Performance Bulk Operations

```python
# Bulk create (10-100x faster than loops)
users_data = [
    {'username': f'user_{i}', 'email': f'user{i}@example.com', 'age': 20 + i}
    for i in range(1000)
]
await User.objects.bulk_create(users_data)

# Bulk update
await User.objects.filter(age__lt=18).bulk_update({'is_active': False})

# Bulk delete
await User.objects.filter(is_active=False).bulk_delete()
```

## Core Features

### ASGI 3.0 Native

CovetPy implements the ASGI 3.0 protocol natively, providing:
- Full async/await support
- WebSocket support
- HTTP/2 ready (via uvicorn)
- Compatible with any ASGI server (uvicorn, hypercorn, daphne)

### Django-Style ORM

- **QuerySet API**: Familiar Django-style chaining
- **Field Types**: 15+ field types with automatic validation
- **Lookups**: 17+ field lookups (`__gt`, `__gte`, `__contains`, `__in`, etc.)
- **Q Objects**: Complex OR/AND/NOT queries
- **Type Safety**: Full type hints and validation
- **Performance**: Optimized bulk operations

### Built-in Security

- **SQL Injection Prevention**: Parameterized queries only
- **XSS Protection**: HTML sanitization with bleach
- **JWT Authentication**: Built-in JWT support
- **RBAC**: Role-Based Access Control
- **Rate Limiting**: Request rate limiting with Redis/Memory backend
- **DoS Protection**: Query size limits, request size limits
- **Password Hashing**: Secure bcrypt hashing

### Monitoring & Observability

- **Prometheus Metrics**: Built-in metrics export
- **Health Checks**: Database and system health endpoints
- **Structured Logging**: JSON logging support
- **Performance Profiling**: Request timing and profiling

## Database Support

CovetPy provides production-ready adapters for:

- **MySQL**: Full async support via aiomysql
- **PostgreSQL**: Full async support via asyncpg
- **SQLite**: Async support via aiosqlite

All adapters include:
- Connection pooling (5-20 connections default)
- Automatic reconnection
- Transaction support
- Query logging
- Performance monitoring

## Production Deployment

### With uvicorn (Recommended)

```bash
uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4
```

### With gunicorn + uvicorn workers

```bash
gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
```

### Docker

```dockerfile
FROM python:3.11-slim

WORKDIR /app
COPY . /app

RUN pip install covet[full]

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
```

## Performance

CovetPy delivers near-native performance:

| Benchmark | CovetPy | vs FastAPI | vs Flask |
|-----------|---------|------------|----------|
| Health check (req/s) | **15,800** | 3x faster | 4x faster |
| DB single-row read | **1,100** | 1.8x faster | 2.6x faster |

- **Optional Rust extensions**: JSON, routing, hashing, JWT, rate limiting — all with pure Python fallbacks
- **Hot-path optimized**: Cached signatures, pre-computed headers, lazy ASGI header decoding
- **Efficient connection pooling**: Minimizes database overhead
- **Lazy query evaluation**: Queries execute only when needed

## Requirements

- Python 3.9+
- Core dependencies:
  - pydantic>=2.12.0
  - uvicorn[standard]>=0.37.0
  - PyJWT>=2.8.0
  - prometheus-client>=0.23.1
  - psutil>=7.1.0

## License

Proprietary - Copyright Vipin Kumar

## Links

- PyPI: https://pypi.org/project/covet/
- Documentation: Coming soon
- Bug Reports: GitHub issues

## Version

Current version: 0.1.0b6 (Beta 5)

This is a beta release. The API may change in future releases.
