|
2 | 2 | <a href="#" target="blank"><img src="img/EllarLogoIconOnly.png" width="200" alt="Ellar Logo" /></a> |
3 | 3 | </p> |
4 | 4 |
|
5 | | -<p align="center"> Ellar - Python ASGI web framework for building fast, efficient and scalable RESTAPIs and server-side application. </p> |
| 5 | +<p align="center"> Ellar CLI Tool for Scaffolding Ellar Projects and Modules and also running Ellar Commands</p> |
6 | 6 |
|
7 | | - |
8 | | - |
9 | | -[](https://badge.fury.io/py/ellar) |
10 | | -[](https://pypi.python.org/pypi/ellar) |
11 | | -[](https://pypi.python.org/pypi/ellar) |
| 7 | + |
| 8 | + |
| 9 | +[](https://badge.fury.io/py/ellar-cli) |
| 10 | +[](https://pypi.python.org/pypi/ellar-cli) |
| 11 | +[](https://pypi.python.org/pypi/ellar-cli) |
12 | 12 |
|
13 | | -## Features |
14 | | -- Pydantic integration |
15 | | -- DI Container |
16 | | -- Templating with Jinja2 |
17 | | -- OpenAPI Documentation (Swagger and ReDoc) |
18 | | -- Controller (MVC) |
19 | | -- Guards (Authentications, roles and permissions) |
20 | | -- Modularization (eg: flask blueprint) |
21 | | -- Websocket support |
22 | | -- Session and Cookie support |
23 | | -- CORS, GZip, Static Files, Streaming responses |
24 | | -- Test client built on `requests` |
25 | | -- In-process background tasks. |
26 | | -- Startup and shutdown events. |
27 | | -- Application Events |
28 | | -- Compatible with `asyncio` and `trio` backends. |
| 13 | +# Introduction |
| 14 | +Ellar CLI is an abstracted tool for ellar web framework that helps in standard project scaffold of the framework, module project scaffold, runing the project local server using uvicorn and runing custom command registered in application module or any ellar module. |
29 | 15 |
|
30 | 16 | ## Requirements |
31 | | -- Python >= 3.6 |
32 | | -- Starlette |
33 | | -- Pydantic |
34 | | -- Injector |
| 17 | +- Python >= 3.7 |
| 18 | +- Ellar |
35 | 19 |
|
36 | 20 | ## Installation |
37 | | - |
| 21 | +if you have [ellar](https://github.com/eadwinCode/ellar) install ready |
38 | 22 | ``` |
39 | | -pip install ellar |
| 23 | +pip install ellar-cli |
40 | 24 | ``` |
41 | | - |
42 | | -## Usage |
43 | | - |
44 | | -Create a file `controller.py`: |
45 | | - |
46 | | -```Python |
47 | | -from ellar.common import ModuleRouter, Controller, get |
48 | | - |
49 | | -router = ModuleRouter('', tag='Math') |
50 | | - |
51 | | - |
52 | | -@router.get("/add") |
53 | | -def add(request, a: int, b: int): |
54 | | - return {"result": a + b} |
55 | | - |
56 | | - |
57 | | -@Controller("", tag='Math') |
58 | | -class MathAPI: |
59 | | - |
60 | | - @get('/subtract', ) |
61 | | - def subtract(self, a: int, b: int): |
62 | | - """Subtracts a from b""" |
63 | | - return {"result": a - b} |
64 | | - |
65 | | - @get('/divide', ) |
66 | | - def divide(self, a: int, b: int): |
67 | | - """Divides a by b""" |
68 | | - return {"result": a / b} |
69 | | - |
70 | | - @get('/multiple', ) |
71 | | - def multiple(self, a: int, b: int): |
72 | | - """Multiples a with b""" |
73 | | - return {"result": a * b} |
74 | | - |
| 25 | +Full installation |
| 26 | +```shell |
| 27 | +pip install ellar-cli[full] |
75 | 28 | ``` |
76 | 29 |
|
77 | | -Create another file `server.py`: |
78 | | - |
79 | | -```Python |
80 | | -from ellar.core import AppFactory |
81 | | -from ellar.openapi import OpenAPIDocumentBuilder, OpenAPIDocumentModule |
82 | | -from .controller import router, MathAPI |
83 | | - |
84 | | - |
85 | | -app = AppFactory.create_app(routers=(router, ), controllers=(MathAPI, )) |
86 | | - |
87 | | -document_builder = OpenAPIDocumentBuilder() |
88 | | -document_builder.set_title('Your Title')\ |
89 | | - .set_version('1.0.2')\ |
90 | | - .set_contact( name='Eadwin', url='https://www.yahoo.com', email='[email protected]')\ |
91 | | - .set_license('MIT Licence', url='https://www.google.com') |
92 | | - |
93 | | -document = document_builder.build_document(app) |
94 | | -module = app.install_module(OpenAPIDocumentModule, document=document) |
95 | | -module.setup_swagger_doc() |
96 | | -``` |
| 30 | +## Usage |
97 | 31 |
|
98 | | -### Start up Server |
99 | | -```bash |
100 | | -uvicorn server:app --reload |
| 32 | +```shell |
| 33 | +ellar --help |
101 | 34 | ``` |
102 | | - |
103 | | -### Interactive API docs |
104 | | - |
105 | | -Now go to <a href="http://localhost:8000/docs/" target="_blank">http://localhost:8000/docs/</a> |
106 | | - |
107 | | -You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" target="_blank">Swagger UI</a>): |
108 | | - |
109 | | - |
110 | | - |
111 | | -## Status |
112 | | - |
113 | | -Project is still in development |
114 | | - |
115 | | -- Documentation - in progress |
116 | | -- Database Plugin with [Encode/ORM](https://github.com/encode/orm) |
117 | | -- Caching |
118 | | -- API Throttling |
0 commit comments