This release is a pre-release and may not be stable for production use.
CovetPy - High-Performance Python Web Framework
CovetPy is a high-performance Python web framework with Rust-optimized components, designed for building modern async applications with exceptional speed and developer experience.
🚀 Key Features
Performance
- Rust-Optimized Routing: 10-13% performance improvement over pure Python
- Async/Await First: Built on ASGI 3.0 for maximum concurrency
- Zero-Copy Operations: Efficient memory usage with Rust extensions
- Production-Ready: Battle-tested components for high-traffic applications
Full-Stack Capabilities
- REST API: Fast HTTP request/response handling with Pydantic validation
- GraphQL: Powered by Strawberry GraphQL for modern API development
- WebSocket: Real-time bidirectional communication with room management
- Database ORM: Full-featured ORM with migrations for PostgreSQL, MySQL, SQLite
- Authentication: JWT tokens, password hashing, MFA support
- Caching: Redis and in-memory caching for optimal performance
Developer Experience
- Type-Safe: Comprehensive type hints for excellent IDE support
- Modern Python: Uses latest Python 3.9+ features
- Clean API: Intuitive, Flask-inspired interface
- Well-Documented: Extensive documentation and examples
📦 Installation
Quick Install
# Minimal installation
pip install covet
⚡ Quick Start
Hello World (30 seconds)
from covet import CovetPy
# Create application
app = CovetPy()
# Define routes
@app.route("/")
async def hello(request):
return {"message": "Hello, CovetPy!"}
@app.route("/users/{user_id}")
async def get_user(request, user_id: int):
return {"user_id": user_id, "name": f"User {user_id}"}
# Run server
if __name__ == "__main__":
app.run() # Runs on http://localhost:8000
Database ORM - Django/Flask-Style QuerySet API
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 with Django-style fields
class User(Model):
id = AutoField()
username = CharField(max_length=50)
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 - Basic save
user = User(
username='alice',
email='alice@example.com',
age=25,
is_active=True,
balance=Money(Decimal('100.00'), 'USD')
)
await user.save()
# BULK CREATE - 10-100x faster than loops
users_list = [
User(username=f'user{i}', email=f'user{i}@example.com',
age=20+i, is_active=True, balance=Money(Decimal('50.00'), 'USD'))
for i in range(100)
]
created = await User.objects.bulk_create(users_list) # Single INSERT
# READ - Django-style queries
all_users = await User.objects.all()
active_users = await User.objects.filter(is_active=True)
adults = await User.objects.filter(age__gte=18)
# Field lookups (17+ types)
gmail_users = await User.objects.filter(email__icontains='gmail.com')
rich_users = await User.objects.filter(balance__gt=Money(Decimal('1000'), 'USD'))
young_adults = await User.objects.filter(age__in=[18, 19, 20, 21])
# Q Objects - Complex OR/AND/NOT queries
results = await User.objects.filter(
Q(username='alice') | Q(email='bob@example.com')
)
complex_query = await User.objects.filter(
Q(is_active=True) & (Q(age__gte=25) | Q(balance__gte=Money(Decimal('500'), 'USD')))
)
not_query = await User.objects.filter(~Q(is_active=False))
# Method chaining with ordering and limits
top_users = await User.objects.filter(
is_active=True
).exclude(
age__lt=18
).order_by('-balance', 'username').limit(10)
# Aggregation
count = await User.objects.filter(is_active=True).count()
exists = await User.objects.filter(username='alice').exists()
first_user = await User.objects.filter(is_active=True).first()
# UPDATE - Instance update
user.balance = Money(Decimal('150.00'), 'USD')
await user.save()
# BULK UPDATE - Efficient batch updates
users_to_update = await User.objects.filter(age__lt=21)
for user in users_to_update:
user.is_active = False
await User.objects.bulk_update(users_to_update, fields=['is_active'])
# DELETE
await user.delete()
# Security features built-in:
# - Automatic SQL injection prevention
# - LIKE pattern escaping
# - DoS protection (DEFAULT_MAX_QUERY_LIMIT=10000)
# - Parameterized queries throughout
REST API with Validation
from pydantic import BaseModel, EmailStr, Field
class CreateUserRequest(BaseModel):
name: str = Field(..., min_length=1, max_length=100)
email: EmailStr
age: int = Field(..., ge=0, le=150)
@app.route("/api/users", methods=["POST"])
async def create_user(request):
data = await request.json()
# Validate with Pydantic
user_data = CreateUserRequest(**data)
# Save to database
user = await User.create(**user_data.dict())
return {"id": user.id, "email": user.email}
JWT Authentication
from covet.security.jwt_auth import JWTAuthenticator, JWTConfig, TokenType
# Setup JWT
jwt_config = JWTConfig(
secret_key='your-secret-key-min-32-chars',
algorithm='HS256',
access_token_expire_minutes=30
)
jwt_auth = JWTAuthenticator(jwt_config)
# Login endpoint
@app.route("/login", methods=["POST"])
async def login(request):
data = await request.json()
# Verify credentials (your logic)
user_id = "user_123"
# Create access token
token = jwt_auth.create_token(user_id, TokenType.ACCESS)
return {
"access_token": token,
"token_type": "bearer"
}
# Protected route
@app.route("/profile")
async def profile(request):
auth_header = request.headers.get("Authorization")
token = auth_header.split(" ")[1]
claims = jwt_auth.verify_token(token)
user_id = claims['sub']
return {"user_id": user_id}
WebSocket Real-Time Communication
from covet.websocket import WebSocketManager
ws_manager = WebSocketManager()
@app.websocket("/ws/chat/{room_id}")
async def chat_room(websocket, room_id: str):
await ws_manager.connect(websocket, room_id)
try:
while True:
message = await websocket.receive_json()
await ws_manager.broadcast(room_id, message)
except:
await ws_manager.disconnect(websocket, room_id)
GraphQL API
from covet.api.graphql import GraphQLHandler
import strawberry
@strawberry.type
class User:
id: int
name: str
email: str
@strawberry.type
class Query:
@strawberry.field
def users(self) -> list[User]:
return [
User(id=1, name="Alice", email="alice@example.com"),
User(id=2, name="Bob", email="bob@example.com")
]
schema = strawberry.Schema(query=Query)
@app.route("/graphql", methods=["POST", "GET"])
async def graphql_endpoint(request):
handler = GraphQLHandler(schema)
return await handler.handle(request)
🎯 Performance
Rust-Optimized Components
CovetPy includes Rust-optimized components that deliver measurable performance improvements:
Benchmark Results:
- Pure Python: 1,395 requests/sec
- Rust-Optimized: 1,576 requests/sec
- Improvement: +13% throughput
The Rust optimization is enabled by default - you get the performance boost automatically!
from covet.core.fast_processor import ASGIApplication
# Rust optimization enabled by default
app = ASGIApplication() # 13% faster
# Or disable for debugging
app = ASGIApplication(enable_rust=False)
🔧 System Requirements
- Python: 3.9, 3.10, 3.11, or 3.12
- Operating Systems: Linux, macOS, Windows
- RAM: Minimum 512MB, recommended 2GB
- Disk: 200MB for package + dependencies
📚 Feature Matrix
| Feature | Included | Install Extra |
|---|---|---|
| Core HTTP/ASGI | ✅ Always | - |
| Routing & Middleware | ✅ Always | - |
| Database (SQLite) | ✅ Always | - |
| PostgreSQL Support | ⚙️ Optional | [database] |
| MySQL Support | ⚙️ Optional | [database] |
| ORM with Migrations | ⚙️ Optional | [orm] |
| JWT Authentication | ⚙️ Optional | [security] |
| Password Hashing | ⚙️ Optional | [security] |
| MFA/TOTP | ⚙️ Optional | [security] |
| REST API | ⚙️ Optional | [web] |
| GraphQL | ⚙️ Optional | [graphql] |
| WebSocket | ✅ Always | - |
| Caching (Redis) | ⚙️ Optional | [production] |
| Monitoring | ⚙️ Optional | [monitoring] |
| Rust Optimization | ✅ Always | - |
🚀 Production Deployment
Running with Uvicorn
# Install production dependencies
pip install covet[production]
# Run with Uvicorn
uvicorn app:app --host 0.0.0.0 --port 8000 --workers 4
# Or with Gunicorn + Uvicorn workers
gunicorn app:app -w 4 -k uvicorn.workers.UvicornWorker
Docker Deployment
FROM python:3.11-slim
WORKDIR /app
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application
COPY . .
# Run application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
Database Examples
SQLite (Zero Configuration):
from covet.database import SQLiteAdapter
adapter = SQLiteAdapter(database_path='app.db')
PostgreSQL:
from covet.database import PostgreSQLAdapter
adapter = PostgreSQLAdapter(
host='localhost',
port=5432,
database='myapp',
user='postgres',
password='secret'
)
MySQL:
from covet.database import MySQLAdapter
adapter = MySQLAdapter(
host='localhost',
port=3306,
database='myapp',
user='root',
password='secret'
)
⚙️ Configuration
Environment Variables
import os
from dotenv import load_dotenv
load_dotenv()
DATABASE_URL = os.getenv('DATABASE_URL')
JWT_SECRET = os.getenv('JWT_SECRET_KEY')
REDIS_URL = os.getenv('REDIS_URL')
DEBUG = os.getenv('DEBUG', 'False') == 'True'
Application Configuration
from covet import CovetPy
from covet.config import Config
config = Config(
debug=False,
host='0.0.0.0',
port=8000,
database_url='postgresql://user:pass@localhost/myapp',
jwt_secret='your-secret-key',
redis_url='redis://localhost:6379/0'
)
app = CovetPy(config=config)
🔒 Security Features
- JWT Authentication: Secure token-based auth with expiration
- Password Hashing: Bcrypt-based secure password storage
- MFA/TOTP: Two-factor authentication support
- Input Validation: Pydantic-powered request validation
- CORS Middleware: Configurable cross-origin resource sharing
- Rate Limiting: Protect against abuse and DDoS
- SQL Injection Protection: Parameterized queries
- XSS Protection: HTML sanitization
📊 Monitoring & Observability
from covet.monitoring import MetricsCollector
from covet.monitoring.prometheus_exporter import PrometheusExporter
# Setup metrics
metrics = MetricsCollector()
exporter = PrometheusExporter(metrics)
# Metrics endpoint
@app.route("/metrics")
async def metrics_endpoint(request):
return exporter.export()
🐛 Troubleshooting
Common Issues
Import Error:
# Solution: Install package
pip install covet[full]
Database Connection Error:
# Check connection parameters
adapter = PostgreSQLAdapter(
host='localhost', # Correct host?
port=5432, # Correct port?
database='myapp', # Database exists?
user='postgres', # Valid user?
password='secret' # Correct password?
)
Rust Extensions Not Loading:
# Fallback to pure Python (works fine, slightly slower)
from covet import CovetPy
app = CovetPy() # Automatically falls back if Rust unavailable
📄 License
Proprietary License
Copyright © 2025 Vipin Kumar. All rights reserved.
This software is proprietary and confidential. Unauthorized copying, distribution, or use is strictly prohibited.
👤 Author
Vipin Kumar
- GitHub: https://github.com/vipin08
- Documentation: https://github.com/vipin08/Covet-doc
🎯 Use Cases
Perfect For:
- High-performance REST APIs
- Real-time applications with WebSockets
- GraphQL backends
- Microservices architecture
- Full-stack web applications
- Data-intensive applications
- Enterprise backends
Key Benefits:
- Fast development with intuitive API
- Production-ready performance
- Comprehensive feature set
- Type-safe development
- Flexible deployment options
🚀 Get Started Now
# Install CovetPy
pip install covet[full]
# Create your first app
cat > app.py <<EOF
from covet import CovetPy
app = CovetPy()
@app.route("/")
async def hello(request):
return {"message": "Hello, CovetPy!"}
if __name__ == "__main__":
app.run()
EOF
# Run it
python app.py
Visit http://localhost:8000 and start building!
CovetPy - Build fast, scalable Python applications with Rust-powered performance.
Version: 0.1.0b3 (Beta) Status: Production-Ready Core, Beta Features
Metadata
Release files for covet 0.1.0b4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| covet-0.1.0b4-py3-none-any.whl | Python 3 | none | any | Details for covet-0.1.0b4-py3-none-any.whl |
Release files / covet-0.1.0b4-py3-none-any.whl
| Download URL | covet-0.1.0b4-py3-none-any.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
620b28f5fb47b6941e5bb9801b2093b6bbaf3e8804175aa3486e03d87135e082
|
|
BLAKE2b-256 checksum How to use checksums |
97743ac2169c57ebde6f1608e0ce81af3ddcc46b1488bbd608ff27a13c1f3217
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Security for covet 0.1.0b4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.