Skip to main content

EarnORM 🚀

Python License Status

A powerful, async-first ORM framework for modern Python applications

📖 Description

EarnORM is a modern, async-first Object-Relational Mapping (ORM) framework designed to provide a flexible and type-safe interface for database operations in Python applications. Built with performance and developer experience in mind, it offers seamless integration with multiple databases and modern Python features.

🏗️ Project Status

Currently in Alpha stage. Core features are implemented and working, but the API may change as we gather feedback and improve the framework.

  • Core ORM functionality
  • MongoDB support
  • Connection pooling
  • Type safety
  • PostgreSQL support (in progress)
  • MySQL support (planned)
  • Migration system (planned)
  • Admin interface (planned)

✨ Key Highlights

  • 🔄 Async/Await First: Built from the ground up for asynchronous operations
  • 🔒 Type Safety: Full type hints support with runtime validation
  • 🎯 Multiple Database Support: MongoDB, PostgreSQL (coming soon), MySQL (planned)
  • 🌟 Modern Python: Leverages latest Python features and best practices
  • 🛠️ Developer Friendly: Intuitive API with excellent IDE support

🎯 Features

Core Features

  • Async Operations

    • Non-blocking database operations
    • Async connection pooling
    • Event-driven architecture
  • Type System

    • Runtime type checking
    • Custom type converters
    • Validation framework
  • Connection Management

    • Smart connection pooling
    • Automatic recovery
    • Health monitoring
  • Model System

    • Declarative models
    • Field validation
    • Relationship management
    • Event hooks

Advanced Features

  • Query Building

    • Type-safe queries
    • Complex filters
    • Aggregations
    • Joins
  • Transaction Support

    • ACID compliance
    • Nested transactions
    • Savepoints
    • Automatic rollback

📚 Documentation

💡 Examples

Basic Usage

from earnorm.base import BaseModel
from earnorm.fields import StringField, IntegerField

class User(BaseModel):
    _name = 'data.user'
    name = StringField(required=True)
    age = IntegerField()

    async def validate(self):
        if self.age < 0:
            raise ValueError("Age cannot be negative")

# Create record
user = await User.create({
    "name": "John Doe",
    "age": 30
})

# Query records
users = await User.search([
    ("age", ">=", 18),
    ("name", "like", "John%")
])

FastAPI Integration with Lifecycle

from fastapi import FastAPI
from earnorm.config import SystemConfig
from earnorm.di import container

app = FastAPI()

@app.on_event("startup")
async def startup():
    # Load config
    config = SystemConfig.load_env(".env")
    
    # Initialize container
    await container.init(config)
    
    # Register services
    container.register("config", config)

@app.on_event("shutdown")
async def shutdown():
    await container.destroy()

@app.get("/users/{user_id}")
async def get_user(user_id: str):
    User = await container.get_model("data.user")
    return await User.read(user_id)

Django Integration

from django.apps import AppConfig
from earnorm.config import SystemConfig
from earnorm.di import container

class MyAppConfig(AppConfig):
    name = 'myapp'
    
    async def ready(self):
        # Initialize EarnORM
        config = SystemConfig.load_env(".env")
        await container.init(config)

Flask Integration

from flask import Flask
from earnorm.config import SystemConfig
from earnorm.di import container

app = Flask(__name__)

@app.before_first_request
async def init_earnorm():
    config = SystemConfig.load_env(".env")
    await container.init(config)

@app.teardown_appcontext
async def shutdown_earnorm(exception=None):
    await container.destroy()

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch
  3. Add tests for new features
  4. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📞 Contact

🙏 Credits

EarnORM is built with inspiration from:

Special thanks to all our contributors!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

earnorm-0.1.4.tar.gz (199.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

earnorm-0.1.4-py3-none-any.whl (310.4 kB view details)

Uploaded Python 3

File details

Details for the file earnorm-0.1.4.tar.gz.

File metadata

  • Download URL: earnorm-0.1.4.tar.gz
  • Upload date:
  • Size: 199.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.10.16 Linux/6.8.0-49-generic

File hashes

Hashes for earnorm-0.1.4.tar.gz
Algorithm Hash digest
SHA256 64a2d5b38e6cd3657f3b02ff2f8c3452dd052e1c866964ab4b3f9860c851d430
MD5 e7febd7a112024e414e52bd125208dbc
BLAKE2b-256 1197ddde3c20d5ea00baa39d9c8b62bdbca4ad10a8ae778a965614017aec8b33

See more details on using hashes here.

File details

Details for the file earnorm-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: earnorm-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 310.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.10.16 Linux/6.8.0-49-generic

File hashes

Hashes for earnorm-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 03c23ea560f755358c34a75119945ed2036303414bae18045a051f85b3817298
MD5 df11ce3cb1def9e88a046016a6a9862c
BLAKE2b-256 ef248124c919c910ff593d08e2675d6da25588bb1487817274443e23e2faf7b9

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page