shakti-framework 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shakti_framework-0.1.0/.gitignore +58 -0
- shakti_framework-0.1.0/LICENSE +21 -0
- shakti_framework-0.1.0/PKG-INFO +234 -0
- shakti_framework-0.1.0/README.md +175 -0
- shakti_framework-0.1.0/docs/admin.md +46 -0
- shakti_framework-0.1.0/docs/ai/agents.md +3 -0
- shakti_framework-0.1.0/docs/ai/chat.md +3 -0
- shakti_framework-0.1.0/docs/ai/overview.md +3 -0
- shakti_framework-0.1.0/docs/ai/rag.md +3 -0
- shakti_framework-0.1.0/docs/ai/streaming.md +3 -0
- shakti_framework-0.1.0/docs/ai/templates.md +3 -0
- shakti_framework-0.1.0/docs/auth/api-keys.md +3 -0
- shakti_framework-0.1.0/docs/auth/jwt.md +3 -0
- shakti_framework-0.1.0/docs/auth/rbac.md +3 -0
- shakti_framework-0.1.0/docs/cli.md +3 -0
- shakti_framework-0.1.0/docs/core/config.md +3 -0
- shakti_framework-0.1.0/docs/core/di.md +3 -0
- shakti_framework-0.1.0/docs/core/middleware.md +3 -0
- shakti_framework-0.1.0/docs/core/request-response.md +3 -0
- shakti_framework-0.1.0/docs/core/routing.md +3 -0
- shakti_framework-0.1.0/docs/deployment.md +3 -0
- shakti_framework-0.1.0/docs/document-ai.md +3 -0
- shakti_framework-0.1.0/docs/getting-started/first-app.md +3 -0
- shakti_framework-0.1.0/docs/getting-started/installation.md +27 -0
- shakti_framework-0.1.0/docs/getting-started/quickstart.md +52 -0
- shakti_framework-0.1.0/docs/index.md +109 -0
- shakti_framework-0.1.0/docs/monitoring.md +50 -0
- shakti_framework-0.1.0/docs/orm/codegen.md +3 -0
- shakti_framework-0.1.0/docs/orm/database.md +3 -0
- shakti_framework-0.1.0/docs/orm/migrations.md +3 -0
- shakti_framework-0.1.0/docs/orm/models.md +3 -0
- shakti_framework-0.1.0/docs/orm/repository.md +3 -0
- shakti_framework-0.1.0/docs/phase-1-core.md +148 -0
- shakti_framework-0.1.0/docs/websockets.md +83 -0
- shakti_framework-0.1.0/docs/workflows.md +3 -0
- shakti_framework-0.1.0/examples/demo_app/README.md +41 -0
- shakti_framework-0.1.0/examples/demo_app/app/models/__init__.py +1 -0
- shakti_framework-0.1.0/examples/demo_app/app/models/message.py +17 -0
- shakti_framework-0.1.0/examples/demo_app/config/settings.yaml +17 -0
- shakti_framework-0.1.0/examples/demo_app/main.py +167 -0
- shakti_framework-0.1.0/examples/hello_pyforge/config/settings.yaml +3 -0
- shakti_framework-0.1.0/examples/hello_pyforge/main.py +38 -0
- shakti_framework-0.1.0/pyproject.toml +69 -0
- shakti_framework-0.1.0/src/shakti/__about__.py +2 -0
- shakti_framework-0.1.0/src/shakti/__init__.py +62 -0
- shakti_framework-0.1.0/src/shakti/admin/__init__.py +6 -0
- shakti_framework-0.1.0/src/shakti/admin/admin.py +376 -0
- shakti_framework-0.1.0/src/shakti/admin/helpers.py +71 -0
- shakti_framework-0.1.0/src/shakti/admin/registry.py +70 -0
- shakti_framework-0.1.0/src/shakti/admin/ui.py +526 -0
- shakti_framework-0.1.0/src/shakti/ai/__init__.py +37 -0
- shakti_framework-0.1.0/src/shakti/ai/agents.py +211 -0
- shakti_framework-0.1.0/src/shakti/ai/ai.py +316 -0
- shakti_framework-0.1.0/src/shakti/ai/providers/__init__.py +5 -0
- shakti_framework-0.1.0/src/shakti/ai/providers/anthropic_provider.py +96 -0
- shakti_framework-0.1.0/src/shakti/ai/providers/base.py +69 -0
- shakti_framework-0.1.0/src/shakti/ai/providers/openai_provider.py +81 -0
- shakti_framework-0.1.0/src/shakti/ai/rag.py +141 -0
- shakti_framework-0.1.0/src/shakti/ai/templates.py +69 -0
- shakti_framework-0.1.0/src/shakti/application.py +340 -0
- shakti_framework-0.1.0/src/shakti/auth/__init__.py +17 -0
- shakti_framework-0.1.0/src/shakti/auth/auth.py +320 -0
- shakti_framework-0.1.0/src/shakti/auth/hashing.py +13 -0
- shakti_framework-0.1.0/src/shakti/auth/models.py +49 -0
- shakti_framework-0.1.0/src/shakti/auth/tokens.py +56 -0
- shakti_framework-0.1.0/src/shakti/cli/__init__.py +1 -0
- shakti_framework-0.1.0/src/shakti/cli/codegen.py +257 -0
- shakti_framework-0.1.0/src/shakti/cli/main.py +256 -0
- shakti_framework-0.1.0/src/shakti/cli/templates.py +139 -0
- shakti_framework-0.1.0/src/shakti/config/__init__.py +7 -0
- shakti_framework-0.1.0/src/shakti/config/env.py +50 -0
- shakti_framework-0.1.0/src/shakti/config/secrets.py +34 -0
- shakti_framework-0.1.0/src/shakti/config/settings.py +179 -0
- shakti_framework-0.1.0/src/shakti/datastructures.py +164 -0
- shakti_framework-0.1.0/src/shakti/di.py +173 -0
- shakti_framework-0.1.0/src/shakti/docs/__init__.py +14 -0
- shakti_framework-0.1.0/src/shakti/docs/docs.py +362 -0
- shakti_framework-0.1.0/src/shakti/docs/extractors.py +80 -0
- shakti_framework-0.1.0/src/shakti/docs/storage.py +56 -0
- shakti_framework-0.1.0/src/shakti/exceptions.py +45 -0
- shakti_framework-0.1.0/src/shakti/http/__init__.py +19 -0
- shakti_framework-0.1.0/src/shakti/http/request.py +128 -0
- shakti_framework-0.1.0/src/shakti/http/response.py +134 -0
- shakti_framework-0.1.0/src/shakti/middleware/__init__.py +13 -0
- shakti_framework-0.1.0/src/shakti/middleware/base.py +34 -0
- shakti_framework-0.1.0/src/shakti/middleware/cors.py +74 -0
- shakti_framework-0.1.0/src/shakti/middleware/logging.py +32 -0
- shakti_framework-0.1.0/src/shakti/monitoring/__init__.py +14 -0
- shakti_framework-0.1.0/src/shakti/monitoring/dashboard.py +294 -0
- shakti_framework-0.1.0/src/shakti/monitoring/health.py +80 -0
- shakti_framework-0.1.0/src/shakti/monitoring/metrics.py +128 -0
- shakti_framework-0.1.0/src/shakti/monitoring/monitor.py +217 -0
- shakti_framework-0.1.0/src/shakti/orm/__init__.py +38 -0
- shakti_framework-0.1.0/src/shakti/orm/base.py +58 -0
- shakti_framework-0.1.0/src/shakti/orm/database.py +137 -0
- shakti_framework-0.1.0/src/shakti/orm/fields.py +37 -0
- shakti_framework-0.1.0/src/shakti/orm/migrations.py +236 -0
- shakti_framework-0.1.0/src/shakti/orm/repository.py +83 -0
- shakti_framework-0.1.0/src/shakti/py.typed +0 -0
- shakti_framework-0.1.0/src/shakti/routing/__init__.py +7 -0
- shakti_framework-0.1.0/src/shakti/routing/converters.py +21 -0
- shakti_framework-0.1.0/src/shakti/routing/route.py +79 -0
- shakti_framework-0.1.0/src/shakti/routing/router.py +164 -0
- shakti_framework-0.1.0/src/shakti/testing.py +167 -0
- shakti_framework-0.1.0/src/shakti/types.py +12 -0
- shakti_framework-0.1.0/src/shakti/websocket.py +102 -0
- shakti_framework-0.1.0/src/shakti/workflows/__init__.py +15 -0
- shakti_framework-0.1.0/src/shakti/workflows/engine.py +225 -0
- shakti_framework-0.1.0/src/shakti/workflows/models.py +65 -0
- shakti_framework-0.1.0/src/shakti/workflows/queue.py +157 -0
- shakti_framework-0.1.0/src/shakti/workflows/scheduler.py +90 -0
- shakti_framework-0.1.0/tests/conftest.py +4 -0
- shakti_framework-0.1.0/tests/test_admin.py +196 -0
- shakti_framework-0.1.0/tests/test_ai.py +273 -0
- shakti_framework-0.1.0/tests/test_auth.py +311 -0
- shakti_framework-0.1.0/tests/test_cli.py +49 -0
- shakti_framework-0.1.0/tests/test_config.py +103 -0
- shakti_framework-0.1.0/tests/test_di.py +83 -0
- shakti_framework-0.1.0/tests/test_docs.py +284 -0
- shakti_framework-0.1.0/tests/test_generate.py +118 -0
- shakti_framework-0.1.0/tests/test_middleware.py +90 -0
- shakti_framework-0.1.0/tests/test_monitoring.py +242 -0
- shakti_framework-0.1.0/tests/test_orm.py +148 -0
- shakti_framework-0.1.0/tests/test_responses.py +127 -0
- shakti_framework-0.1.0/tests/test_routing.py +97 -0
- shakti_framework-0.1.0/tests/test_websocket.py +223 -0
- shakti_framework-0.1.0/tests/test_workflows.py +286 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
.Python
|
|
7
|
+
*.egg
|
|
8
|
+
*.egg-info/
|
|
9
|
+
dist/
|
|
10
|
+
build/
|
|
11
|
+
eggs/
|
|
12
|
+
parts/
|
|
13
|
+
var/
|
|
14
|
+
sdist/
|
|
15
|
+
develop-eggs/
|
|
16
|
+
.installed.cfg
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
wheels/
|
|
20
|
+
|
|
21
|
+
# Virtual environments
|
|
22
|
+
.venv/
|
|
23
|
+
venv/
|
|
24
|
+
ENV/
|
|
25
|
+
env/
|
|
26
|
+
|
|
27
|
+
# Testing
|
|
28
|
+
.pytest_cache/
|
|
29
|
+
.coverage
|
|
30
|
+
htmlcov/
|
|
31
|
+
.tox/
|
|
32
|
+
coverage.xml
|
|
33
|
+
*.cover
|
|
34
|
+
|
|
35
|
+
# Type checking
|
|
36
|
+
.mypy_cache/
|
|
37
|
+
.dmypy.json
|
|
38
|
+
dmypy.json
|
|
39
|
+
|
|
40
|
+
# IDE
|
|
41
|
+
.vscode/
|
|
42
|
+
.idea/
|
|
43
|
+
*.swp
|
|
44
|
+
*.swo
|
|
45
|
+
.DS_Store
|
|
46
|
+
Thumbs.db
|
|
47
|
+
|
|
48
|
+
# PyForge project files
|
|
49
|
+
*.db
|
|
50
|
+
*.sqlite3
|
|
51
|
+
.env
|
|
52
|
+
*.log
|
|
53
|
+
|
|
54
|
+
# Migrations versions (generated)
|
|
55
|
+
migrations/versions/
|
|
56
|
+
|
|
57
|
+
# Distribution
|
|
58
|
+
dist/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PyForge Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: shakti-framework
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Shakti — AI-first, async Python web framework. Born in India, built for the world.
|
|
5
|
+
Project-URL: Homepage, https://github.com/shaktihq/shakti
|
|
6
|
+
Project-URL: Documentation, https://github.com/shaktihq/shakti/tree/main/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/shaktihq/shakti
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/shaktihq/shakti/issues
|
|
9
|
+
Author-email: Aditya Bhat <contact@adityabhat.in>
|
|
10
|
+
Maintainer-email: Aditya Bhat <contact@adityabhat.in>
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: ai,api,asgi,async,framework,india,python,rest,web
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Framework :: AsyncIO
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.12
|
|
22
|
+
Requires-Dist: pyyaml>=6.0
|
|
23
|
+
Provides-Extra: ai
|
|
24
|
+
Requires-Dist: anthropic>=0.30; extra == 'ai'
|
|
25
|
+
Requires-Dist: openai>=1.0; extra == 'ai'
|
|
26
|
+
Provides-Extra: all
|
|
27
|
+
Requires-Dist: aiosqlite>=0.20; extra == 'all'
|
|
28
|
+
Requires-Dist: alembic>=1.13; extra == 'all'
|
|
29
|
+
Requires-Dist: anthropic>=0.30; extra == 'all'
|
|
30
|
+
Requires-Dist: bcrypt>=4.0; extra == 'all'
|
|
31
|
+
Requires-Dist: openai>=1.0; extra == 'all'
|
|
32
|
+
Requires-Dist: pillow>=10.0; extra == 'all'
|
|
33
|
+
Requires-Dist: psutil>=5.9; extra == 'all'
|
|
34
|
+
Requires-Dist: pyjwt>=2.8; extra == 'all'
|
|
35
|
+
Requires-Dist: pypdf>=4.0; extra == 'all'
|
|
36
|
+
Requires-Dist: sqlalchemy[asyncio]>=2.0; extra == 'all'
|
|
37
|
+
Requires-Dist: uvicorn>=0.30; extra == 'all'
|
|
38
|
+
Provides-Extra: auth
|
|
39
|
+
Requires-Dist: bcrypt>=4.0; extra == 'auth'
|
|
40
|
+
Requires-Dist: pyjwt>=2.8; extra == 'auth'
|
|
41
|
+
Provides-Extra: dev
|
|
42
|
+
Requires-Dist: aiosqlite>=0.20; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
44
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
46
|
+
Requires-Dist: uvicorn>=0.30; extra == 'dev'
|
|
47
|
+
Provides-Extra: docs-ai
|
|
48
|
+
Requires-Dist: pillow>=10.0; extra == 'docs-ai'
|
|
49
|
+
Requires-Dist: pypdf>=4.0; extra == 'docs-ai'
|
|
50
|
+
Provides-Extra: monitoring
|
|
51
|
+
Requires-Dist: psutil>=5.9; extra == 'monitoring'
|
|
52
|
+
Provides-Extra: orm
|
|
53
|
+
Requires-Dist: aiosqlite>=0.20; extra == 'orm'
|
|
54
|
+
Requires-Dist: alembic>=1.13; extra == 'orm'
|
|
55
|
+
Requires-Dist: sqlalchemy[asyncio]>=2.0; extra == 'orm'
|
|
56
|
+
Provides-Extra: server
|
|
57
|
+
Requires-Dist: uvicorn>=0.30; extra == 'server'
|
|
58
|
+
Description-Content-Type: text/markdown
|
|
59
|
+
|
|
60
|
+
# Shakti
|
|
61
|
+
|
|
62
|
+
**An AI-first, async Python web framework.**
|
|
63
|
+
|
|
64
|
+
> Born in India. Built for the world.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install "shakti[server]"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Why Shakti?
|
|
73
|
+
|
|
74
|
+
| Feature | Django | FastAPI | **Shakti** |
|
|
75
|
+
|---------|--------|---------|------------|
|
|
76
|
+
| Async-first | ❌ | ✅ | ✅ |
|
|
77
|
+
| Built-in ORM | ✅ | ❌ | ✅ |
|
|
78
|
+
| Admin panel | ✅ | ❌ | ✅ |
|
|
79
|
+
| JWT Auth | ❌ | ❌ | ✅ |
|
|
80
|
+
| **Built-in AI** | ❌ | ❌ | ✅ |
|
|
81
|
+
| WebSockets | ❌ | ✅ | ✅ |
|
|
82
|
+
| Background Jobs | ❌ | ❌ | ✅ |
|
|
83
|
+
| Monitoring | ❌ | ❌ | ✅ |
|
|
84
|
+
| Document AI | ❌ | ❌ | ✅ |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Quick Start
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install "shakti[all]"
|
|
92
|
+
shakti new myapp
|
|
93
|
+
cd myapp
|
|
94
|
+
shakti run --reload
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Visit `http://127.0.0.1:8000` — your app is live.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 60-second example
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from shakti import Shakti, Depends
|
|
105
|
+
from shakti.config import Config
|
|
106
|
+
from shakti.orm import Database, Repository
|
|
107
|
+
from shakti.auth import Auth
|
|
108
|
+
from shakti.auth.models import User
|
|
109
|
+
from shakti.ai import AI
|
|
110
|
+
from shakti.admin import Admin
|
|
111
|
+
from shakti.monitoring import Monitor
|
|
112
|
+
from shakti.workflows import WorkflowEngine
|
|
113
|
+
from shakti.websocket import WebSocket
|
|
114
|
+
|
|
115
|
+
config = Config()
|
|
116
|
+
app = Shakti(title="My App", config=config)
|
|
117
|
+
|
|
118
|
+
db = Database(config.require("database.url"))
|
|
119
|
+
db.init_app(app)
|
|
120
|
+
|
|
121
|
+
auth = Auth(db, secret_key=config.require("auth.secret_key"))
|
|
122
|
+
auth.init_app(app)
|
|
123
|
+
|
|
124
|
+
ai = AI(config)
|
|
125
|
+
ai.init_app(app)
|
|
126
|
+
|
|
127
|
+
admin = Admin(db, auth, title="My Admin")
|
|
128
|
+
admin.register(User)
|
|
129
|
+
admin.init_app(app)
|
|
130
|
+
|
|
131
|
+
monitor = Monitor()
|
|
132
|
+
monitor.init_app(app)
|
|
133
|
+
|
|
134
|
+
workflows = WorkflowEngine()
|
|
135
|
+
workflows.init_app(app)
|
|
136
|
+
|
|
137
|
+
@app.get("/")
|
|
138
|
+
async def index() -> dict:
|
|
139
|
+
return {"framework": "Shakti", "status": "running"}
|
|
140
|
+
|
|
141
|
+
@app.get("/me")
|
|
142
|
+
async def me(user: User = Depends(auth.get_current_user())) -> dict:
|
|
143
|
+
return user.to_dict()
|
|
144
|
+
|
|
145
|
+
@app.websocket("/ws/chat")
|
|
146
|
+
async def chat(ws: WebSocket) -> None:
|
|
147
|
+
await ws.accept()
|
|
148
|
+
async for msg in ws.iter_json():
|
|
149
|
+
reply = await ai.chat(msg["text"])
|
|
150
|
+
await ws.send_json({"reply": reply})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**One app. Everything included:**
|
|
154
|
+
- ✅ Async REST API
|
|
155
|
+
- ✅ JWT authentication
|
|
156
|
+
- ✅ AI chat (Claude/OpenAI)
|
|
157
|
+
- ✅ WebSocket real-time
|
|
158
|
+
- ✅ Admin panel at `/admin/`
|
|
159
|
+
- ✅ Monitoring at `/monitor/`
|
|
160
|
+
- ✅ Background jobs
|
|
161
|
+
- ✅ PDF/OCR document AI
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Install
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
pip install shakti # core only
|
|
169
|
+
pip install "shakti[server]" # + uvicorn
|
|
170
|
+
pip install "shakti[orm]" # + SQLAlchemy
|
|
171
|
+
pip install "shakti[auth]" # + JWT + bcrypt
|
|
172
|
+
pip install "shakti[ai]" # + Claude/OpenAI
|
|
173
|
+
pip install "shakti[monitoring]" # + psutil
|
|
174
|
+
pip install "shakti[all]" # everything
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## CLI
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
shakti new myapp # scaffold project
|
|
183
|
+
shakti run --reload # start dev server
|
|
184
|
+
shakti generate model Post title:str body:text # generate model
|
|
185
|
+
shakti generate api Comment body:text # model + full CRUD
|
|
186
|
+
shakti makemigrations "add posts" # create migration
|
|
187
|
+
shakti migrate # apply migrations
|
|
188
|
+
shakti version # show version
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Configuration
|
|
194
|
+
|
|
195
|
+
```yaml
|
|
196
|
+
# config/settings.yaml
|
|
197
|
+
app:
|
|
198
|
+
name: myapp
|
|
199
|
+
debug: true
|
|
200
|
+
|
|
201
|
+
database:
|
|
202
|
+
url: sqlite+aiosqlite:///./myapp.db
|
|
203
|
+
|
|
204
|
+
auth:
|
|
205
|
+
secret_key: ${SECRET_KEY}
|
|
206
|
+
|
|
207
|
+
ai:
|
|
208
|
+
provider: anthropic
|
|
209
|
+
model: claude-sonnet-4-6
|
|
210
|
+
api_key: ${ANTHROPIC_API_KEY}
|
|
211
|
+
system_prompt: "You are a helpful assistant."
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Modules
|
|
217
|
+
|
|
218
|
+
| Module | Import | What it does |
|
|
219
|
+
|--------|--------|-------------|
|
|
220
|
+
| Core | `from shakti import Shakti` | Routing, middleware, DI, config |
|
|
221
|
+
| ORM | `from shakti.orm import Database` | SQLAlchemy async + migrations |
|
|
222
|
+
| Auth | `from shakti.auth import Auth` | JWT, RBAC, API keys |
|
|
223
|
+
| AI | `from shakti.ai import AI` | Claude/OpenAI, RAG, agents |
|
|
224
|
+
| Admin | `from shakti.admin import Admin` | Auto-generated admin panel |
|
|
225
|
+
| WebSocket | `from shakti.websocket import WebSocket` | Real-time connections |
|
|
226
|
+
| Document AI | `from shakti.docs import DocumentAI` | PDF, OCR, document Q&A |
|
|
227
|
+
| Workflows | `from shakti.workflows import WorkflowEngine` | Background jobs |
|
|
228
|
+
| Monitoring | `from shakti.monitoring import Monitor` | Health checks, metrics |
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## License
|
|
233
|
+
|
|
234
|
+
MIT © Aditya Bhat — Born in India 🇮🇳
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Shakti
|
|
2
|
+
|
|
3
|
+
**An AI-first, async Python web framework.**
|
|
4
|
+
|
|
5
|
+
> Born in India. Built for the world.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install "shakti[server]"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Why Shakti?
|
|
14
|
+
|
|
15
|
+
| Feature | Django | FastAPI | **Shakti** |
|
|
16
|
+
|---------|--------|---------|------------|
|
|
17
|
+
| Async-first | ❌ | ✅ | ✅ |
|
|
18
|
+
| Built-in ORM | ✅ | ❌ | ✅ |
|
|
19
|
+
| Admin panel | ✅ | ❌ | ✅ |
|
|
20
|
+
| JWT Auth | ❌ | ❌ | ✅ |
|
|
21
|
+
| **Built-in AI** | ❌ | ❌ | ✅ |
|
|
22
|
+
| WebSockets | ❌ | ✅ | ✅ |
|
|
23
|
+
| Background Jobs | ❌ | ❌ | ✅ |
|
|
24
|
+
| Monitoring | ❌ | ❌ | ✅ |
|
|
25
|
+
| Document AI | ❌ | ❌ | ✅ |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install "shakti[all]"
|
|
33
|
+
shakti new myapp
|
|
34
|
+
cd myapp
|
|
35
|
+
shakti run --reload
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Visit `http://127.0.0.1:8000` — your app is live.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 60-second example
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from shakti import Shakti, Depends
|
|
46
|
+
from shakti.config import Config
|
|
47
|
+
from shakti.orm import Database, Repository
|
|
48
|
+
from shakti.auth import Auth
|
|
49
|
+
from shakti.auth.models import User
|
|
50
|
+
from shakti.ai import AI
|
|
51
|
+
from shakti.admin import Admin
|
|
52
|
+
from shakti.monitoring import Monitor
|
|
53
|
+
from shakti.workflows import WorkflowEngine
|
|
54
|
+
from shakti.websocket import WebSocket
|
|
55
|
+
|
|
56
|
+
config = Config()
|
|
57
|
+
app = Shakti(title="My App", config=config)
|
|
58
|
+
|
|
59
|
+
db = Database(config.require("database.url"))
|
|
60
|
+
db.init_app(app)
|
|
61
|
+
|
|
62
|
+
auth = Auth(db, secret_key=config.require("auth.secret_key"))
|
|
63
|
+
auth.init_app(app)
|
|
64
|
+
|
|
65
|
+
ai = AI(config)
|
|
66
|
+
ai.init_app(app)
|
|
67
|
+
|
|
68
|
+
admin = Admin(db, auth, title="My Admin")
|
|
69
|
+
admin.register(User)
|
|
70
|
+
admin.init_app(app)
|
|
71
|
+
|
|
72
|
+
monitor = Monitor()
|
|
73
|
+
monitor.init_app(app)
|
|
74
|
+
|
|
75
|
+
workflows = WorkflowEngine()
|
|
76
|
+
workflows.init_app(app)
|
|
77
|
+
|
|
78
|
+
@app.get("/")
|
|
79
|
+
async def index() -> dict:
|
|
80
|
+
return {"framework": "Shakti", "status": "running"}
|
|
81
|
+
|
|
82
|
+
@app.get("/me")
|
|
83
|
+
async def me(user: User = Depends(auth.get_current_user())) -> dict:
|
|
84
|
+
return user.to_dict()
|
|
85
|
+
|
|
86
|
+
@app.websocket("/ws/chat")
|
|
87
|
+
async def chat(ws: WebSocket) -> None:
|
|
88
|
+
await ws.accept()
|
|
89
|
+
async for msg in ws.iter_json():
|
|
90
|
+
reply = await ai.chat(msg["text"])
|
|
91
|
+
await ws.send_json({"reply": reply})
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**One app. Everything included:**
|
|
95
|
+
- ✅ Async REST API
|
|
96
|
+
- ✅ JWT authentication
|
|
97
|
+
- ✅ AI chat (Claude/OpenAI)
|
|
98
|
+
- ✅ WebSocket real-time
|
|
99
|
+
- ✅ Admin panel at `/admin/`
|
|
100
|
+
- ✅ Monitoring at `/monitor/`
|
|
101
|
+
- ✅ Background jobs
|
|
102
|
+
- ✅ PDF/OCR document AI
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Install
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pip install shakti # core only
|
|
110
|
+
pip install "shakti[server]" # + uvicorn
|
|
111
|
+
pip install "shakti[orm]" # + SQLAlchemy
|
|
112
|
+
pip install "shakti[auth]" # + JWT + bcrypt
|
|
113
|
+
pip install "shakti[ai]" # + Claude/OpenAI
|
|
114
|
+
pip install "shakti[monitoring]" # + psutil
|
|
115
|
+
pip install "shakti[all]" # everything
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## CLI
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
shakti new myapp # scaffold project
|
|
124
|
+
shakti run --reload # start dev server
|
|
125
|
+
shakti generate model Post title:str body:text # generate model
|
|
126
|
+
shakti generate api Comment body:text # model + full CRUD
|
|
127
|
+
shakti makemigrations "add posts" # create migration
|
|
128
|
+
shakti migrate # apply migrations
|
|
129
|
+
shakti version # show version
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Configuration
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
# config/settings.yaml
|
|
138
|
+
app:
|
|
139
|
+
name: myapp
|
|
140
|
+
debug: true
|
|
141
|
+
|
|
142
|
+
database:
|
|
143
|
+
url: sqlite+aiosqlite:///./myapp.db
|
|
144
|
+
|
|
145
|
+
auth:
|
|
146
|
+
secret_key: ${SECRET_KEY}
|
|
147
|
+
|
|
148
|
+
ai:
|
|
149
|
+
provider: anthropic
|
|
150
|
+
model: claude-sonnet-4-6
|
|
151
|
+
api_key: ${ANTHROPIC_API_KEY}
|
|
152
|
+
system_prompt: "You are a helpful assistant."
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Modules
|
|
158
|
+
|
|
159
|
+
| Module | Import | What it does |
|
|
160
|
+
|--------|--------|-------------|
|
|
161
|
+
| Core | `from shakti import Shakti` | Routing, middleware, DI, config |
|
|
162
|
+
| ORM | `from shakti.orm import Database` | SQLAlchemy async + migrations |
|
|
163
|
+
| Auth | `from shakti.auth import Auth` | JWT, RBAC, API keys |
|
|
164
|
+
| AI | `from shakti.ai import AI` | Claude/OpenAI, RAG, agents |
|
|
165
|
+
| Admin | `from shakti.admin import Admin` | Auto-generated admin panel |
|
|
166
|
+
| WebSocket | `from shakti.websocket import WebSocket` | Real-time connections |
|
|
167
|
+
| Document AI | `from shakti.docs import DocumentAI` | PDF, OCR, document Q&A |
|
|
168
|
+
| Workflows | `from shakti.workflows import WorkflowEngine` | Background jobs |
|
|
169
|
+
| Monitoring | `from shakti.monitoring import Monitor` | Health checks, metrics |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
MIT © Aditya Bhat — Born in India 🇮🇳
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Admin Panel
|
|
2
|
+
|
|
3
|
+
Shakti includes a built-in admin panel — better than Django's.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from shakti.admin import Admin
|
|
9
|
+
from app.models.post import Post
|
|
10
|
+
from shakti.auth.models import User
|
|
11
|
+
|
|
12
|
+
admin = Admin(db, auth, title="My Admin")
|
|
13
|
+
admin.register(Post,
|
|
14
|
+
list_fields=["id", "title", "created_at"],
|
|
15
|
+
search_fields=["title", "body"]
|
|
16
|
+
)
|
|
17
|
+
admin.register(User,
|
|
18
|
+
list_fields=["id", "email", "username", "role"],
|
|
19
|
+
search_fields=["email", "username"]
|
|
20
|
+
)
|
|
21
|
+
admin.init_app(app)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Visit `http://localhost:8000/admin/`
|
|
25
|
+
|
|
26
|
+
Login with any user that has `role: "admin"`.
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- Dark mode and light mode toggle
|
|
31
|
+
- Search across any field
|
|
32
|
+
- Paginated list views
|
|
33
|
+
- Create, edit, delete records
|
|
34
|
+
- CSV export on any model
|
|
35
|
+
- Activity log (who did what)
|
|
36
|
+
- Hover-reveal action buttons
|
|
37
|
+
- Auto-dismiss flash messages
|
|
38
|
+
|
|
39
|
+
## ModelAdmin options
|
|
40
|
+
|
|
41
|
+
| Option | Default | Description |
|
|
42
|
+
|--------|---------|-------------|
|
|
43
|
+
| `list_fields` | auto (first 6) | Columns shown in list |
|
|
44
|
+
| `search_fields` | `[]` | Fields to search on |
|
|
45
|
+
| `readonly_fields` | `["id"]` | Non-editable fields |
|
|
46
|
+
| `list_per_page` | `25` | Records per page |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
Shakti requires **Python 3.12+**.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install "shakti-framework[server]"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Optional extras
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install "shakti-framework[orm]" # SQLAlchemy + Alembic
|
|
15
|
+
pip install "shakti-framework[auth]" # JWT + bcrypt
|
|
16
|
+
pip install "shakti-framework[ai]" # Claude + OpenAI
|
|
17
|
+
pip install "shakti-framework[docs]" # PDF + OCR
|
|
18
|
+
pip install "shakti-framework[monitoring]" # psutil metrics
|
|
19
|
+
pip install "shakti-framework[all]" # everything
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Verify
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
shakti version
|
|
26
|
+
# shakti 0.1.0
|
|
27
|
+
```
|