Skip to content

Commit 1e4b4b9

Browse files
committed
updated README.md
1 parent a8e687a commit 1e4b4b9

File tree

2 files changed

+100
-91
lines changed

2 files changed

+100
-91
lines changed

README.md

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,41 @@
1111
[![PyPI version](https://img.shields.io/pypi/v/ellar.svg)](https://pypi.python.org/pypi/ellar)
1212
[![PyPI version](https://img.shields.io/pypi/pyversions/ellar.svg)](https://pypi.python.org/pypi/ellar)
1313

14-
## Project Status
15-
Beta version
16-
- Documentation - 97% complete
17-
- Authorization Documentation - (in progress)
18-
19-
## Resources
20-
- [Documentation](https://python-ellar.github.io/ellar/)
21-
2214
## **Introduction**
2315

24-
Ellar is a lightweight ASGI framework for building efficient and scalable server-side python applications.
25-
It supports both OOP (Object-Oriented Programming) and FP (Functional Programming)
16+
Ellar is a lightweight ASGI framework designed to simplify the development of efficient and scalable server-side Python
17+
applications. Whether you're building web services, APIs, or full-fledged web applications,
18+
Ellar offers a high level of abstraction and powerful features to streamline your development process.
2619

27-
Ellar is based on [Starlette (ASGI toolkit)](https://www.starlette.io/), a lightweight ASGI framework/toolkit well-suited for developing asynchronous web services with Python.
20+
Ellar provides developers with the flexibility to embrace both Object-Oriented Programming (OOP) and Functional Programming (FP) paradigms.
21+
It is built on top of Starlette, a renowned ASGI toolkit, ensuring robust asynchronous request handling capabilities.
2822

29-
## **Features Summary**
23+
## **Key Features**
3024

31-
- **Easy to Use**: Ellar has a simple and intuitive API that makes it easy to get started with building a fast and scalable web applications or web APIs in Python.
32-
- **Dependency Injection (DI)**: It comes with DI system makes it easy to manage dependencies and reduce coupling between components.
33-
- **Pydantic Integration**: It is properly integrated with Pydantic, a popular Python library for data validation, to ensure that input data is valid.
34-
- **Templating with Jinja2**: Ellar provides built-in support for Jinja2 templates, making it easy to create dynamic web pages.
35-
- **OpenAPI Documentation**: It comes with built-in support for OpenAPI documentation, making it easy to generate `Swagger` or `ReDoc` documentation for your API. And more can be added with ease if necessary.
36-
- **Controller (MVC) Architecture**: Ellar's controller architecture follows the Model-View-Controller (MVC) pattern, making it easy to organize your code.
37-
- **Guards for Authentication and Authorization**: It provides built-in support for guards, allowing you to easily implement authentication and authorization in your application.
38-
- **Modularity**: Ellar follows a modular architecture inspired by NestJS, making it easy to organize your code into reusable modules.
39-
- **Asynchronous programming**: It allows you to takes advantage of Python's `async/await` feature to write efficient and fast code that can handle large numbers of concurrent requests
40-
41-
## **Dependencies**
42-
- Python >= 3.7
43-
- Starlette
44-
- Injector
45-
- Pydantic
25+
- **Easy to Use**: With an intuitive API, Ellar makes it easy for developers to get started with building fast and scalable Python web applications.
26+
- **Dependency Injection (DI)**: Ellar includes a built-in DI system, enabling easy management of dependencies and reducing coupling between components.
27+
- **Pydantic Integration**: Integrated with Pydantic for seamless data validation, ensuring that input data is always valid.
28+
- **Templating with Jinja2**: Built-in support for Jinja2 templates simplifies the creation of dynamic web pages.
29+
- **OpenAPI Documentation**: Ellar comes with built-in support for generating OpenAPI documentation, facilitating API documentation generation with Swagger or ReDoc.
30+
- **Controller (MVC) Architecture**: Ellar follows the Model-View-Controller (MVC) pattern, aiding in organizing code and separating concerns.
31+
- **Guards for Authentication and Authorization**: Offers built-in support for guards, making it easy to implement authentication and authorization in applications.
32+
- **Modularity**: Inspired by NestJS, Ellar follows a modular architecture, allowing developers to organize code into reusable modules.
33+
- **Asynchronous Programming**: Leveraging Python's async/await feature, Ellar enables the development of efficient and high-performance applications capable of handling concurrent requests.
4634

4735
## **Installation**
48-
```shell
36+
37+
You can install Ellar using pip:
38+
39+
```bash
4940
$(venv) pip install ellar
5041
```
5142

52-
## **Try This**
43+
## **Getting Started**
44+
5345
```python
46+
# Example code showcasing Ellar usage
47+
# (Please ensure you have properly installed Ellar first)
48+
5449
import uvicorn
5550
from ellar.common import Body, Controller, ControllerBase, delete, get, post, put, Serializer, Inject
5651
from ellar.app import AppFactory
@@ -59,33 +54,33 @@ from ellar.openapi import OpenAPIDocumentModule, OpenAPIDocumentBuilder, Swagger
5954
from pydantic import Field
6055
from pathlib import Path
6156

62-
57+
# Define a serializer for creating a car
6358
class CreateCarSerializer(Serializer):
6459
name: str
6560
year: int = Field(..., gt=0)
6661
model: str
6762

68-
63+
# Define a service class for car operations
6964
@injectable(scope=request_scope)
7065
class CarService:
7166
def __init__(self):
7267
self.detail = 'a service'
7368

74-
69+
# Define a controller for car operations
7570
@Controller
7671
class MotoController(ControllerBase):
7772
def __init__(self, service: CarService):
7873
self._service = service
7974

8075
@post()
81-
async def create(self, payload: Body[CreateCarSerializer]):
76+
async def create(self, payload: CreateCarSerializer = Body()):
8277
assert self._service.detail == 'a service'
8378
result = payload.dict()
8479
result.update(message='This action adds a new car')
8580
return result
8681

8782
@put('/{car_id:str}')
88-
async def update(self, car_id: str, payload: Body[CreateCarSerializer]):
83+
async def update(self, car_id: str, payload: CreateCarSerializer = Body()):
8984
result = payload.dict()
9085
result.update(message=f'This action updated #{car_id} car resource')
9186
return result
@@ -99,48 +94,52 @@ class MotoController(ControllerBase):
9994
async def delete(self, car_id: str):
10095
return f"This action removes a #{car_id} car"
10196

102-
97+
# Create the Ellar application
10398
app = AppFactory.create_app(
10499
controllers=[MotoController],
105100
providers=[CarService],
106101
base_directory=str(Path(__file__).parent),
107102
config_module=dict(REDIRECT_SLASHES=True),
108103
template_folder='templates'
109104
)
105+
106+
# Build OpenAPI documentation
110107
document_builder = OpenAPIDocumentBuilder()
111108
document_builder.set_title('Ellar API') \
112109
.set_version('1.0.2') \
113110
.set_contact(name='Author', url='https://www.yahoo.com', email='[email protected]') \
114111
.set_license('MIT Licence', url='https://www.google.com')
115-
116112
document = document_builder.build_document(app)
113+
114+
# Setup OpenAPI documentation module
117115
module = OpenAPIDocumentModule.setup(
118116
app=app,
119117
docs_ui=SwaggerUI(),
120118
document=document,
121119
guards=[]
122120
)
123121

124-
122+
# Run the application
125123
if __name__ == "__main__":
126124
uvicorn.run("main:app", port=5000, reload=True)
127125
```
128126

127+
129128
Now we can test our API at [http://127.0.0.1:5000/docs](http://127.0.0.1:5000/docs#/)
130129

131130
You can also try the [quick-project](https://python-ellar.github.io/ellar/quick-project/) setup to get a good idea of the library.
132131

133-
## **HTML Templating**
134-
Ellar has built-in support for Jinja2, which is a popular template engine for HTML. This feature allows for easy and efficient HTML templating similar to that of Flask. Jinja2 can be used to create reusable templates, and to insert dynamic data into HTML pages. It also has support for template inheritance, control structures, and other useful features that can help to simplify and streamline the process of creating HTML templates.
135-
136-
```html
137-
<html>
138-
<body>
139-
<ul>
140-
{% for item in items %}
141-
<li>{{ item }}</li>
142-
{% endfor %}
143-
</ul>
144-
</body>
145-
</html>
146-
```
132+
133+
## **Project Status**
134+
135+
Currently, Ellar is in beta version with the following status:
136+
- Documentation: 95% complete
137+
- Authentication and Authorization: In progress
138+
139+
## **Dependency Summary**
140+
141+
Ellar has the following dependencies:
142+
- Python >= 3.7
143+
- Starlette
144+
- Pydantic
145+
- Injector

docs/index.md

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,49 +12,42 @@
1212
[![PyPI version](https://img.shields.io/pypi/pyversions/ellar.svg)](https://pypi.python.org/pypi/ellar)
1313

1414
---
15-
## **Introduction**
16-
Ellar is a lightweight ASGI framework for building efficient and scalable server-side python applications.
17-
It supports both OOP (Object-Oriented Programming) and FP (Functional Programming)
1815

19-
Ellar is also a higher level of abstraction of [Starlette (ASGI toolkit)](https://www.starlette.io/){target="_blank"}, a lightweight ASGI framework/toolkit well-suited for developing asynchronous web services in Python.
16+
## **Introduction**
2017

21-
## **Inspiration**
22-
Ellar was deeply influenced by [NestJS](https://docs.nestjs.com/){target="_blank"} for its ease of use, project structures and patterns that aids in building small or complex project applications.
23-
Also, Ellar took some concepts from [FastAPI](https://fastapi.tiangolo.com/){target="_blank"} in terms of request parameter handling and data serialization with Pydantic.
18+
Ellar is a lightweight ASGI framework designed to simplify the development of efficient and scalable server-side Python
19+
applications. Whether you're building web services, APIs, or full-fledged web applications,
20+
Ellar offers a high level of abstraction and powerful features to streamline your development process.
2421

25-
The objective of Ellar is to provide a high level of abstracted interface to your python web app, along with a well-structured project setup, give room for object-oriented approach to web application design,
26-
allow you to choose your desired application architecture, and ultimately, deliver speedy handling to requests using any ASGI server.
22+
Ellar provides developers with the flexibility to embrace both Object-Oriented Programming (OOP) and Functional Programming (FP) paradigms.
23+
It is built on top of Starlette, a renowned ASGI toolkit, ensuring robust asynchronous request handling capabilities.
2724

28-
## **Project Status**
29-
Beta version
30-
- Documentation - 95% complete
31-
- Authentication and Authorization - (in progress)
32-
33-
## **Features Summary**
34-
35-
- **Easy to Use**: Ellar has a simple and intuitive API that makes it easy to get started with building a fast and scalable web applications or web APIs with Python.
36-
- **Dependency Injection (DI)**: It comes with DI system makes it easy to manage dependencies and reduce coupling between components.
37-
- **Pydantic Integration**: It is properly integrated with Pydantic, a popular Python library for data validation, to ensure that input data is valid.
38-
- **Templating with Jinja2**: Ellar provides built-in support for Jinja2 templates, making it easy to create dynamic web pages.
39-
- **OpenAPI Documentation**: It comes with built-in support for OpenAPI documentation, making it easy to generate `Swagger` or `ReDoc` documentation for your API. And more can be added with ease if necessary.
40-
- **Controller (MVC) Architecture**: Ellar's controller architecture follows the Model-View-Controller (MVC) pattern, making it easy to organize your code.
41-
- **Guards for Authentication and Authorization**: It provides built-in support for guards, allowing you to easily implement authentication and authorization in your application.
42-
- **Modularity**: Ellar follows a modular architecture inspired by NestJS, making it easy to organize your code into reusable modules.
43-
- **Asynchronous programming**: It allows you to takes advantage of Python's `async/await` feature to write efficient and fast code that can handle large numbers of concurrent requests
25+
## **Key Features**
4426

45-
## **Dependency Summary**
46-
- `Python >= 3.7`
47-
- `Starlette`
48-
- `Pydantic`
49-
- `Injector`
27+
- **Easy to Use**: With an intuitive API, Ellar makes it easy for developers to get started with building fast and scalable Python web applications.
28+
- **Dependency Injection (DI)**: Ellar includes a built-in DI system, enabling easy management of dependencies and reducing coupling between components.
29+
- **Pydantic Integration**: Integrated with Pydantic for seamless data validation, ensuring that input data is always valid.
30+
- **Templating with Jinja2**: Built-in support for Jinja2 templates simplifies the creation of dynamic web pages.
31+
- **OpenAPI Documentation**: Ellar comes with built-in support for generating OpenAPI documentation, facilitating API documentation generation with Swagger or ReDoc.
32+
- **Controller (MVC) Architecture**: Ellar follows the Model-View-Controller (MVC) pattern, aiding in organizing code and separating concerns.
33+
- **Guards for Authentication and Authorization**: Offers built-in support for guards, making it easy to implement authentication and authorization in applications.
34+
- **Modularity**: Inspired by NestJS, Ellar follows a modular architecture, allowing developers to organize code into reusable modules.
35+
- **Asynchronous Programming**: Leveraging Python's async/await feature, Ellar enables the development of efficient and high-performance applications capable of handling concurrent requests.
5036

5137
## **Installation**
52-
```shell
38+
39+
You can install Ellar using pip:
40+
41+
```bash
5342
$(venv) pip install ellar
5443
```
5544

56-
## **Try This**
45+
## **Getting Started**
46+
5747
```python
48+
# Example code showcasing Ellar usage
49+
# (Please ensure you have properly installed Ellar first)
50+
5851
import uvicorn
5952
from ellar.common import Body, Controller, ControllerBase, delete, get, post, put, Serializer, Inject
6053
from ellar.app import AppFactory
@@ -63,19 +56,19 @@ from ellar.openapi import OpenAPIDocumentModule, OpenAPIDocumentBuilder, Swagger
6356
from pydantic import Field
6457
from pathlib import Path
6558

66-
59+
# Define a serializer for creating a car
6760
class CreateCarSerializer(Serializer):
6861
name: str
6962
year: int = Field(..., gt=0)
7063
model: str
7164

72-
65+
# Define a service class for car operations
7366
@injectable(scope=request_scope)
7467
class CarService:
7568
def __init__(self):
7669
self.detail = 'a service'
7770

78-
71+
# Define a controller for car operations
7972
@Controller
8073
class MotoController(ControllerBase):
8174
def __init__(self, service: CarService):
@@ -103,33 +96,50 @@ class MotoController(ControllerBase):
10396
async def delete(self, car_id: str):
10497
return f"This action removes a #{car_id} car"
10598

106-
99+
# Create the Ellar application
107100
app = AppFactory.create_app(
108101
controllers=[MotoController],
109102
providers=[CarService],
110103
base_directory=str(Path(__file__).parent),
111104
config_module=dict(REDIRECT_SLASHES=True),
112105
template_folder='templates'
113106
)
107+
108+
# Build OpenAPI documentation
114109
document_builder = OpenAPIDocumentBuilder()
115110
document_builder.set_title('Ellar API') \
116111
.set_version('1.0.2') \
117112
.set_contact(name='Author', url='https://www.yahoo.com', email='[email protected]') \
118113
.set_license('MIT Licence', url='https://www.google.com')
119-
120114
document = document_builder.build_document(app)
115+
116+
# Setup OpenAPI documentation module
121117
module = OpenAPIDocumentModule.setup(
122118
app=app,
123119
docs_ui=SwaggerUI(),
124120
document=document,
125121
guards=[]
126122
)
127123

128-
124+
# Run the application
129125
if __name__ == "__main__":
130126
uvicorn.run("main:app", port=5000, reload=True)
131127
```
132128

133-
Now we can test our API at [http://127.0.0.1:5000/docs](http://127.0.0.1:5000/docs#/)
129+
## **Project Status**
130+
131+
Currently, Ellar is in beta version with the following status:
132+
- Documentation: 95% complete
133+
- Authentication and Authorization: In progress
134+
135+
## **Dependency Summary**
136+
137+
Ellar has the following dependencies:
138+
- Python >= 3.7
139+
- Starlette
140+
- Pydantic
141+
- Injector
142+
143+
## **Try It Out**
134144

135-
You can also try the [quick-project](quick-project.md) setup to get a good idea of the library.
145+
You can access the Ellar API documentation at [http://127.0.0.1:5000/docs](http://127.0.0.1:5000/docs#/). Additionally, you can try the [quick-project setup](quick-project.md) to get started quickly with Ellar.

0 commit comments

Comments
 (0)