neutronapi-test-aaron


Nameneutronapi-test-aaron JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryHigh-performance Python framework built directly on uvicorn with built-in database models, migrations, and background tasks. Django that was built async-first.
upload_time2025-08-19 20:47:02
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords api framework async django fastapi uvicorn orm migrations background-tasks
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NeutronAPI

**High-performance Python framework built directly on uvicorn with built-in database models, migrations, and background tasks. If you want Django that was built async-first, this is for you.**

Batteries included async API framework with command-line management.

## Installation

```bash
pip install neutronapi
```

## Quick Start

```bash
# 1. Create project
neutronapi startproject blog
cd blog

# 2. Create an app
python manage.py startapp posts

# 3. Start server  
python manage.py start               # Dev mode (auto-reload)

# 4. Test
python manage.py test
```

## Getting Started Tutorial

**1. Create Project**
```bash
neutronapi startproject blog
cd blog
```

**2. Create App Module**  
```bash
python manage.py startapp posts
```

**3. Configure in `apps/settings.py`**
```python
import os

# ASGI application entry point (required for server)
ENTRY = "apps.entry:app"  # module:variable format

# Database
DATABASES = {
    'default': {
        'ENGINE': 'aiosqlite',
        'NAME': 'db.sqlite3',
    }
}
```

**4. Create API in `apps/posts/api.py`**
```python
from neutronapi.base import API

class PostAPI(API):
    name = "posts"
    
    @API.endpoint("/posts", methods=["GET"])
    async def list_posts(self, scope, receive, send, **kwargs):
        posts = [{"id": 1, "title": "Hello World"}]
        return await self.response(posts)
    
    @API.endpoint("/posts", methods=["POST"])
    async def create_post(self, scope, receive, send, **kwargs):
        # Get request data from scope["body"]
        return await self.response({"id": 2, "title": "New Post"})
```

**5. Register API in `apps/entry.py`**
```python
from neutronapi.application import Application
from apps.posts.api import PostAPI

app = Application({
    "posts": PostAPI()
})
```

**6. Start Server**
```bash
python manage.py start
# Visit: http://127.0.0.1:8000/posts
```

## Project Structure

```
myproject/
├── manage.py           # Management commands
├── apps/
│   ├── __init__.py
│   ├── settings.py     # Configuration 
│   └── entry.py        # ASGI application
└── db.sqlite3          # Database
```

## Background Tasks

```python
from neutronapi.background import Task, TaskFrequency

class CleanupTask(Task):
    name = "cleanup"
    frequency = TaskFrequency.MINUTELY
    
    async def run(self, **kwargs):
        print("Cleaning up logs...")

# Add to application
app = Application(
    apis={"ping": PingAPI()},
    tasks={"cleanup": CleanupTask()}
)

## Database Models

```python
from neutronapi.db.models import Model
from neutronapi.db.fields import CharField, IntegerField, DateTimeField

class User(Model):
    name = CharField(max_length=100)
    age = IntegerField()
    created_at = DateTimeField(auto_now_add=True)
    
    # Table name inferred from class name (user -> users)
```

## Server Commands

```bash
# Development (auto-reload, localhost)
python manage.py start

# Production (multi-worker, optimized)  
python manage.py start --production

# Custom configuration
python manage.py start --host 0.0.0.0 --port 8080 --workers 4
```

## Testing

```bash
# SQLite (default)
python manage.py test

# PostgreSQL (auto Docker bootstrap)
DATABASE_PROVIDER=asyncpg python manage.py test

# Specific tests
python manage.py test app.tests.test_models.TestUser.test_creation
```

## Commands

```bash
python manage.py start              # Start server
python manage.py test               # Run tests  
python manage.py migrate            # Run migrations
python manage.py startapp posts     # Create new app
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "neutronapi-test-aaron",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "api, framework, async, django, fastapi, uvicorn, orm, migrations, background-tasks",
    "author": null,
    "author_email": "Aaron Kazah <aaron@neutronapi.com>",
    "download_url": "https://files.pythonhosted.org/packages/aa/0c/f832a7db50d01175b572e846f3c757fec7891f6504211a0aaa337ddcde1f/neutronapi_test_aaron-0.1.0.tar.gz",
    "platform": null,
    "description": "# NeutronAPI\n\n**High-performance Python framework built directly on uvicorn with built-in database models, migrations, and background tasks. If you want Django that was built async-first, this is for you.**\n\nBatteries included async API framework with command-line management.\n\n## Installation\n\n```bash\npip install neutronapi\n```\n\n## Quick Start\n\n```bash\n# 1. Create project\nneutronapi startproject blog\ncd blog\n\n# 2. Create an app\npython manage.py startapp posts\n\n# 3. Start server  \npython manage.py start               # Dev mode (auto-reload)\n\n# 4. Test\npython manage.py test\n```\n\n## Getting Started Tutorial\n\n**1. Create Project**\n```bash\nneutronapi startproject blog\ncd blog\n```\n\n**2. Create App Module**  \n```bash\npython manage.py startapp posts\n```\n\n**3. Configure in `apps/settings.py`**\n```python\nimport os\n\n# ASGI application entry point (required for server)\nENTRY = \"apps.entry:app\"  # module:variable format\n\n# Database\nDATABASES = {\n    'default': {\n        'ENGINE': 'aiosqlite',\n        'NAME': 'db.sqlite3',\n    }\n}\n```\n\n**4. Create API in `apps/posts/api.py`**\n```python\nfrom neutronapi.base import API\n\nclass PostAPI(API):\n    name = \"posts\"\n    \n    @API.endpoint(\"/posts\", methods=[\"GET\"])\n    async def list_posts(self, scope, receive, send, **kwargs):\n        posts = [{\"id\": 1, \"title\": \"Hello World\"}]\n        return await self.response(posts)\n    \n    @API.endpoint(\"/posts\", methods=[\"POST\"])\n    async def create_post(self, scope, receive, send, **kwargs):\n        # Get request data from scope[\"body\"]\n        return await self.response({\"id\": 2, \"title\": \"New Post\"})\n```\n\n**5. Register API in `apps/entry.py`**\n```python\nfrom neutronapi.application import Application\nfrom apps.posts.api import PostAPI\n\napp = Application({\n    \"posts\": PostAPI()\n})\n```\n\n**6. Start Server**\n```bash\npython manage.py start\n# Visit: http://127.0.0.1:8000/posts\n```\n\n## Project Structure\n\n```\nmyproject/\n\u251c\u2500\u2500 manage.py           # Management commands\n\u251c\u2500\u2500 apps/\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 settings.py     # Configuration \n\u2502   \u2514\u2500\u2500 entry.py        # ASGI application\n\u2514\u2500\u2500 db.sqlite3          # Database\n```\n\n## Background Tasks\n\n```python\nfrom neutronapi.background import Task, TaskFrequency\n\nclass CleanupTask(Task):\n    name = \"cleanup\"\n    frequency = TaskFrequency.MINUTELY\n    \n    async def run(self, **kwargs):\n        print(\"Cleaning up logs...\")\n\n# Add to application\napp = Application(\n    apis={\"ping\": PingAPI()},\n    tasks={\"cleanup\": CleanupTask()}\n)\n\n## Database Models\n\n```python\nfrom neutronapi.db.models import Model\nfrom neutronapi.db.fields import CharField, IntegerField, DateTimeField\n\nclass User(Model):\n    name = CharField(max_length=100)\n    age = IntegerField()\n    created_at = DateTimeField(auto_now_add=True)\n    \n    # Table name inferred from class name (user -> users)\n```\n\n## Server Commands\n\n```bash\n# Development (auto-reload, localhost)\npython manage.py start\n\n# Production (multi-worker, optimized)  \npython manage.py start --production\n\n# Custom configuration\npython manage.py start --host 0.0.0.0 --port 8080 --workers 4\n```\n\n## Testing\n\n```bash\n# SQLite (default)\npython manage.py test\n\n# PostgreSQL (auto Docker bootstrap)\nDATABASE_PROVIDER=asyncpg python manage.py test\n\n# Specific tests\npython manage.py test app.tests.test_models.TestUser.test_creation\n```\n\n## Commands\n\n```bash\npython manage.py start              # Start server\npython manage.py test               # Run tests  \npython manage.py migrate            # Run migrations\npython manage.py startapp posts     # Create new app\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "High-performance Python framework built directly on uvicorn with built-in database models, migrations, and background tasks. Django that was built async-first.",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "api",
        " framework",
        " async",
        " django",
        " fastapi",
        " uvicorn",
        " orm",
        " migrations",
        " background-tasks"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bfe6419251849bdaca8936ba86ae133786f9e8ce97d65baa4a55da0188b7a189",
                "md5": "e210fd8136c9ddb62c1bebc3850affb3",
                "sha256": "6ce45be20f296ccef7e991f0d8f45c94fdb4af5b357e28abf4708debb53ed3ba"
            },
            "downloads": -1,
            "filename": "neutronapi_test_aaron-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e210fd8136c9ddb62c1bebc3850affb3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 86687,
            "upload_time": "2025-08-19T20:46:59",
            "upload_time_iso_8601": "2025-08-19T20:46:59.414986Z",
            "url": "https://files.pythonhosted.org/packages/bf/e6/419251849bdaca8936ba86ae133786f9e8ce97d65baa4a55da0188b7a189/neutronapi_test_aaron-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "aa0cf832a7db50d01175b572e846f3c757fec7891f6504211a0aaa337ddcde1f",
                "md5": "56e95c1dfb01d50ef44c271f87c74585",
                "sha256": "fc20a2e9f6f0028423ba6af67c6469b668713c3ff190b82a3cc121720375012c"
            },
            "downloads": -1,
            "filename": "neutronapi_test_aaron-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "56e95c1dfb01d50ef44c271f87c74585",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 75095,
            "upload_time": "2025-08-19T20:47:02",
            "upload_time_iso_8601": "2025-08-19T20:47:02.174432Z",
            "url": "https://files.pythonhosted.org/packages/aa/0c/f832a7db50d01175b572e846f3c757fec7891f6504211a0aaa337ddcde1f/neutronapi_test_aaron-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 20:47:02",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "neutronapi-test-aaron"
}
        
Elapsed time: 0.41072s