# EarnORM 🚀
[](https://www.python.org/downloads/)
[](LICENSE)
[](https://github.com/earnbase/earnorm)
> 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.
- [x] Core ORM functionality
- [x] MongoDB support
- [x] Connection pooling
- [x] 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
- [Getting Started](docs/getting-started.md)
- [User Guide](docs/user-guide.md)
- [API Reference](docs/api-reference.md)
- [Contributing Guide](CONTRIBUTING.md)
## 💡 Examples
### Basic Usage
```python
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
```python
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
```python
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
```python
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](CONTRIBUTING.md) 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](LICENSE) file for details.
## 📞 Contact
- GitHub: [@earnbase](https://github.com/earnbaseio)
- Email: contact@earnbase.io
- Twitter: [@earnbase](https://twitter.com/earnbaseio)
## 🙏 Credits
EarnORM is built with inspiration from:
- [Motor](https://motor.readthedocs.io/)
Special thanks to all our [contributors](https://github.com/tuanle96/earnorm/graphs/contributors)!
Raw data
{
"_id": null,
"home_page": "https://github.com/earnbase/earnorm",
"name": "earnorm",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": "orm, mongodb, async, database, earnbase",
"author": "EarnBase",
"author_email": "dev@earnbase.com",
"download_url": "https://files.pythonhosted.org/packages/11/97/ddde3c20d5ea00baa39d9c8b62bdbca4ad10a8ae778a965614017aec8b33/earnorm-0.1.4.tar.gz",
"platform": null,
"description": "# EarnORM \ud83d\ude80\n\n[](https://www.python.org/downloads/)\n[](LICENSE)\n[](https://github.com/earnbase/earnorm)\n\n> A powerful, async-first ORM framework for modern Python applications\n\n## \ud83d\udcd6 Description\n\nEarnORM 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.\n\n## \ud83c\udfd7\ufe0f Project Status\n\nCurrently in **Alpha** stage. Core features are implemented and working, but the API may change as we gather feedback and improve the framework.\n\n- [x] Core ORM functionality\n- [x] MongoDB support\n- [x] Connection pooling\n- [x] Type safety\n- [ ] PostgreSQL support (in progress)\n- [ ] MySQL support (planned)\n- [ ] Migration system (planned)\n- [ ] Admin interface (planned)\n\n## \u2728 Key Highlights\n\n- \ud83d\udd04 **Async/Await First**: Built from the ground up for asynchronous operations\n- \ud83d\udd12 **Type Safety**: Full type hints support with runtime validation\n- \ud83c\udfaf **Multiple Database Support**: MongoDB, PostgreSQL (coming soon), MySQL (planned)\n- \ud83c\udf1f **Modern Python**: Leverages latest Python features and best practices\n- \ud83d\udee0\ufe0f **Developer Friendly**: Intuitive API with excellent IDE support\n\n## \ud83c\udfaf Features\n\n### Core Features\n\n- **Async Operations**\n - Non-blocking database operations\n - Async connection pooling\n - Event-driven architecture\n\n- **Type System**\n - Runtime type checking\n - Custom type converters\n - Validation framework\n\n- **Connection Management**\n - Smart connection pooling\n - Automatic recovery\n - Health monitoring\n\n- **Model System**\n - Declarative models\n - Field validation\n - Relationship management\n - Event hooks\n\n### Advanced Features\n\n- **Query Building**\n - Type-safe queries\n - Complex filters\n - Aggregations\n - Joins\n\n- **Transaction Support**\n - ACID compliance\n - Nested transactions\n - Savepoints\n - Automatic rollback\n\n## \ud83d\udcda Documentation\n\n- [Getting Started](docs/getting-started.md)\n- [User Guide](docs/user-guide.md)\n- [API Reference](docs/api-reference.md)\n- [Contributing Guide](CONTRIBUTING.md)\n\n## \ud83d\udca1 Examples\n\n### Basic Usage\n\n```python\nfrom earnorm.base import BaseModel\nfrom earnorm.fields import StringField, IntegerField\n\nclass User(BaseModel):\n _name = 'data.user'\n name = StringField(required=True)\n age = IntegerField()\n\n async def validate(self):\n if self.age < 0:\n raise ValueError(\"Age cannot be negative\")\n\n# Create record\nuser = await User.create({\n \"name\": \"John Doe\",\n \"age\": 30\n})\n\n# Query records\nusers = await User.search([\n (\"age\", \">=\", 18),\n (\"name\", \"like\", \"John%\")\n])\n```\n\n### FastAPI Integration with Lifecycle\n\n```python\nfrom fastapi import FastAPI\nfrom earnorm.config import SystemConfig\nfrom earnorm.di import container\n\napp = FastAPI()\n\n@app.on_event(\"startup\")\nasync def startup():\n # Load config\n config = SystemConfig.load_env(\".env\")\n \n # Initialize container\n await container.init(config)\n \n # Register services\n container.register(\"config\", config)\n\n@app.on_event(\"shutdown\")\nasync def shutdown():\n await container.destroy()\n\n@app.get(\"/users/{user_id}\")\nasync def get_user(user_id: str):\n User = await container.get_model(\"data.user\")\n return await User.read(user_id)\n```\n\n### Django Integration\n\n```python\nfrom django.apps import AppConfig\nfrom earnorm.config import SystemConfig\nfrom earnorm.di import container\n\nclass MyAppConfig(AppConfig):\n name = 'myapp'\n \n async def ready(self):\n # Initialize EarnORM\n config = SystemConfig.load_env(\".env\")\n await container.init(config)\n```\n\n### Flask Integration\n\n```python\nfrom flask import Flask\nfrom earnorm.config import SystemConfig\nfrom earnorm.di import container\n\napp = Flask(__name__)\n\n@app.before_first_request\nasync def init_earnorm():\n config = SystemConfig.load_env(\".env\")\n await container.init(config)\n\n@app.teardown_appcontext\nasync def shutdown_earnorm(exception=None):\n await container.destroy()\n```\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n1. Fork the repository\n2. Create your feature branch\n3. Add tests for new features\n4. Submit a pull request\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\udcde Contact\n\n- GitHub: [@earnbase](https://github.com/earnbaseio)\n- Email: contact@earnbase.io\n- Twitter: [@earnbase](https://twitter.com/earnbaseio)\n\n## \ud83d\ude4f Credits\n\nEarnORM is built with inspiration from:\n- [Motor](https://motor.readthedocs.io/)\n\nSpecial thanks to all our [contributors](https://github.com/tuanle96/earnorm/graphs/contributors)!\n",
"bugtrack_url": null,
"license": null,
"summary": "EarnBase ORM - Async-first ORM for MongoDB and more",
"version": "0.1.4",
"project_urls": {
"Documentation": "https://earnorm.readthedocs.io",
"Homepage": "https://github.com/earnbase/earnorm",
"Repository": "https://github.com/earnbase/earnorm"
},
"split_keywords": [
"orm",
" mongodb",
" async",
" database",
" earnbase"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ef248124c919c910ff593d08e2675d6da25588bb1487817274443e23e2faf7b9",
"md5": "df11ce3cb1def9e88a046016a6a9862c",
"sha256": "03c23ea560f755358c34a75119945ed2036303414bae18045a051f85b3817298"
},
"downloads": -1,
"filename": "earnorm-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "df11ce3cb1def9e88a046016a6a9862c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 310352,
"upload_time": "2025-02-12T07:08:02",
"upload_time_iso_8601": "2025-02-12T07:08:02.853444Z",
"url": "https://files.pythonhosted.org/packages/ef/24/8124c919c910ff593d08e2675d6da25588bb1487817274443e23e2faf7b9/earnorm-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1197ddde3c20d5ea00baa39d9c8b62bdbca4ad10a8ae778a965614017aec8b33",
"md5": "e7febd7a112024e414e52bd125208dbc",
"sha256": "64a2d5b38e6cd3657f3b02ff2f8c3452dd052e1c866964ab4b3f9860c851d430"
},
"downloads": -1,
"filename": "earnorm-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "e7febd7a112024e414e52bd125208dbc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 199752,
"upload_time": "2025-02-12T07:08:04",
"upload_time_iso_8601": "2025-02-12T07:08:04.911872Z",
"url": "https://files.pythonhosted.org/packages/11/97/ddde3c20d5ea00baa39d9c8b62bdbca4ad10a8ae778a965614017aec8b33/earnorm-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-12 07:08:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "earnbase",
"github_project": "earnorm",
"github_not_found": true,
"lcname": "earnorm"
}