vayuapi 0.2.2__tar.gz → 0.2.4__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.
Files changed (59) hide show
  1. {vayuapi-0.2.2 → vayuapi-0.2.4}/PKG-INFO +30 -25
  2. {vayuapi-0.2.2 → vayuapi-0.2.4}/pyproject.toml +4 -3
  3. {vayuapi-0.2.2 → vayuapi-0.2.4}/requirements.txt +1 -0
  4. {vayuapi-0.2.2 → vayuapi-0.2.4}/setup.py +1 -1
  5. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/__init__.py +10 -3
  6. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/application.py +32 -7
  7. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/responses.py +22 -1
  8. vayuapi-0.2.4/vayuapi/response.py +25 -0
  9. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi.egg-info/SOURCES.txt +1 -0
  10. {vayuapi-0.2.2 → vayuapi-0.2.4}/LICENSE +0 -0
  11. {vayuapi-0.2.2 → vayuapi-0.2.4}/MANIFEST.in +0 -0
  12. {vayuapi-0.2.2 → vayuapi-0.2.4}/README.md +0 -0
  13. {vayuapi-0.2.2 → vayuapi-0.2.4}/setup.cfg +0 -0
  14. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/admin/__init__.py +0 -0
  15. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/admin/enhanced_panel.py +0 -0
  16. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/admin/panel.py +0 -0
  17. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/ai/__init__.py +0 -0
  18. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/ai/langchain.py +0 -0
  19. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/ai/pydantic_ai.py +0 -0
  20. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/__init__.py +0 -0
  21. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/concurrency.py +0 -0
  22. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/decorators.py +0 -0
  23. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/dependencies.py +0 -0
  24. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/docs.py +0 -0
  25. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/exceptions.py +0 -0
  26. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/middleware.py +0 -0
  27. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/params.py +0 -0
  28. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/routing.py +0 -0
  29. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/staticfiles.py +0 -0
  30. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/templating.py +0 -0
  31. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/uploads.py +0 -0
  32. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/core/websocket.py +0 -0
  33. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/di/__init__.py +0 -0
  34. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/di/container.py +0 -0
  35. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/di/injectable.py +0 -0
  36. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/di/provider.py +0 -0
  37. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/grpc/__init__.py +0 -0
  38. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/grpc/client.py +0 -0
  39. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/grpc/decorators.py +0 -0
  40. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/grpc/server.py +0 -0
  41. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/middleware/__init__.py +0 -0
  42. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/orm/__init__.py +0 -0
  43. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/orm/async_orm.py +0 -0
  44. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/orm/database.py +0 -0
  45. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/orm/django_orm.py +0 -0
  46. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/scheduler/__init__.py +0 -0
  47. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/scheduler/tasks.py +0 -0
  48. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/security/__init__.py +0 -0
  49. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/security/auth.py +0 -0
  50. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/security/encryption.py +0 -0
  51. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/security/jwt.py +0 -0
  52. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/status.py +0 -0
  53. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/tasks/__init__.py +0 -0
  54. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/tasks/arq_app.py +0 -0
  55. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/tasks/celery_app.py +0 -0
  56. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/tasks/decorators.py +0 -0
  57. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/tasks/worker.py +0 -0
  58. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/utils/__init__.py +0 -0
  59. {vayuapi-0.2.2 → vayuapi-0.2.4}/vayuapi/utils/helpers.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: vayuapi
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: The fastest Python async API framework for rapid development with AI/ML support
5
5
  Home-page: https://github.com/vayuapi/vayuapi
6
6
  Author: VayuAPI Team
@@ -53,6 +53,7 @@ Requires-Dist: jinja2>=3.1.2
53
53
  Requires-Dist: httpx>=0.26.0
54
54
  Requires-Dist: itsdangerous
55
55
  Requires-Dist: pydantic[email]
56
+ Requires-Dist: sse-starlette>=2.1.0
56
57
  Provides-Extra: django
57
58
  Requires-Dist: django<6.0.0,>=4.2.0; extra == "django"
58
59
  Requires-Dist: psycopg2-binary>=2.9.0; extra == "django"
@@ -80,18 +81,41 @@ Requires-Dist: langchain-community>=0.0.20; extra == "ai"
80
81
  Requires-Dist: pydantic-ai>=0.0.5; extra == "ai"
81
82
  Requires-Dist: openai>=1.10.0; extra == "ai"
82
83
  Requires-Dist: anthropic>=0.18.0; extra == "ai"
84
+ Provides-Extra: rag
85
+ Requires-Dist: langchain>=0.1.0; extra == "rag"
86
+ Requires-Dist: langchain-chroma>=0.1.0; extra == "rag"
87
+ Requires-Dist: langchain-pinecone>=0.1.0; extra == "rag"
88
+ Requires-Dist: sentence-transformers>=2.3.0; extra == "rag"
89
+ Requires-Dist: tiktoken>=0.6.0; extra == "rag"
83
90
  Provides-Extra: scheduler
84
91
  Requires-Dist: apscheduler>=3.10.0; extra == "scheduler"
92
+ Provides-Extra: celery
93
+ Requires-Dist: celery>=5.3.0; extra == "celery"
94
+ Requires-Dist: redis>=5.0.0; extra == "celery"
95
+ Requires-Dist: kombu>=5.3.0; extra == "celery"
96
+ Provides-Extra: arq
97
+ Requires-Dist: arq>=0.25.0; extra == "arq"
98
+ Requires-Dist: redis>=5.0.0; extra == "arq"
99
+ Provides-Extra: grpc
100
+ Requires-Dist: grpcio>=1.60.0; extra == "grpc"
101
+ Requires-Dist: grpcio-tools>=1.60.0; extra == "grpc"
102
+ Requires-Dist: grpcio-reflection>=1.60.0; extra == "grpc"
103
+ Requires-Dist: protobuf>=4.25.0; extra == "grpc"
85
104
  Provides-Extra: security
86
105
  Requires-Dist: cryptography>=41.0.0; extra == "security"
87
106
  Requires-Dist: pyjwt>=2.8.0; extra == "security"
88
107
  Requires-Dist: passlib>=1.7.4; extra == "security"
89
108
  Requires-Dist: bcrypt>=4.1.0; extra == "security"
109
+ Provides-Extra: http
110
+ Requires-Dist: httpx>=0.26.0; extra == "http"
111
+ Requires-Dist: aiohttp>=3.9.0; extra == "http"
90
112
  Provides-Extra: test
91
113
  Requires-Dist: pytest>=7.4.0; extra == "test"
92
114
  Requires-Dist: pytest-asyncio>=0.23.0; extra == "test"
93
115
  Requires-Dist: pytest-cov>=4.1.0; extra == "test"
94
116
  Requires-Dist: httpx>=0.26.0; extra == "test"
117
+ Provides-Extra: all
118
+ Requires-Dist: vayuapi[ai,arq,celery,django,grpc,http,nosql,orm,rag,scheduler,security,sqlalchemy,vector]; extra == "all"
95
119
  Provides-Extra: dev
96
120
  Requires-Dist: vayuapi[test]; extra == "dev"
97
121
  Requires-Dist: black>=24.0.0; extra == "dev"
@@ -104,29 +128,10 @@ Requires-Dist: black>=24.0.0; extra == "dev-all"
104
128
  Requires-Dist: ruff>=0.2.0; extra == "dev-all"
105
129
  Requires-Dist: mypy>=1.8.0; extra == "dev-all"
106
130
  Requires-Dist: pre-commit>=3.6.0; extra == "dev-all"
107
- Provides-Extra: all
108
- Requires-Dist: vayuapi[ai,arq,celery,django,grpc,http,nosql,orm,rag,scheduler,security,sqlalchemy,vector]; extra == "all"
109
- Provides-Extra: rag
110
- Requires-Dist: langchain>=0.1.0; extra == "rag"
111
- Requires-Dist: langchain-chroma>=0.1.0; extra == "rag"
112
- Requires-Dist: langchain-pinecone>=0.1.0; extra == "rag"
113
- Requires-Dist: sentence-transformers>=2.3.0; extra == "rag"
114
- Requires-Dist: tiktoken>=0.6.0; extra == "rag"
115
- Provides-Extra: celery
116
- Requires-Dist: celery>=5.3.0; extra == "celery"
117
- Requires-Dist: redis>=5.0.0; extra == "celery"
118
- Requires-Dist: kombu>=5.3.0; extra == "celery"
119
- Provides-Extra: arq
120
- Requires-Dist: arq>=0.25.0; extra == "arq"
121
- Requires-Dist: redis>=5.0.0; extra == "arq"
122
- Provides-Extra: grpc
123
- Requires-Dist: grpcio>=1.60.0; extra == "grpc"
124
- Requires-Dist: grpcio-tools>=1.60.0; extra == "grpc"
125
- Requires-Dist: grpcio-reflection>=1.60.0; extra == "grpc"
126
- Requires-Dist: protobuf>=4.25.0; extra == "grpc"
127
- Provides-Extra: http
128
- Requires-Dist: httpx>=0.26.0; extra == "http"
129
- Requires-Dist: aiohttp>=3.9.0; extra == "http"
131
+ Dynamic: author
132
+ Dynamic: home-page
133
+ Dynamic: license-file
134
+ Dynamic: requires-python
130
135
 
131
136
  # VayuAPI Framework 🔥
132
137
 
@@ -1,12 +1,12 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0,<69.0", "wheel"]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
3
  build-backend = "setuptools.build_meta"
4
4
  [tool.setuptools.packages.find]
5
5
  include = ["vayuapi*"]
6
6
 
7
7
  [project]
8
8
  name = "vayuapi"
9
- version = "0.2.2"
9
+ version = "0.2.4"
10
10
  description = "The fastest Python async API framework for rapid development with AI/ML support"
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.11,<3.16"
@@ -62,7 +62,8 @@ dependencies = [
62
62
  "jinja2>=3.1.2",
63
63
  "httpx>=0.26.0",
64
64
  "itsdangerous",
65
- "pydantic[email]"
65
+ "pydantic[email]",
66
+ "sse-starlette>=2.1.0"
66
67
 
67
68
  ]
68
69
 
@@ -55,3 +55,4 @@ black>=24.0.0
55
55
  ruff>=0.2.0
56
56
  itsdangerous
57
57
  pydantic[email]
58
+ sse-starlette>=2.1.0
@@ -7,7 +7,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
7
7
 
8
8
  setup(
9
9
  name="vayuapi",
10
- version="0.2.2",
10
+ version="0.2.4",
11
11
  author="VayuAPI Team",
12
12
  author_email="codeswithalok@gmail.com",
13
13
  description="The fastest Python async API framework for rapid development with AI/ML support",
@@ -3,12 +3,11 @@
3
3
  VayuAPI - The fastest Python async API framework
4
4
  """
5
5
 
6
- __version__ = "0.1.0"
6
+ __version__ = "0.2.3"
7
7
  __author__ = "VayuAPI Team"
8
8
  __license__ = "MIT"
9
9
 
10
10
  from vayuapi.core.application import VayuAPI
11
- from vayuapi.core.responses import JSONResponse
12
11
  from vayuapi.core.routing import Router, Route
13
12
  from vayuapi.core.middleware import Middleware
14
13
  from vayuapi.core.websocket import WebSocket, WebSocketManager
@@ -59,6 +58,7 @@ from vayuapi.core.concurrency import (
59
58
 
60
59
  # Exception handling
61
60
  from vayuapi.core.exceptions import (
61
+ ExceptionHandler,
62
62
  HTTPException,
63
63
  RequestValidationError,
64
64
  WebSocketException,
@@ -75,11 +75,15 @@ from vayuapi.core.exceptions import (
75
75
 
76
76
  # Request/Response types
77
77
  from starlette.requests import Request
78
- from starlette.responses import (
78
+ from vayuapi.response import (
79
79
  Response,
80
+ JSONResponse,
80
81
  HTMLResponse,
82
+ PlainTextResponse,
83
+ RedirectResponse,
81
84
  StreamingResponse,
82
85
  FileResponse,
86
+ EventSourceResponse,
83
87
  )
84
88
 
85
89
  # Decorators
@@ -109,8 +113,11 @@ __all__ = [
109
113
  "Response",
110
114
  "JSONResponse",
111
115
  "HTMLResponse",
116
+ "PlainTextResponse",
117
+ "RedirectResponse",
112
118
  "StreamingResponse",
113
119
  "FileResponse",
120
+ "EventSourceResponse",
114
121
  # Parameters
115
122
  "Path",
116
123
  "Query",
@@ -61,6 +61,7 @@ class VayuAPI:
61
61
  allowed_origins: List[str] = None,
62
62
  middleware: List[Middleware] = None,
63
63
  lifespan: Optional[Callable] = None,
64
+ exception_handlers: Optional[Dict[Type[Exception], Callable]] = None,
64
65
  ):
65
66
  """
66
67
  Initialize VayuAPI application.
@@ -81,6 +82,7 @@ class VayuAPI:
81
82
  allowed_origins: List of allowed origins for CORS
82
83
  middleware: List of middleware to add
83
84
  lifespan: Lifespan context manager
85
+ exception_handlers: Dict mapping exception classes to handler callables
84
86
  """
85
87
  self.title = title
86
88
  self.version = version
@@ -154,7 +156,10 @@ class VayuAPI:
154
156
 
155
157
  # Exception handlers
156
158
  from vayuapi.core.exceptions import ExceptionHandler
157
- self.exception_handler = ExceptionHandler()
159
+ self._exception_handler = ExceptionHandler()
160
+ if exception_handlers:
161
+ for exc_class, handler in exception_handlers.items():
162
+ self._exception_handler.add_handler(exc_class, handler)
158
163
  #---------------------Routes------------------------------Added-------#
159
164
  @property
160
165
  def routes(self):
@@ -343,7 +348,27 @@ class VayuAPI:
343
348
  exc_class: Exception class to handle
344
349
  handler: Async function that handles the exception
345
350
  """
346
- self.exception_handler.add_handler(exc_class, handler)
351
+ self._exception_handler.add_handler(exc_class, handler)
352
+
353
+ def exception_handler(self, exc_class: Type[Exception]):
354
+ """
355
+ Decorator to register a custom exception handler.
356
+
357
+ Example:
358
+ ```python
359
+ @app.exception_handler(HTTPException)
360
+ async def http_error_handler(request, exc):
361
+ return JSONResponse(status_code=exc.status_code, content={"error": exc.detail})
362
+
363
+ @app.exception_handler(RedirectToLogin)
364
+ async def redirect_handler(request, exc):
365
+ return RedirectResponse(url="/login")
366
+ ```
367
+ """
368
+ def decorator(handler: Callable):
369
+ self._exception_handler.add_handler(exc_class, handler)
370
+ return handler
371
+ return decorator
347
372
 
348
373
  def route(
349
374
  self,
@@ -649,7 +674,7 @@ class VayuAPI:
649
674
  return JSONResponse({"message": "Success"})
650
675
  return JSONResponse({"data": result})
651
676
  except Exception as e:
652
- return await self.exception_handler.handle(request, e)
677
+ return await self._exception_handler.handle(request, e)
653
678
  return simple_wrapped
654
679
  else:
655
680
  async def simple_wrapped_sync(request: Request) -> Response:
@@ -668,7 +693,7 @@ class VayuAPI:
668
693
  return JSONResponse({"message": "Success"})
669
694
  return JSONResponse({"data": result})
670
695
  except Exception as e:
671
- return await self.exception_handler.handle(request, e)
696
+ return await self._exception_handler.handle(request, e)
672
697
  return simple_wrapped_sync
673
698
 
674
699
  #------------------------------------------------------------------------------------------------------------#
@@ -867,10 +892,10 @@ class VayuAPI:
867
892
  except ValidationError as e:
868
893
  from vayuapi.core.exceptions import RequestValidationError
869
894
  validation_error = RequestValidationError(e.errors())
870
- return await self.exception_handler.handle(request, validation_error)
895
+ return await self._exception_handler.handle(request, validation_error)
871
896
  except Exception as e:
872
897
  # Use exception handler
873
- return await self.exception_handler.handle(request, e)
898
+ return await self._exception_handler.handle(request, e)
874
899
 
875
900
  return wrapped
876
901
 
@@ -952,7 +977,7 @@ class VayuAPI:
952
977
  from starlette.exceptions import HTTPException as StarletteHTTPException
953
978
 
954
979
  mw_stack = self.middleware_stack # capture reference
955
- exc_handler = self.exception_handler # capture reference
980
+ exc_handler = self._exception_handler # capture reference
956
981
 
957
982
  class _VayuMiddlewareWrapper(BaseHTTPMiddleware):
958
983
  async def dispatch(self, request, call_next):
@@ -9,7 +9,16 @@ from uuid import UUID
9
9
  from typing import Any
10
10
  from enum import Enum
11
11
 
12
- from starlette.responses import JSONResponse as StarletteJSONResponse
12
+ from starlette.responses import (
13
+ JSONResponse as StarletteJSONResponse,
14
+ Response,
15
+ HTMLResponse,
16
+ PlainTextResponse,
17
+ RedirectResponse,
18
+ StreamingResponse,
19
+ FileResponse,
20
+ )
21
+ from sse_starlette.sse import EventSourceResponse
13
22
  from pydantic import BaseModel
14
23
 
15
24
 
@@ -71,3 +80,15 @@ class JSONResponse(StarletteJSONResponse):
71
80
  separators=(",", ":"),
72
81
  cls=AgniJSONEncoder,
73
82
  ).encode("utf-8")
83
+
84
+
85
+ __all__ = [
86
+ "Response",
87
+ "JSONResponse",
88
+ "HTMLResponse",
89
+ "PlainTextResponse",
90
+ "RedirectResponse",
91
+ "StreamingResponse",
92
+ "FileResponse",
93
+ "EventSourceResponse",
94
+ ]
@@ -0,0 +1,25 @@
1
+ """
2
+ VayuAPI response classes — importable from vayuapi.response
3
+ """
4
+
5
+ from vayuapi.core.responses import (
6
+ Response,
7
+ JSONResponse,
8
+ HTMLResponse,
9
+ PlainTextResponse,
10
+ RedirectResponse,
11
+ StreamingResponse,
12
+ FileResponse,
13
+ EventSourceResponse,
14
+ )
15
+
16
+ __all__ = [
17
+ "EventSourceResponse",
18
+ "FileResponse",
19
+ "HTMLResponse",
20
+ "JSONResponse",
21
+ "PlainTextResponse",
22
+ "RedirectResponse",
23
+ "Response",
24
+ "StreamingResponse",
25
+ ]
@@ -5,6 +5,7 @@ pyproject.toml
5
5
  requirements.txt
6
6
  setup.py
7
7
  vayuapi/__init__.py
8
+ vayuapi/response.py
8
9
  vayuapi/status.py
9
10
  vayuapi/admin/__init__.py
10
11
  vayuapi/admin/enhanced_panel.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes