Skip to content

Commit 5181990

Browse files
committed
fix/feat: fix bugs in routing, add Router and methods, fix POST params
1 parent 49ce678 commit 5181990

File tree

25 files changed

+747
-372
lines changed

25 files changed

+747
-372
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy Sphinx documentation to Pages
1+
name: docs
22

33
on:
44
push:

CHANGELOG.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,189 @@
1+
commit 49ce678e2b66659829c44305be96bebb207d0c88
2+
Author: Alexeev Bronislav <[email protected]>
3+
Date: Sat Apr 19 05:38:28 2025 +0700
4+
5+
docs: fix docs
6+
7+
commit 1a52eb86933faa3aab4ca0391bdbb3ccaa60e399
8+
Author: Alexeev Bronislav <[email protected]>
9+
Date: Sat Apr 19 05:36:18 2025 +0700
10+
11+
docs: fix docs
12+
13+
commit 001f03b1d0bd9512205f017a3cf6ff0bc4e62f61
14+
Author: Alexeev Bronislav <[email protected]>
15+
Date: Sat Apr 19 05:35:53 2025 +0700
16+
17+
docs: fix docs
18+
19+
commit 4b280dbdadb94b101025a1c4cd1debcb40682f9e
20+
Author: Alexeev Bronislav <[email protected]>
21+
Date: Sat Apr 19 05:35:20 2025 +0700
22+
23+
docs: fix docs
24+
25+
commit 4fcfbed820c6a7f4d06299480a2b65cd61ff8474
26+
Author: Alexeev Bronislav <[email protected]>
27+
Date: Sat Apr 19 05:33:13 2025 +0700
28+
29+
docs: fix docs
30+
31+
commit 041cc01fcd57c027729cd51c34078b7b79f45cf9
32+
Author: Alexeev Bronislav <[email protected]>
33+
Date: Sat Apr 19 05:29:43 2025 +0700
34+
35+
docs: fix docs
36+
37+
commit cc525f956175b1bd06d776c44697183945a0d687
38+
Author: Alexeev Bronislav <[email protected]>
39+
Date: Sat Apr 19 05:27:46 2025 +0700
40+
41+
docs: fix docs
42+
43+
commit db1eddf4a9ad33e740f3760c38fc3d31b8e22cad
44+
Author: Alexeev Bronislav <[email protected]>
45+
Date: Sat Apr 19 05:26:10 2025 +0700
46+
47+
docs: fix docs
48+
49+
commit d87bf6dbd029b68d4efbce97dc7beb83f0d8a60e
50+
Author: Alexeev Bronislav <[email protected]>
51+
Date: Sat Apr 19 05:24:31 2025 +0700
52+
53+
docs: fix docs
54+
55+
commit 1ed6c5f9a3d37a8000d76a49db5a24925e6d25e2
56+
Author: Alexeev Bronislav <[email protected]>
57+
Date: Sat Apr 19 05:16:08 2025 +0700
58+
59+
docs: fix docs
60+
61+
commit 24398a84bc2382dd7b0e6b419ee00d88c803b27f
62+
Author: Alexeev Bronislav <[email protected]>
63+
Date: Sat Apr 19 05:10:34 2025 +0700
64+
65+
docs: fix docs
66+
67+
commit 476f066124fe17555b3dc57f52c645e10dd2fee4
68+
Author: Alexeev Bronislav <[email protected]>
69+
Date: Sat Apr 19 05:05:57 2025 +0700
70+
71+
docs: fix docs
72+
73+
commit 0ff329dfccd1cc02bebdea7b8c88f108132d62c6
74+
Author: Alexeev Bronislav <[email protected]>
75+
Date: Sat Apr 19 04:59:05 2025 +0700
76+
77+
docs: fix docs
78+
79+
commit 979ed16a4958c7d3db8c10349e2cb9fecc646084
80+
Author: Alexeev Bronislav <[email protected]>
81+
Date: Sat Apr 19 04:57:09 2025 +0700
82+
83+
docs: fix docs
84+
85+
commit 3d7a089eb7cead889f4d5eeb6c6cc8e23492ebf4
86+
Author: Alexeev Bronislav <[email protected]>
87+
Date: Sat Apr 19 04:55:24 2025 +0700
88+
89+
docs: fix docs
90+
91+
commit 614b39b01b3058c487a25efbd4d2a5376263d5fd
92+
Author: Alexeev Bronislav <[email protected]>
93+
Date: Sat Apr 19 04:53:47 2025 +0700
94+
95+
docs: fix docs
96+
97+
commit 13d501facb667ab00a136b334409a9ae2896baaf
98+
Author: Alexeev Bronislav <[email protected]>
99+
Date: Sat Apr 19 04:47:42 2025 +0700
100+
101+
docs: fix docs
102+
103+
commit 9e74c8ade2dea095684654da8b6e675e8be17d73
104+
Author: Alexeev Bronislav <[email protected]>
105+
Date: Sat Apr 19 04:46:32 2025 +0700
106+
107+
docs: fix docs
108+
109+
commit 4b846ef2b9d606c336e34aec93bb4da856bf7b99
110+
Author: Alexeev Bronislav <[email protected]>
111+
Date: Sat Apr 19 04:44:18 2025 +0700
112+
113+
docs: fix docs
114+
115+
commit f5e361ec9b7fcf010e06428b2acd1db53baeb234
116+
Author: Alexeev Bronislav <[email protected]>
117+
Date: Sat Apr 19 04:40:10 2025 +0700
118+
119+
docs: fix docs
120+
121+
commit 96dfdc7378e1eb3ef55ca49e261e21f3664d5129
122+
Author: Alexeev Bronislav <[email protected]>
123+
Date: Sat Apr 19 04:26:28 2025 +0700
124+
125+
docs: fix docs
126+
127+
commit 2ab8d904550924fc7fa56c15a04f38700eface97
128+
Author: Alexeev Bronislav <[email protected]>
129+
Date: Sat Apr 19 04:18:48 2025 +0700
130+
131+
docs: fix docs
132+
133+
commit 67f7b0c500f3f0e459380bfd533af4ff72d000a1
134+
Author: Alexeev Bronislav <[email protected]>
135+
Date: Sat Apr 19 04:14:03 2025 +0700
136+
137+
docs: fix docs
138+
139+
commit 5f965583ebd04823c571131493dbaa17cc45745e
140+
Author: Alexeev Bronislav <[email protected]>
141+
Date: Sat Apr 19 04:12:08 2025 +0700
142+
143+
docs: fix docs
144+
145+
commit 41dac6ce8a95bd16cade3eb720a36254046bf69d
146+
Author: Alexeev Bronislav <[email protected]>
147+
Date: Sat Apr 19 04:12:00 2025 +0700
148+
149+
docs: fix docs
150+
151+
commit 3b5f5b1270377ba2692adafa38fc171eee94ff69
152+
Author: Alexeev Bronislav <[email protected]>
153+
Date: Sat Apr 19 04:01:13 2025 +0700
154+
155+
docs: fix docs
156+
157+
commit 6ddbe7fd2160469b4b9dd922430fea45874f26fd
158+
Author: Alexeev Bronislav <[email protected]>
159+
Date: Sat Apr 19 04:01:01 2025 +0700
160+
161+
docs: fix docs
162+
163+
commit 1a9457e3bdb441f1434c992efd88be99fb3ef9ea
164+
Author: Alexeev Bronislav <[email protected]>
165+
Date: Sat Apr 19 03:53:59 2025 +0700
166+
167+
docs: fix docs
168+
169+
commit 5cc25cb35159d8a7b3bcc58f4de69331597d4c11
170+
Author: Alexeev Bronislav <[email protected]>
171+
Date: Sat Apr 19 03:38:29 2025 +0700
172+
173+
docs: improve docs, fix docstring
174+
175+
commit 1c14d452d47cccba45c538e4eb7038d6eaee13e3
176+
Author: Alexeev Bronislav <[email protected]>
177+
Date: Sat Apr 19 03:38:22 2025 +0700
178+
179+
docs: improve docs, fix docstring
180+
181+
commit 0b318f1c43676f9cd687611146638617ca367063
182+
Author: Alexeev Bronislav <[email protected]>
183+
Date: Sat Apr 19 00:20:51 2025 +0700
184+
185+
docs: fix and improve docs
186+
1187
commit b1d06ac4f498392c61dc0e12fccafccdf3aea127
2188
Author: Alexeev Bronislav <[email protected]>
3189
Date: Sat Apr 19 00:14:56 2025 +0700

README.md

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
<a href="https://alexeev-prog.github.io/pyEchoNext/"><strong>Explore the docs »</strong></a>
99
<br />
1010
<br />
11-
<a href="#-comparison-with-alternatives">Comparison with Alternatives</a>
12-
.
1311
<a href="#-why-choose-pyechonext">Why Choose pyEchoNext</a>
1412
·
1513
<a href="#-key-features">Key Features</a>
@@ -33,9 +31,13 @@
3331
<img src="https://img.shields.io/github/stars/alexeev-prog/pyEchoNext?style=for-the-badge">
3432
<img src="https://img.shields.io/github/issues/alexeev-prog/pyEchoNext?style=for-the-badge">
3533
<img src="https://img.shields.io/github/last-commit/alexeev-prog/pyEchoNext?style=for-the-badge">
36-
37-
<img src="https://img.shields.io/pypi/wheel/uvolution?style=for-the-badge">
38-
<img src="https://img.shields.io/badge/coverage-54%25-54%25?style=for-the-badge" alt="">
34+
<img src="https://github.com/alexeev-prog/pyEchoNext/actions/workflows/docs.yml/badge.svg">
35+
<img src="https://img.shields.io/pypi/wheel/uvolution?style=for-the-badge">
36+
<img src="https://img.shields.io/badge/coverage-54%25-54%25?style=for-the-badge" alt="">
37+
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/pyEchoNext?style=for-the-badge">
38+
<img alt="PyPI - Version" src="https://img.shields.io/pypi/v/pyEchoNext?style=for-the-badge">
39+
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/pyEchoNext?style=for-the-badge">
40+
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/alexeev-prog/pyEchoNext?style=for-the-badge">
3941
</p>
4042

4143
> EchoNext is a lightweight, fast and scalable web framework for Python
@@ -87,27 +89,6 @@ Welcome to **EchoNext**, where innovation meets simplicity! Are you tired of the
8789

8890
<p align="right">(<a href="#readme-top">back to top</a>)</p>
8991

90-
## 🌟 Comparison with Alternatives
91-
92-
| Feature | **pyEchoNext** | Flask | FastAPI | Django | Starlette |
93-
|---------------------------|---------------------|--------------|--------------|---------------|--------------|
94-
| Asynchronous Capabilities | COMING SOON || ✔️ || ✔️ |
95-
| Performance | 🔥 High | 🐢 Moderate | 🚀 Very High | 🐢 Moderate | 🚀 Very High |
96-
| Framework Weight | ✔️ | ✔️ | ✔️ | ❌ Heavy | ✔️ |
97-
| Ecosystem | 🛠️ Flexible | 🎨 Flexible | 🎨 Modular | ⚙️ Monolithic | ⚙️ Modular |
98-
| Ease of Use | ✔️ | ✔️ | ✔️ || ✔️ |
99-
| Configurability | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
100-
| Documentation Quality | 📚 Excellent | 📚 Good | 📚 Excellent | 📚 Very Good | 📚 Good |
101-
| Flexible Deployments | 🌍 Flexible | 🌍 Standard | 🌍 Standard | 🌍 Standard | 🌍 Flexible |
102-
| Testing Support | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
103-
| Community Size | 📢 Growing | 📢 Large | 📢 Growing | 📢 Large | 📢 Emerging |
104-
| Built-in Template Engine | ✔️ Jinja2 & builtin | ✔️ Jinja2 | ✔️ Jinja2 | ✔️ Django | ✔️ Jinja2 |
105-
| Task Queue Integration || ✔️ Celery | ✔️ Celery | ✔️ Celery | ✔️ Celery |
106-
| Static File Serving | 🚀 Built-in | 🌍 Manual | 🚀 Built-in | 🚀 Built-in | 🚀 Built-in |
107-
| Analytics Integration | ✔️ Easy | 🛠️ Manual | ✔️ Easy || ✔️ Easy |
108-
109-
📈 Note: Echonext excels in performance while staying lightweight, making it a top-notch choice for your next project!
110-
11192
## 📚 Key Features
11293

11394
- Intuitive API: Pythonic, object-oriented interface for interacting with routes and views.
@@ -148,7 +129,7 @@ Once installed, you can start using the library in your Python projects. Check o
148129

149130
<p align="right">(<a href="#readme-top">back to top</a>)</p>
150131

151-
## ⚙️ Depends Injection
132+
## ⚙️ Dependency Injection
152133
pyEchoNext is universal, and you are free to use any Dependency-Injection framework. But we recommend using the specially developed [echonextdi](https://github.com/alexeev-prog/echonext_di). It is simple and fast to use.
153134

154135
Install:

docs/conf.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import os
22
import sys
33

4-
sys.path.insert(0, os.path.abspath('.'))
5-
sys.path.insert(0, os.path.abspath('..'))
4+
sys.path.insert(0, os.path.abspath("."))
5+
sys.path.insert(0, os.path.abspath(".."))
66
sys.path.insert(0, os.path.abspath(os.path.join("..", "..")))
7-
sys.path.insert(0, os.path.abspath('../pyechonext'))
8-
sys.path.insert(0, os.path.abspath('pyechonext'))
7+
sys.path.insert(0, os.path.abspath("../pyechonext"))
8+
sys.path.insert(0, os.path.abspath("pyechonext"))
99

1010
project = "pyEchoNext"
1111
author = "name"
@@ -20,12 +20,12 @@
2020
"sphinx.ext.todo", # support TODO
2121
"sphinx.ext.coverage", # check docs coverage
2222
"sphinx.ext.ifconfig", # directives in docs
23-
'sphinx.ext.autosummary', # generating summary for code
24-
'sphinx.ext.intersphinx',
25-
'sphinx.ext.githubpages'
23+
"sphinx.ext.autosummary", # generating summary for code
24+
"sphinx.ext.intersphinx",
25+
"sphinx.ext.githubpages",
2626
]
2727

28-
pygments_style = 'gruvbox-dark'
28+
pygments_style = "gruvbox-dark"
2929

3030
html_theme = "furo" # theme
3131
html_static_path = ["_static"] # static dir
@@ -39,7 +39,7 @@ def skip(app, what, name, obj, would_skip, options):
3939
if name == "__init__":
4040
return False
4141
return would_skip
42-
42+
4343

4444
def setup(app):
4545
app.connect("autodoc-skip-member", skip)

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ detailed usage examples and API reference.
292292

293293
</p>
294294

295-
⚙️ Depends Injection
295+
⚙️ Dependency Injection
296296
--------------------
297297

298298
pyEchoNext is universal, and you are free to use any

examples/random_examples/webapp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from pyechonext.apidoc_ui import APIDocUI, APIDocumentation
22
from pyechonext.app import ApplicationType, EchoNext
33
from pyechonext.config import SettingsConfigType, SettingsLoader
4+
from pyechonext.logging import logger
45
from pyechonext.middleware import middlewares
56
from pyechonext.mvc.controllers import PageController
67
from pyechonext.template_engine.jinja import render_template
@@ -10,6 +11,7 @@
1011

1112
class UsersView(PageController):
1213
def get(self, request, response, **kwargs):
14+
logger.info("BOB USERS ANAN")
1315
return render_template(
1416
request,
1517
"index.html",

examples/simpleapi/app.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import os
2+
from random import randint
3+
4+
from pyechonext.app import ApplicationType, EchoNext
5+
from pyechonext.config import Settings
6+
from pyechonext.middleware import middlewares
7+
from pyechonext.mvc.controllers import PageController
8+
from pyechonext.mvc.routes import Router
9+
from pyechonext.response import Response
10+
from pyechonext.urls import URL
11+
12+
13+
class UsersPageController(PageController):
14+
def get(self, request, response, **kwargs):
15+
return Response(request, body={"users": "get"})
16+
17+
def post(self, request, response, **kwargs):
18+
return {"users": "post"}
19+
20+
21+
url_patterns = [URL(path="/users", controller=UsersPageController)]
22+
23+
settings = Settings(
24+
BASE_DIR=os.path.dirname(os.path.abspath(__file__)), TEMPLATES_DIR="templates"
25+
)
26+
27+
echonext = EchoNext(
28+
__name__,
29+
settings,
30+
middlewares,
31+
urls=url_patterns,
32+
application_type=ApplicationType.JSON,
33+
)
34+
35+
router = Router(prefix="/users")
36+
37+
38+
@router.route_page("/create", methods=["POST"], summary="create user")
39+
def create_user(request, response):
40+
return {"status": "user created", "username": request.POST.get("username")}
41+
42+
43+
@router.route_page("/get", methods=["GET"], summary="get user")
44+
def get_user(request, response):
45+
return {"status": randint(1, 1000), "params": request.GET}
46+
47+
48+
echonext.include_router(router)

0 commit comments

Comments
 (0)