nexy 0.0a1__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.
- nexy-0.0a1/LICENSE +21 -0
- nexy-0.0a1/PKG-INFO +124 -0
- nexy-0.0a1/README.md +111 -0
- nexy-0.0a1/nexy/__init__.py +5 -0
- nexy-0.0a1/nexy/app.py +15 -0
- nexy-0.0a1/nexy/components.py +72 -0
- nexy-0.0a1/nexy/hooks.py +5 -0
- nexy-0.0a1/nexy/router.py +63 -0
- nexy-0.0a1/nexy/utils.py +27 -0
- nexy-0.0a1/pyproject.toml +15 -0
nexy-0.0a1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Espoir Loém
|
|
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.
|
nexy-0.0a1/PKG-INFO
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: nexy
|
|
3
|
+
Version: 0.0a1
|
|
4
|
+
Summary:
|
|
5
|
+
Author: Espoir-Loem
|
|
6
|
+
Author-email: hopcy.forcy@gmail.com
|
|
7
|
+
Requires-Python: >=3.13,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Requires-Dist: fastapi (>=0.115.6,<0.116.0)
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# 🌟 **Nexy**
|
|
15
|
+
|
|
16
|
+
Bienvenue dans l'univers de **Nexy**, un framework de développement back-end **innovant et performant**, conçu pour **optimiser votre productivité**.
|
|
17
|
+
🚀 **Simplicité**, 🌍 **dynamisme**, et **efficacité maximale** : Nexy vous permet de **concevoir, tester et déployer vos applications** avec rapidité et fluidité, tout en réduisant la complexité du processus de développement.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### **🧩 Pourquoi Choisir Nexy ?**
|
|
22
|
+
|
|
23
|
+
👉 **Configuration simplifiée** : La structure de vos dossiers se transforme automatiquement en un routeur, sans nécessiter de décorateurs ou d'importations complexes.
|
|
24
|
+
|
|
25
|
+
👉 **Gagnez du temps** : Ajoutez simplement un fichier ou un dossier dans `app/`, et Nexy génère les routes pour vous, automatiquement.
|
|
26
|
+
|
|
27
|
+
👉 **Simplicité et puissance** : Libérez-vous des contraintes inutiles pour vous concentrer sur l’essentiel — votre logique métier.
|
|
28
|
+
|
|
29
|
+
👉 **Un projet open-source, une communauté engagée** : Nexy est un projet open-source, conçu avec passion ❤️. Rejoignez notre communauté pour contribuer et façonner l'avenir du développement web.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### **📂 Structure de Projet avec Nexy**
|
|
34
|
+
|
|
35
|
+
Voici comment structurer votre projet en utilisant Nexy :
|
|
36
|
+
|
|
37
|
+
```plaintext
|
|
38
|
+
nexy/
|
|
39
|
+
├── app/ # Dossier contenant les contrôleurs et routes
|
|
40
|
+
│ ├── controller.py # Route par défaut /
|
|
41
|
+
│ ├── documents/ # Dossier pour /documents
|
|
42
|
+
│ │ ├── controller.py # Route /documents
|
|
43
|
+
│ │ └── [documentId]/ # Dossier dynamique pour /documents/{documentId}
|
|
44
|
+
│ │ └── controller.py # Route /documents/{documentId}
|
|
45
|
+
│ └── users/ # Dossier pour /users
|
|
46
|
+
│ └── controller.py # Route /users
|
|
47
|
+
└── main.py # Fichier de configuration de Nexy
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
📝 **Chaque fichier `controller.py`** définit les routes de la section correspondante.
|
|
51
|
+
🎯 **La structure des dossiers correspond aux routes de l'API**, générées automatiquement.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### **🌐 Exemple de Code avec Nexy**
|
|
56
|
+
|
|
57
|
+
#### **Route par défaut `/`**
|
|
58
|
+
|
|
59
|
+
**Fichier** : `app/controller.py`
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
async def GET():
|
|
63
|
+
return {"message": "Bienvenue sur l'API Nexy"}
|
|
64
|
+
|
|
65
|
+
async def POST(data: dict):
|
|
66
|
+
return {"message": "Données reçues avec succès", "data": data}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
#### **Route dynamique pour `/documents/{documentId}` avec WebSocket**
|
|
72
|
+
|
|
73
|
+
**Fichier** : `app/documents/[documentId]/controller.py`
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
async def GET(documentId: int):
|
|
77
|
+
return {"documentId": documentId, "message": "Voici votre document"}
|
|
78
|
+
|
|
79
|
+
async def PUT(documentId: int, document: dict):
|
|
80
|
+
return {"message": "Document mis à jour", "documentId": documentId, "document": document}
|
|
81
|
+
|
|
82
|
+
async def DELETE(documentId: int):
|
|
83
|
+
return {"message": f"Document {documentId} supprimé"}
|
|
84
|
+
|
|
85
|
+
async def Socket(websocket):
|
|
86
|
+
await websocket.accept()
|
|
87
|
+
await websocket.send_text("Connexion WebSocket établie.")
|
|
88
|
+
await websocket.close()
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
#### **Route pour `/users`**
|
|
94
|
+
|
|
95
|
+
**Fichier** : `app/users/controller.py`
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
async def GET():
|
|
99
|
+
return {"message": "Liste des utilisateurs"}
|
|
100
|
+
|
|
101
|
+
async def POST(user: dict):
|
|
102
|
+
return {"message": "Nouvel utilisateur ajouté", "user": user}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### **✨ Pourquoi Contribuer à Nexy ?**
|
|
108
|
+
|
|
109
|
+
🚀 **Rejoignez une aventure passionnante** : Nexy est en constante évolution, et nous avons besoin de votre expertise pour continuer à repousser les limites de l'innovation.
|
|
110
|
+
🤝 **Collaborez avec une communauté dynamique** : Venez partager vos idées et apprendre aux côtés de développeurs de talent.
|
|
111
|
+
🌟 **Participez à un projet qui transforme l’industrie** : Votre contribution pourrait simplifier la vie de milliers de développeurs à travers le monde.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### **💬 Un Message pour Vous, Contributeurs et Passionnés**
|
|
116
|
+
|
|
117
|
+
**Nexy est conçu pour vous** 💛. Que vous soyez débutant ou expert, ce framework est pensé pour rendre le développement **plus intuitif, rapide et agréable**.
|
|
118
|
+
|
|
119
|
+
👉 **Testez-le dès aujourd’hui** : Téléchargez Nexy et découvrez sa simplicité.
|
|
120
|
+
👉 **Envie de contribuer ?** Rejoignez-nous sur [GitHub](#) et aidez-nous à bâtir le framework full-stack de demain.
|
|
121
|
+
|
|
122
|
+
**💡 Nexy : Simplifions ensemble le développement web avec Python.** 🌍✨
|
|
123
|
+
|
|
124
|
+
|
nexy-0.0a1/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
|
|
2
|
+
# 🌟 **Nexy**
|
|
3
|
+
|
|
4
|
+
Bienvenue dans l'univers de **Nexy**, un framework de développement back-end **innovant et performant**, conçu pour **optimiser votre productivité**.
|
|
5
|
+
🚀 **Simplicité**, 🌍 **dynamisme**, et **efficacité maximale** : Nexy vous permet de **concevoir, tester et déployer vos applications** avec rapidité et fluidité, tout en réduisant la complexité du processus de développement.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### **🧩 Pourquoi Choisir Nexy ?**
|
|
10
|
+
|
|
11
|
+
👉 **Configuration simplifiée** : La structure de vos dossiers se transforme automatiquement en un routeur, sans nécessiter de décorateurs ou d'importations complexes.
|
|
12
|
+
|
|
13
|
+
👉 **Gagnez du temps** : Ajoutez simplement un fichier ou un dossier dans `app/`, et Nexy génère les routes pour vous, automatiquement.
|
|
14
|
+
|
|
15
|
+
👉 **Simplicité et puissance** : Libérez-vous des contraintes inutiles pour vous concentrer sur l’essentiel — votre logique métier.
|
|
16
|
+
|
|
17
|
+
👉 **Un projet open-source, une communauté engagée** : Nexy est un projet open-source, conçu avec passion ❤️. Rejoignez notre communauté pour contribuer et façonner l'avenir du développement web.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### **📂 Structure de Projet avec Nexy**
|
|
22
|
+
|
|
23
|
+
Voici comment structurer votre projet en utilisant Nexy :
|
|
24
|
+
|
|
25
|
+
```plaintext
|
|
26
|
+
nexy/
|
|
27
|
+
├── app/ # Dossier contenant les contrôleurs et routes
|
|
28
|
+
│ ├── controller.py # Route par défaut /
|
|
29
|
+
│ ├── documents/ # Dossier pour /documents
|
|
30
|
+
│ │ ├── controller.py # Route /documents
|
|
31
|
+
│ │ └── [documentId]/ # Dossier dynamique pour /documents/{documentId}
|
|
32
|
+
│ │ └── controller.py # Route /documents/{documentId}
|
|
33
|
+
│ └── users/ # Dossier pour /users
|
|
34
|
+
│ └── controller.py # Route /users
|
|
35
|
+
└── main.py # Fichier de configuration de Nexy
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
📝 **Chaque fichier `controller.py`** définit les routes de la section correspondante.
|
|
39
|
+
🎯 **La structure des dossiers correspond aux routes de l'API**, générées automatiquement.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### **🌐 Exemple de Code avec Nexy**
|
|
44
|
+
|
|
45
|
+
#### **Route par défaut `/`**
|
|
46
|
+
|
|
47
|
+
**Fichier** : `app/controller.py`
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
async def GET():
|
|
51
|
+
return {"message": "Bienvenue sur l'API Nexy"}
|
|
52
|
+
|
|
53
|
+
async def POST(data: dict):
|
|
54
|
+
return {"message": "Données reçues avec succès", "data": data}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
#### **Route dynamique pour `/documents/{documentId}` avec WebSocket**
|
|
60
|
+
|
|
61
|
+
**Fichier** : `app/documents/[documentId]/controller.py`
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
async def GET(documentId: int):
|
|
65
|
+
return {"documentId": documentId, "message": "Voici votre document"}
|
|
66
|
+
|
|
67
|
+
async def PUT(documentId: int, document: dict):
|
|
68
|
+
return {"message": "Document mis à jour", "documentId": documentId, "document": document}
|
|
69
|
+
|
|
70
|
+
async def DELETE(documentId: int):
|
|
71
|
+
return {"message": f"Document {documentId} supprimé"}
|
|
72
|
+
|
|
73
|
+
async def Socket(websocket):
|
|
74
|
+
await websocket.accept()
|
|
75
|
+
await websocket.send_text("Connexion WebSocket établie.")
|
|
76
|
+
await websocket.close()
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
#### **Route pour `/users`**
|
|
82
|
+
|
|
83
|
+
**Fichier** : `app/users/controller.py`
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
async def GET():
|
|
87
|
+
return {"message": "Liste des utilisateurs"}
|
|
88
|
+
|
|
89
|
+
async def POST(user: dict):
|
|
90
|
+
return {"message": "Nouvel utilisateur ajouté", "user": user}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### **✨ Pourquoi Contribuer à Nexy ?**
|
|
96
|
+
|
|
97
|
+
🚀 **Rejoignez une aventure passionnante** : Nexy est en constante évolution, et nous avons besoin de votre expertise pour continuer à repousser les limites de l'innovation.
|
|
98
|
+
🤝 **Collaborez avec une communauté dynamique** : Venez partager vos idées et apprendre aux côtés de développeurs de talent.
|
|
99
|
+
🌟 **Participez à un projet qui transforme l’industrie** : Votre contribution pourrait simplifier la vie de milliers de développeurs à travers le monde.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### **💬 Un Message pour Vous, Contributeurs et Passionnés**
|
|
104
|
+
|
|
105
|
+
**Nexy est conçu pour vous** 💛. Que vous soyez débutant ou expert, ce framework est pensé pour rendre le développement **plus intuitif, rapide et agréable**.
|
|
106
|
+
|
|
107
|
+
👉 **Testez-le dès aujourd’hui** : Téléchargez Nexy et découvrez sa simplicité.
|
|
108
|
+
👉 **Envie de contribuer ?** Rejoignez-nous sur [GitHub](#) et aidez-nous à bâtir le framework full-stack de demain.
|
|
109
|
+
|
|
110
|
+
**💡 Nexy : Simplifions ensemble le développement web avec Python.** 🌍✨
|
|
111
|
+
|
nexy-0.0a1/nexy/app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from fastapi import FastAPI
|
|
2
|
+
from .router import Router
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def Nexy(title: str = "Nexy",**args):
|
|
8
|
+
# Configurer le cache
|
|
9
|
+
app:FastAPI = FastAPI(title,**args)
|
|
10
|
+
cache_dir = Path('./__nexy__')
|
|
11
|
+
cache_dir.mkdir(exist_ok=True)
|
|
12
|
+
sys.pycache_prefix = str(cache_dir)
|
|
13
|
+
Router(appModule=app)
|
|
14
|
+
return app
|
|
15
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
class Component:
|
|
2
|
+
def __init__(self, children=None, tagName: str = "", tagNameList = [], **attributes):
|
|
3
|
+
self.type = tagName
|
|
4
|
+
self.children = children or []
|
|
5
|
+
self.attributes = attributes
|
|
6
|
+
self.tagNameList= tagNameList
|
|
7
|
+
|
|
8
|
+
def __str__(self):
|
|
9
|
+
# Convertir chaque enfant en sa représentation HTML
|
|
10
|
+
children_html = ''.join(str(child) for child in self.children)
|
|
11
|
+
# Générer les attributs de la balise
|
|
12
|
+
attrs = ' '.join(f'{k.replace("_", "-")}="{v}"' for k, v in self.attributes.items())
|
|
13
|
+
# Retourner la balise complète
|
|
14
|
+
|
|
15
|
+
return f'<{self.type} {attrs}>{children_html}</{self.type}>'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Text(Component):
|
|
19
|
+
def __init__(self, content=None, type="span", **attributes):
|
|
20
|
+
super().__init__(tagName=type, children=content,**attributes)
|
|
21
|
+
|
|
22
|
+
class Button(Component):
|
|
23
|
+
def __init__(self, children=None, type="button", **attributes):
|
|
24
|
+
super().__init__(tagName="button", children=children, type=type ,**attributes)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Link(Component):
|
|
28
|
+
pass
|
|
29
|
+
class Container(Component):
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
class Image(Component):
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
class Audio(Component):
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
class Video(Component):
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
class Column(Component):
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
class Row(Component):
|
|
45
|
+
pass
|
|
46
|
+
|
|
47
|
+
class Flex(Component):
|
|
48
|
+
pass
|
|
49
|
+
|
|
50
|
+
class Grid(Component):
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
class Table(Component):
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
class Head(Component):
|
|
57
|
+
pass
|
|
58
|
+
|
|
59
|
+
class Media(Component):
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
class Dialog(Component):
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
class Form(Component):
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
class Section(Component):
|
|
69
|
+
pass
|
|
70
|
+
|
|
71
|
+
class Header(Component):
|
|
72
|
+
pass
|
nexy-0.0a1/nexy/hooks.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from fastapi import FastAPI
|
|
3
|
+
from .utils import deleteFistDotte, dynamicRoute,importModule,convertPathToModulePath
|
|
4
|
+
|
|
5
|
+
#
|
|
6
|
+
def FIND_ROUTES(base_path):
|
|
7
|
+
routes:list = []
|
|
8
|
+
|
|
9
|
+
# Verify if the 'app' folder exists
|
|
10
|
+
if os.path.exists(base_path) and os.path.isdir(base_path):
|
|
11
|
+
# Explore the 'app' folder and its subfolders
|
|
12
|
+
for root, dirs, files in os.walk(base_path):
|
|
13
|
+
#supprimers des _folder
|
|
14
|
+
dirs[:] = [d for d in dirs if not d.startswith("_")]
|
|
15
|
+
|
|
16
|
+
route = {
|
|
17
|
+
"pathname": f"{'/' if os.path.basename(root) == base_path else '/' + deleteFistDotte(os.path.relpath(root, base_path).replace("\\","/"))}",
|
|
18
|
+
"dirName": root
|
|
19
|
+
}
|
|
20
|
+
controller = os.path.join(root, 'controller.py')
|
|
21
|
+
|
|
22
|
+
# Check for files and add to dictionary
|
|
23
|
+
if os.path.exists(controller):
|
|
24
|
+
route["module"] = convertPathToModulePath(f"{root}/controller")
|
|
25
|
+
|
|
26
|
+
routes.append(route)
|
|
27
|
+
|
|
28
|
+
return routes
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def Router(appModule: FastAPI, appFolder:str = "app"):
|
|
34
|
+
"""
|
|
35
|
+
Charge dynamiquement les routes à partir du répertoire 'app'.
|
|
36
|
+
"""
|
|
37
|
+
# Parcours des répertoires dans 'app'
|
|
38
|
+
routes = FIND_ROUTES(base_path=appFolder);
|
|
39
|
+
HTTP_METHODES:tuple = ("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS");
|
|
40
|
+
for route in routes:
|
|
41
|
+
|
|
42
|
+
pathname = dynamicRoute(route_in=route["pathname"]);
|
|
43
|
+
|
|
44
|
+
if "module" in route:
|
|
45
|
+
|
|
46
|
+
module = importModule(path=route["module"]);
|
|
47
|
+
for attr_name in dir(module):
|
|
48
|
+
attr = getattr(module, attr_name)
|
|
49
|
+
|
|
50
|
+
# Vérifie que l'attribut est une fonction utilisable par FastAPI
|
|
51
|
+
if callable(attr) and hasattr(attr, "__annotations__"):
|
|
52
|
+
# Ajout de la route pour chaque méthode HTTP
|
|
53
|
+
if attr_name in HTTP_METHODES:
|
|
54
|
+
|
|
55
|
+
method = attr_name
|
|
56
|
+
appModule.add_api_route(pathname, attr, methods=[method])
|
|
57
|
+
|
|
58
|
+
# Ajout d'une route WebSocket si la méthode 'Socket' existe
|
|
59
|
+
if attr_name == "Socket":
|
|
60
|
+
appModule.add_api_websocket(f"{pathname}/ws", attr)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
nexy-0.0a1/nexy/utils.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import importlib
|
|
3
|
+
#
|
|
4
|
+
def deleteFistDotte(string:str)-> str:
|
|
5
|
+
if string.startswith('.'):
|
|
6
|
+
return re.sub(r'^.', '', string)
|
|
7
|
+
else:
|
|
8
|
+
return string
|
|
9
|
+
|
|
10
|
+
def dynamicRoute(route_in:str)-> str:
|
|
11
|
+
|
|
12
|
+
# Remplacer [id] par {id}
|
|
13
|
+
route_out = re.sub(r"\[([^\]]+)\]", r"{\1}",route_in)
|
|
14
|
+
# Remplacer {_slug} par {slug:path} pour capturer plusieurs segments
|
|
15
|
+
route_out = re.sub(r"\{_([^\}]+)\}", r"{\1}:path", route_out)
|
|
16
|
+
|
|
17
|
+
return route_out
|
|
18
|
+
|
|
19
|
+
def convertPathToModulePath(path:str)->str:
|
|
20
|
+
return re.sub(r"\\|/", ".", path)
|
|
21
|
+
|
|
22
|
+
def importModule(path:str):
|
|
23
|
+
try:
|
|
24
|
+
module =importlib.import_module(path)
|
|
25
|
+
except ModuleNotFoundError as e:
|
|
26
|
+
print(f"Error importing module '{path}': {e}")
|
|
27
|
+
return module
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "nexy"
|
|
3
|
+
version = "0.0.alpha-0000000001"
|
|
4
|
+
description = ""
|
|
5
|
+
authors = ["Espoir-Loem <hopcy.forcy@gmail.com>"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
|
|
8
|
+
[tool.poetry.dependencies]
|
|
9
|
+
python = "^3.13"
|
|
10
|
+
fastapi = "^0.115.6"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
[build-system]
|
|
14
|
+
requires = ["poetry-core"]
|
|
15
|
+
build-backend = "poetry.core.masonry.api"
|