structure-aram 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl
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.
- structure_aram/cli.py +89 -0
- {structure_aram-0.1.4.dist-info → structure_aram-0.1.6.dist-info}/METADATA +19 -1
- {structure_aram-0.1.4.dist-info → structure_aram-0.1.6.dist-info}/RECORD +6 -5
- {structure_aram-0.1.4.dist-info → structure_aram-0.1.6.dist-info}/WHEEL +0 -0
- {structure_aram-0.1.4.dist-info → structure_aram-0.1.6.dist-info}/entry_points.txt +0 -0
- {structure_aram-0.1.4.dist-info → structure_aram-0.1.6.dist-info}/top_level.txt +0 -0
structure_aram/cli.py
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
import os
|
2
|
+
import sys
|
3
|
+
import re
|
4
|
+
|
5
|
+
def to_camel_case(name):
|
6
|
+
"""Convertit 'ma-super app' en 'MaSuperApp'"""
|
7
|
+
parts = re.split(r"[-_\s]+", name)
|
8
|
+
return ''.join(part.capitalize() for part in parts)
|
9
|
+
|
10
|
+
def to_snake_case(name):
|
11
|
+
"""Convertit 'MaSuper App' ou 'maSuper-App' en 'ma_super_app'"""
|
12
|
+
name = name.strip().lower().replace("-", "_").replace(" ", "_")
|
13
|
+
name = re.sub(r'__+', '_', name) # Enlève doublons de '_'
|
14
|
+
return name
|
15
|
+
|
16
|
+
def create_app(raw_name):
|
17
|
+
|
18
|
+
app_name = to_snake_case(raw_name)
|
19
|
+
camel_case_name = to_camel_case(raw_name)
|
20
|
+
|
21
|
+
os.makedirs(app_name, exist_ok=True)
|
22
|
+
os.makedirs(f"{app_name}/models", exist_ok=True)
|
23
|
+
os.makedirs(f"{app_name}/views", exist_ok=True)
|
24
|
+
os.makedirs(f"{app_name}/migrations", exist_ok=True)
|
25
|
+
os.makedirs(f"{app_name}/templates/{app_name}", exist_ok=True)
|
26
|
+
os.makedirs(f"{app_name}/static/{app_name}", exist_ok=True)
|
27
|
+
|
28
|
+
# Fichiers init
|
29
|
+
open(f"{app_name}/__init__.py", "w").close()
|
30
|
+
open(f"{app_name}/models/__init__.py", "w").write("# models here\n")
|
31
|
+
open(f"{app_name}/views/__init__.py", "w").write("# views here\n")
|
32
|
+
open(f"{app_name}/migrations/__init__.py", "w").close()
|
33
|
+
|
34
|
+
# Fichier urls.py
|
35
|
+
with open(f"{app_name}/urls.py", "w") as f:
|
36
|
+
f.write(
|
37
|
+
"from django.urls import path\n"
|
38
|
+
"# from .views import ...\n\n"
|
39
|
+
"urlpatterns = [\n"
|
40
|
+
" # path('', views.index, name='index'),\n"
|
41
|
+
"]\n"
|
42
|
+
)
|
43
|
+
|
44
|
+
# Fichier admin.py
|
45
|
+
with open(f"{app_name}/admin.py", "w") as f:
|
46
|
+
f.write("from django.contrib import admin\n\n# Register your models here.\n")
|
47
|
+
|
48
|
+
# Fichier apps.py
|
49
|
+
with open(f"{app_name}/apps.py", "w") as f:
|
50
|
+
f.write(
|
51
|
+
"from django.apps import AppConfig\n\n"
|
52
|
+
f"class {camel_case_name}Config(AppConfig):\n"
|
53
|
+
f" default_auto_field = 'django.db.models.BigAutoField'\n"
|
54
|
+
f" name = '{app_name}'\n"
|
55
|
+
)
|
56
|
+
|
57
|
+
# Fichier tests.py
|
58
|
+
with open(f"{app_name}/tests.py", "w") as f:
|
59
|
+
f.write(
|
60
|
+
"from django.test import TestCase\n\n"
|
61
|
+
"# Create your tests here.\n"
|
62
|
+
)
|
63
|
+
|
64
|
+
# Template HTML
|
65
|
+
with open(f"{app_name}/templates/{app_name}/index.html", "w") as f:
|
66
|
+
f.write(
|
67
|
+
"<!DOCTYPE html>\n<html>\n<head>\n"
|
68
|
+
" <title>My Template</title>\n"
|
69
|
+
"</head>\n<body>\n"
|
70
|
+
" <h1>Hello from template!</h1>\n"
|
71
|
+
"</body>\n</html>\n"
|
72
|
+
)
|
73
|
+
|
74
|
+
# Fichier CSS
|
75
|
+
with open(f"{app_name}/static/{app_name}/style.css", "w") as f:
|
76
|
+
f.write("/* Style de l'application */\nbody {\n font-family: sans-serif;\n}\n")
|
77
|
+
|
78
|
+
print(f"Application Django '{app_name}' créée avec succès !")
|
79
|
+
|
80
|
+
def main():
|
81
|
+
if len(sys.argv) < 2:
|
82
|
+
print("Usage : generate-app <nom_app>")
|
83
|
+
sys.exit(1)
|
84
|
+
else:
|
85
|
+
raw_name = ' '.join(sys.argv[1:]) # Supporte les noms avec espaces
|
86
|
+
create_app(raw_name)
|
87
|
+
|
88
|
+
if __name__ == "__main__":
|
89
|
+
main()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: structure_aram
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.6
|
4
4
|
Summary: Un petit package Django qui cree des app
|
5
5
|
Author: ynaffit_aes
|
6
6
|
Author-email: aramsamb02@gmail.com
|
@@ -19,7 +19,25 @@ Requires-Dist: django>=4.0
|
|
19
19
|
Dynamic: author
|
20
20
|
Dynamic: author-email
|
21
21
|
Dynamic: classifier
|
22
|
+
Dynamic: description
|
22
23
|
Dynamic: description-content-type
|
23
24
|
Dynamic: license
|
24
25
|
Dynamic: requires-dist
|
25
26
|
Dynamic: summary
|
27
|
+
|
28
|
+
DESCRIPTION structure_ara
|
29
|
+
|
30
|
+
`structure_aram` est un package Python qui inclut une commande en ligne `generate-app` pour faciliter la génération d’applications .
|
31
|
+
|
32
|
+
---
|
33
|
+
|
34
|
+
INSTALLATION
|
35
|
+
|
36
|
+
- Créez un environnement virtuel (optionnel mais recommandé) :
|
37
|
+
|
38
|
+
```bash
|
39
|
+
python3 -m venv venv
|
40
|
+
source venv/bin/activate
|
41
|
+
|
42
|
+
- installe le package avec pip install structure-aram
|
43
|
+
- genere ton application avec < generate-app "nom_app">
|
@@ -1,12 +1,13 @@
|
|
1
1
|
structure_aram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
structure_aram/admin.py,sha256=suMo4x8I3JBxAFBVIdE-5qnqZ6JAZV0FESABHOSc-vg,63
|
3
3
|
structure_aram/apps.py,sha256=TPOKVGm_k_hcXCWT-SGc7h39vBrZp8yDoR6JQYPieF8,159
|
4
|
+
structure_aram/cli.py,sha256=dOUjvhKAphfWLa_HR6huYEY1gEQQcg28yZp9t8_CvhI,2981
|
4
5
|
structure_aram/models.py,sha256=Vjc0p2XbAPgE6HyTF6vll98A4eDhA5AvaQqsc4kQ9AQ,57
|
5
6
|
structure_aram/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
|
6
7
|
structure_aram/views.py,sha256=xc1IQHrsij7j33TUbo-_oewy3vs03pw_etpBWaMYJl0,63
|
7
8
|
structure_aram/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
structure_aram-0.1.
|
9
|
-
structure_aram-0.1.
|
10
|
-
structure_aram-0.1.
|
11
|
-
structure_aram-0.1.
|
12
|
-
structure_aram-0.1.
|
9
|
+
structure_aram-0.1.6.dist-info/METADATA,sha256=P1CbI3yFXSw0S3IkNjfHpUG3F4JbLTOKS_475fiYcWg,1214
|
10
|
+
structure_aram-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
11
|
+
structure_aram-0.1.6.dist-info/entry_points.txt,sha256=HxA5u7jmc4ax5z5De4pCVEapEUiYXBJ1dtFDDj3i1JU,57
|
12
|
+
structure_aram-0.1.6.dist-info/top_level.txt,sha256=4aA5HRir82jtk_iMxrpRI4ZA3dZ0IyQS_gjfmZo2Hv4,15
|
13
|
+
structure_aram-0.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|