Metadata-Version: 2.4
Name: claude-on-django
Version: 0.2.0
Summary: Autonomous development framework for the Django-Bolt ecosystem
Project-URL: Homepage, https://github.com/beret/claude_on_django
Project-URL: Issues, https://github.com/beret/claude_on_django/issues
Author-email: Adam Mańczuk <beret@hipisi.org.pl>
License: MIT License
        
        Copyright (c) 2026 Adam Mańczuk
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: agents,ai,autonomous,claude,django,swarm
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.12
Requires-Dist: django>=4.2
Requires-Dist: djangorestframework-simplejwt>=5.3
Requires-Dist: djangorestframework-stubs<4.0.0,>=3.16.8
Requires-Dist: djangorestframework>=3.14
Requires-Dist: msgspec
Requires-Dist: pydantic-ai
Requires-Dist: pydantic>=2.0
Provides-Extra: dev
Requires-Dist: hatch; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# Claude-on-Django

An autonomous development framework that leverages AI agent teams for Django development. Developers describe what they want to build, and the swarm coordinates implementation across all Django layers automatically.

Ported from [claude-on-rails](https://github.com/obie/claude-on-rails) with full feature parity.

## How It Works

Claude-on-Django creates a team of specialized AI agents, each focused on a specific domain:

| Agent | Responsibility |
|-------|---------------|
| **Architect** | System design, coordination, project structure |
| **Modeler** | Django models, migrations, database optimization |
| **API Specialist** | REST API (DRF), JWT/OAuth authentication, serialization |
| **Views** | Templates, class-based views, UI (full-stack only) |
| **Services** | Business logic, service layer, design patterns |
| **QA Engineer** | Unit + integration tests, TDD, test coverage |
| **DevOps** | Docker, CI/CD, deployment, production config |
| **Tasks** | Celery, background jobs (when Celery detected) |

## Installation

```bash
pip install claude-on-django
```

Then initialize in your Django project:

```bash
python manage.py claude_swarm_init
```

This will:
- Analyze your project (detect DRF, Celery, GraphQL, HTMX, database, deployment)
- Generate agent prompts in `.claude-on-django/prompts/`
- Build a swarm topology matching your project features
- Create/update `CLAUDE.md` with project context

## Usage

### Natural Language Development

Describe what you want and the swarm handles implementation across all layers:

```bash
claude "Add user authentication with JWT and OAuth"
claude "Create a task management API with filtering and pagination"
claude "Optimize the dashboard queries for performance"
```

### Generate a Sandbox Project

Generate a complete example project with CRUD, JWT, OAuth, and full test coverage:

```bash
# Generates sandbox using Claude AI agents (requires ANTHROPIC_API_KEY with credits)
python manage.py claude_sandbox_generate --path examples/sandbox
```

The sandbox includes:
- User registration and profiles
- JWT authentication (SimpleJWT)
- OAuth login (Google, Apple)
- Project and Task CRUD with owner isolation
- Task filtering (status, priority, assignee)
- Task assignment and completion endpoints
- 23 unit tests (models, services, auth)
- 33 integration tests (all API endpoints, pagination, data isolation)

## Architecture

```
claude_on_django/
├── project_analyzer.py      # Detects Django project features
├── swarm_builder.py         # Generates agent topology from analysis
├── configuration.py         # Global settings with env var overrides
├── orchestrator/
│   ├── swarm.py             # SwarmOrchestrator (PydanticAI agents)
│   └── maintainer.py        # CLAUDE.md auto-updater
├── toolsets/
│   └── core.py              # Filesystem and command toolsets
├── mcp_server/
│   ├── structure.py         # MCP server for API metadata scanning
│   └── support.py           # MCP availability and installation
├── agents/                  # 8 agent system prompts (.md)
└── management/commands/
    ├── claude_swarm_init.py          # Project analysis + setup
    └── claude_sandbox_generate.py    # Sandbox project generator
```

### ProjectAnalyzer

Detects your Django project features:
- **Frameworks**: DRF, GraphQL (Graphene/Strawberry), HTMX, Channels
- **Background tasks**: Celery
- **Database**: PostgreSQL, MySQL, SQLite
- **Deployment**: Docker, Kubernetes, Heroku, Fly.io
- **Custom patterns**: services, serializers, permissions, middleware, signals

### SwarmBuilder

Generates a conditional agent topology based on analysis:
- API-only projects skip the Views agent
- Celery projects get a Tasks agent
- GraphQL projects get a GraphQL agent
- Architect connections are wired to all active agents

## Project Structure After Init

```
your-django-project/
├── CLAUDE.md                              # Project context for Claude
└── .claude-on-django/
    ├── context.md                         # Detected project features
    ├── sessions/                          # Agent session logs
    └── prompts/                           # Agent system prompts
        ├── architect.md
        ├── modeler.md
        ├── api_specialist.md
        ├── views.md
        ├── services.md
        ├── qa_engineer.md
        ├── devops.md
        └── tasks.md
```

## Configuration

### Environment Variables

```bash
# Required: Anthropic API key (for AI sandbox generation, the default)
ANTHROPIC_API_KEY=sk-ant-...

# Optional: Override the default model (default: anthropic:claude-sonnet-4-6)
CLAUDE_ON_DJANGO_MODEL=anthropic:claude-sonnet-4-6

# Optional: Enable experimental agent teams
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
```

### Python Configuration

```python
from claude_on_django import configure

configure(
    default_model="anthropic:claude-opus-4-6",
    vibe_mode=False,
    max_parallel_agents=3,
)
```

## Development

```bash
# Install dev dependencies
make dev-install

# Run package tests (21 tests)
make test

# Generate sandbox and run its tests (56 tests)
make sandbox-init
make sandbox-test

# Run swarm verification script
make sandbox-run

# Lint
make lint

# Build and publish
make build
make publish
```

## License

MIT License - see [LICENSE](LICENSE) for details.
