maweng


Namemaweng JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
SummaryA lightweight, modern Python web framework with ORM and auto-generated API docs
upload_time2025-08-07 10:10:55
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords web framework api orm fastapi django flask
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Maweng Framework

A lightweight, modern Python web framework designed for building scalable backend systems with ease. Maweng combines the simplicity of Flask with the power of FastAPI, featuring an intuitive ORM, auto-generated API documentation, and developer-friendly tooling.

## 🚀 Features

- **Lightning Fast**: Built on top of FastAPI and Uvicorn for exceptional performance
- **Intuitive ORM**: SQLAlchemy-based ORM with automatic migrations
- **Auto-Generated API Docs**: OpenAPI/Swagger documentation out of the box
- **Type Safety**: Full type hints and Pydantic integration
- **Dependency Injection**: Clean architecture with built-in DI container
- **CLI Tools**: Project scaffolding and management utilities
- **Testing Framework**: Built-in testing utilities and fixtures
- **Modern Python**: Python 3.8+ with async/await support

## 📦 Installation

```bash
# Install from PyPI (when available)
pip install maweng

# Or install from source
git clone https://github.com/maweng/framework.git
cd framework
pip install -e .
```

## 🎯 Quick Start

### 1. Create a New Project

```bash
maweng new myapp
cd myapp
```

### 2. Define Your Models

```python
# models.py
from maweng.orm import Model, Field
from datetime import datetime

class User(Model):
    __tablename__ = "users"
    
    id = Field.Integer(primary_key=True)
    email = Field.String(unique=True, max_length=255)
    name = Field.String(max_length=100)
    created_at = Field.DateTime(default=datetime.utcnow)
    is_active = Field.Boolean(default=True)
```

### 3. Create Your Views

```python
# views.py
from maweng import View, Response
from maweng.orm import query
from .models import User

class UserView(View):
    @query.get("/users")
    async def list_users(self):
        users = await User.all()
        return Response.json(users)
    
    @query.post("/users")
    async def create_user(self, user_data: dict):
        user = await User.create(**user_data)
        return Response.json(user, status=201)
    
    @query.get("/users/{user_id}")
    async def get_user(self, user_id: int):
        user = await User.get(user_id)
        if not user:
            return Response.json({"error": "User not found"}, status=404)
        return Response.json(user)
```

### 4. Run Your Application

```bash
maweng run
```

Visit `http://localhost:8000/docs` to see your auto-generated API documentation!

## 🏗️ Project Structure

```
myapp/
├── app/
│   ├── __init__.py
│   ├── models.py          # Database models
│   ├── views.py           # API endpoints
│   ├── services.py        # Business logic
│   └── middleware.py      # Custom middleware
├── migrations/            # Database migrations
├── tests/                 # Test files
├── static/               # Static files
├── templates/            # HTML templates
├── config.py             # Configuration
└── main.py              # Application entry point
```

## 🔧 Configuration

```python
# config.py
from maweng.config import Config

class DevelopmentConfig(Config):
    DEBUG = True
    DATABASE_URL = "sqlite:///./dev.db"
    SECRET_KEY = "your-secret-key"
    
class ProductionConfig(Config):
    DEBUG = False
    DATABASE_URL = "postgresql://user:pass@localhost/db"
    SECRET_KEY = "your-production-secret"
```

## 🗄️ ORM Usage

### Basic CRUD Operations

```python
# Create
user = await User.create(name="John Doe", email="john@example.com")

# Read
user = await User.get(1)
users = await User.filter(is_active=True)
all_users = await User.all()

# Update
await user.update(name="Jane Doe")
# or
await User.filter(id=1).update(name="Jane Doe")

# Delete
await user.delete()
# or
await User.filter(id=1).delete()
```

### Relationships

```python
class Post(Model):
    __tablename__ = "posts"
    
    id = Field.Integer(primary_key=True)
    title = Field.String(max_length=200)
    content = Field.Text()
    author_id = Field.Integer(foreign_key="users.id")
    
    # Define relationship
    author = Relationship("User", back_populates="posts")

class User(Model):
    # ... existing fields ...
    posts = Relationship("Post", back_populates="author")
```

## 🧪 Testing

```python
# tests/test_users.py
import pytest
from maweng.testing import TestClient
from app.models import User

@pytest.mark.asyncio
async def test_create_user():
    client = TestClient()
    
    response = await client.post("/users", json={
        "name": "Test User",
        "email": "test@example.com"
    })
    
    assert response.status_code == 201
    assert response.json()["name"] == "Test User"
```

## 📚 Documentation

- [Getting Started Guide](https://maweng.dev/getting-started)
- [API Reference](https://maweng.dev/api)
- [ORM Documentation](https://maweng.dev/orm)
- [Testing Guide](https://maweng.dev/testing)
- [Deployment Guide](https://maweng.dev/deployment)

## 🤝 Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🆚 Comparison with Other Frameworks

| Feature | Maweng | FastAPI | Django | Flask |
|---------|--------|---------|--------|-------|
| Performance | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ |
| Ease of Use | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ |
| ORM | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ |
| Auto Docs | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ | ⭐ |
| Type Safety | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ |
| Learning Curve | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐ |

## 🚀 Roadmap

- [ ] GraphQL support
- [ ] WebSocket support
- [ ] Background task queue
- [ ] Admin interface
- [ ] Plugin system
- [ ] Microservices support
- [ ] Kubernetes deployment tools

---

Built with ❤️ by Paul Ndambo 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "maweng",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "web, framework, api, orm, fastapi, django, flask",
    "author": null,
    "author_email": "Paul Ndambo <paulkadabo@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/cd/f8/4866a51325b255331d292badbed2275639271cb2c7f9313b89180ca61ecd/maweng-0.2.2.tar.gz",
    "platform": null,
    "description": "# Maweng Framework\n\nA lightweight, modern Python web framework designed for building scalable backend systems with ease. Maweng combines the simplicity of Flask with the power of FastAPI, featuring an intuitive ORM, auto-generated API documentation, and developer-friendly tooling.\n\n## \ud83d\ude80 Features\n\n- **Lightning Fast**: Built on top of FastAPI and Uvicorn for exceptional performance\n- **Intuitive ORM**: SQLAlchemy-based ORM with automatic migrations\n- **Auto-Generated API Docs**: OpenAPI/Swagger documentation out of the box\n- **Type Safety**: Full type hints and Pydantic integration\n- **Dependency Injection**: Clean architecture with built-in DI container\n- **CLI Tools**: Project scaffolding and management utilities\n- **Testing Framework**: Built-in testing utilities and fixtures\n- **Modern Python**: Python 3.8+ with async/await support\n\n## \ud83d\udce6 Installation\n\n```bash\n# Install from PyPI (when available)\npip install maweng\n\n# Or install from source\ngit clone https://github.com/maweng/framework.git\ncd framework\npip install -e .\n```\n\n## \ud83c\udfaf Quick Start\n\n### 1. Create a New Project\n\n```bash\nmaweng new myapp\ncd myapp\n```\n\n### 2. Define Your Models\n\n```python\n# models.py\nfrom maweng.orm import Model, Field\nfrom datetime import datetime\n\nclass User(Model):\n    __tablename__ = \"users\"\n    \n    id = Field.Integer(primary_key=True)\n    email = Field.String(unique=True, max_length=255)\n    name = Field.String(max_length=100)\n    created_at = Field.DateTime(default=datetime.utcnow)\n    is_active = Field.Boolean(default=True)\n```\n\n### 3. Create Your Views\n\n```python\n# views.py\nfrom maweng import View, Response\nfrom maweng.orm import query\nfrom .models import User\n\nclass UserView(View):\n    @query.get(\"/users\")\n    async def list_users(self):\n        users = await User.all()\n        return Response.json(users)\n    \n    @query.post(\"/users\")\n    async def create_user(self, user_data: dict):\n        user = await User.create(**user_data)\n        return Response.json(user, status=201)\n    \n    @query.get(\"/users/{user_id}\")\n    async def get_user(self, user_id: int):\n        user = await User.get(user_id)\n        if not user:\n            return Response.json({\"error\": \"User not found\"}, status=404)\n        return Response.json(user)\n```\n\n### 4. Run Your Application\n\n```bash\nmaweng run\n```\n\nVisit `http://localhost:8000/docs` to see your auto-generated API documentation!\n\n## \ud83c\udfd7\ufe0f Project Structure\n\n```\nmyapp/\n\u251c\u2500\u2500 app/\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 models.py          # Database models\n\u2502   \u251c\u2500\u2500 views.py           # API endpoints\n\u2502   \u251c\u2500\u2500 services.py        # Business logic\n\u2502   \u2514\u2500\u2500 middleware.py      # Custom middleware\n\u251c\u2500\u2500 migrations/            # Database migrations\n\u251c\u2500\u2500 tests/                 # Test files\n\u251c\u2500\u2500 static/               # Static files\n\u251c\u2500\u2500 templates/            # HTML templates\n\u251c\u2500\u2500 config.py             # Configuration\n\u2514\u2500\u2500 main.py              # Application entry point\n```\n\n## \ud83d\udd27 Configuration\n\n```python\n# config.py\nfrom maweng.config import Config\n\nclass DevelopmentConfig(Config):\n    DEBUG = True\n    DATABASE_URL = \"sqlite:///./dev.db\"\n    SECRET_KEY = \"your-secret-key\"\n    \nclass ProductionConfig(Config):\n    DEBUG = False\n    DATABASE_URL = \"postgresql://user:pass@localhost/db\"\n    SECRET_KEY = \"your-production-secret\"\n```\n\n## \ud83d\uddc4\ufe0f ORM Usage\n\n### Basic CRUD Operations\n\n```python\n# Create\nuser = await User.create(name=\"John Doe\", email=\"john@example.com\")\n\n# Read\nuser = await User.get(1)\nusers = await User.filter(is_active=True)\nall_users = await User.all()\n\n# Update\nawait user.update(name=\"Jane Doe\")\n# or\nawait User.filter(id=1).update(name=\"Jane Doe\")\n\n# Delete\nawait user.delete()\n# or\nawait User.filter(id=1).delete()\n```\n\n### Relationships\n\n```python\nclass Post(Model):\n    __tablename__ = \"posts\"\n    \n    id = Field.Integer(primary_key=True)\n    title = Field.String(max_length=200)\n    content = Field.Text()\n    author_id = Field.Integer(foreign_key=\"users.id\")\n    \n    # Define relationship\n    author = Relationship(\"User\", back_populates=\"posts\")\n\nclass User(Model):\n    # ... existing fields ...\n    posts = Relationship(\"Post\", back_populates=\"author\")\n```\n\n## \ud83e\uddea Testing\n\n```python\n# tests/test_users.py\nimport pytest\nfrom maweng.testing import TestClient\nfrom app.models import User\n\n@pytest.mark.asyncio\nasync def test_create_user():\n    client = TestClient()\n    \n    response = await client.post(\"/users\", json={\n        \"name\": \"Test User\",\n        \"email\": \"test@example.com\"\n    })\n    \n    assert response.status_code == 201\n    assert response.json()[\"name\"] == \"Test User\"\n```\n\n## \ud83d\udcda Documentation\n\n- [Getting Started Guide](https://maweng.dev/getting-started)\n- [API Reference](https://maweng.dev/api)\n- [ORM Documentation](https://maweng.dev/orm)\n- [Testing Guide](https://maweng.dev/testing)\n- [Deployment Guide](https://maweng.dev/deployment)\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83c\udd9a Comparison with Other Frameworks\n\n| Feature | Maweng | FastAPI | Django | Flask |\n|---------|--------|---------|--------|-------|\n| Performance | \u2b50\u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50 |\n| Ease of Use | \u2b50\u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50\u2b50 |\n| ORM | \u2b50\u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50 |\n| Auto Docs | \u2b50\u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50 | \u2b50 |\n| Type Safety | \u2b50\u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50 | \u2b50\u2b50 |\n| Learning Curve | \u2b50\u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50\u2b50\u2b50 | \u2b50\u2b50 | \u2b50\u2b50\u2b50\u2b50 |\n\n## \ud83d\ude80 Roadmap\n\n- [ ] GraphQL support\n- [ ] WebSocket support\n- [ ] Background task queue\n- [ ] Admin interface\n- [ ] Plugin system\n- [ ] Microservices support\n- [ ] Kubernetes deployment tools\n\n---\n\nBuilt with \u2764\ufe0f by Paul Ndambo \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A lightweight, modern Python web framework with ORM and auto-generated API docs",
    "version": "0.2.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/maweng/framework/issues",
        "Documentation": "https://maweng.dev",
        "Homepage": "https://github.com/maweng/framework",
        "Repository": "https://github.com/maweng/framework"
    },
    "split_keywords": [
        "web",
        " framework",
        " api",
        " orm",
        " fastapi",
        " django",
        " flask"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e79aad889fe8adf7357975d4a20688566aaf43c61474ef8c12f7ca8ae7d29b4b",
                "md5": "03ece0e57b5c05d6a7eadb713f2a2532",
                "sha256": "097df28735c68e42b82f595bd7db8f5676472550f2ec1bb15b51a64bd43cd30a"
            },
            "downloads": -1,
            "filename": "maweng-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "03ece0e57b5c05d6a7eadb713f2a2532",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 53246,
            "upload_time": "2025-08-07T10:10:54",
            "upload_time_iso_8601": "2025-08-07T10:10:54.846377Z",
            "url": "https://files.pythonhosted.org/packages/e7/9a/ad889fe8adf7357975d4a20688566aaf43c61474ef8c12f7ca8ae7d29b4b/maweng-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cdf84866a51325b255331d292badbed2275639271cb2c7f9313b89180ca61ecd",
                "md5": "0874f64990bb245568b47cb1fee615ab",
                "sha256": "a0160f59838f0e6922809ab25f2e70fa12e45ba57d460b16e78b9e0214af2c79"
            },
            "downloads": -1,
            "filename": "maweng-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0874f64990bb245568b47cb1fee615ab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 48157,
            "upload_time": "2025-08-07T10:10:55",
            "upload_time_iso_8601": "2025-08-07T10:10:55.827974Z",
            "url": "https://files.pythonhosted.org/packages/cd/f8/4866a51325b255331d292badbed2275639271cb2c7f9313b89180ca61ecd/maweng-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-07 10:10:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "maweng",
    "github_project": "framework",
    "github_not_found": true,
    "lcname": "maweng"
}
        
Elapsed time: 0.59899s