amen-cli 0.1.0__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.
- amen_cli-0.1.0/LICENSE +43 -0
- amen_cli-0.1.0/PKG-INFO +189 -0
- amen_cli-0.1.0/README.md +144 -0
- amen_cli-0.1.0/amen/__init__.py +25 -0
- amen_cli-0.1.0/amen/cli.py +230 -0
- amen_cli-0.1.0/amen/frameworks.py +46 -0
- amen_cli-0.1.0/amen/templates/__init__.py +3 -0
- amen_cli-0.1.0/amen/templates/manager.py +617 -0
- amen_cli-0.1.0/amen_cli.egg-info/PKG-INFO +189 -0
- amen_cli-0.1.0/amen_cli.egg-info/SOURCES.txt +15 -0
- amen_cli-0.1.0/amen_cli.egg-info/dependency_links.txt +1 -0
- amen_cli-0.1.0/amen_cli.egg-info/entry_points.txt +2 -0
- amen_cli-0.1.0/amen_cli.egg-info/requires.txt +11 -0
- amen_cli-0.1.0/amen_cli.egg-info/top_level.txt +1 -0
- amen_cli-0.1.0/setup.cfg +4 -0
- amen_cli-0.1.0/setup.py +53 -0
- amen_cli-0.1.0/tests/test_project_creation.py +31 -0
amen_cli-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Modified MIT License with Attribution Requirements
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Tanaka Chinengundu
|
|
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, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
1. The above copyright notice, this permission notice, and the following attribution
|
|
12
|
+
requirements shall be included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
2. Attribution Requirements:
|
|
15
|
+
a. All copies or substantial portions of the Software must retain clear and visible
|
|
16
|
+
attribution to the original author, Tanaka Chinengundu.
|
|
17
|
+
b. The original author's name (Tanaka Chinengundu) must not be removed, modified,
|
|
18
|
+
or obscured in any derivative works or modifications of the Software.
|
|
19
|
+
c. Any modifications or derivative works must clearly indicate that changes have
|
|
20
|
+
been made from the original Software and must not imply endorsement by the
|
|
21
|
+
original author.
|
|
22
|
+
|
|
23
|
+
3. Liability and Responsibility:
|
|
24
|
+
a. The original author shall not be held responsible or liable for any damages,
|
|
25
|
+
losses, or consequences arising from the use, misuse, or failure of the Software,
|
|
26
|
+
whether in its original or modified form.
|
|
27
|
+
b. Users and modifiers of the Software assume all risks associated with its use,
|
|
28
|
+
including but not limited to data loss, system failure, or other damages.
|
|
29
|
+
c. Any modifications made to the Software are the sole responsibility of the modifier,
|
|
30
|
+
and the original author bears no responsibility for derivative works.
|
|
31
|
+
|
|
32
|
+
4. Additional Restrictions:
|
|
33
|
+
a. The Software may not be used in any way that implies endorsement by the original author.
|
|
34
|
+
b. The Software may not be used for illegal or malicious purposes.
|
|
35
|
+
c. Users must notify end users if they are using a modified version of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|
amen_cli-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: amen-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: composer-inspired Python web framework scaffolding tool
|
|
5
|
+
Home-page: https://github.com/taqsblaze/amen-cli
|
|
6
|
+
Author: Tanaka Chinengundu
|
|
7
|
+
Author-email: tanakah30@gmail.com
|
|
8
|
+
Project-URL: Bug Reports, https://github.com/taqsblaze/amen-cli/issues
|
|
9
|
+
Project-URL: Source, https://github.com/taqsblaze/amen-cli
|
|
10
|
+
Project-URL: Documentation, https://github.com/taqsblaze/amen-cli#readme
|
|
11
|
+
Keywords: python,web-framework,cli,scaffold,amen,composer,laravel,flask,django,fastapi,bottle,pyramid
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: click>=8.0.0
|
|
23
|
+
Requires-Dist: rich>=12.0.0
|
|
24
|
+
Requires-Dist: questionary>=1.10.0
|
|
25
|
+
Requires-Dist: virtualenv>=20.0.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=6.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=2.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=21.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: flake8>=3.9.0; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy>=0.900; extra == "dev"
|
|
32
|
+
Dynamic: author
|
|
33
|
+
Dynamic: author-email
|
|
34
|
+
Dynamic: classifier
|
|
35
|
+
Dynamic: description
|
|
36
|
+
Dynamic: description-content-type
|
|
37
|
+
Dynamic: home-page
|
|
38
|
+
Dynamic: keywords
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
Dynamic: project-url
|
|
41
|
+
Dynamic: provides-extra
|
|
42
|
+
Dynamic: requires-dist
|
|
43
|
+
Dynamic: requires-python
|
|
44
|
+
Dynamic: summary
|
|
45
|
+
|
|
46
|
+
# 🚀 AMEN CLI 
|
|
47
|
+
A composer-inspired Python Web Framework Scaffolding Tool that helps you create web applications with ease!
|
|
48
|
+
|
|
49
|
+
## ✨ Features
|
|
50
|
+
|
|
51
|
+
- 🎯 Interactive project setup wizard
|
|
52
|
+
- 🔧 Multiple framework support:
|
|
53
|
+
- Flask - Lightweight WSGI framework
|
|
54
|
+
- FastAPI - Modern, fast API framework
|
|
55
|
+
- Bottle - Simple micro web framework 🚧
|
|
56
|
+
- Pyramid - Flexible web framework 🚧
|
|
57
|
+
- 🎨 Project templates for both web apps and APIs
|
|
58
|
+
- 🔄 Automatic virtual environment setup
|
|
59
|
+
- 📦 Dependency management
|
|
60
|
+
- 🏗️ Structured project scaffolding
|
|
61
|
+
|
|
62
|
+
## 🛠️ Installation
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install amen-cli
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 📖 Usage
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Create a new project
|
|
72
|
+
amen create
|
|
73
|
+
|
|
74
|
+
# Follow the interactive prompts to:
|
|
75
|
+
# 1. Select a framework
|
|
76
|
+
# 2. Choose application type (webapp/api)
|
|
77
|
+
# 3. Name your project
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 🌟 Project Structure
|
|
81
|
+
|
|
82
|
+
When you create a project, AMEN generates:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
your-app/
|
|
86
|
+
├── venv/ # Virtual environment
|
|
87
|
+
├── app/ # Main application code
|
|
88
|
+
│ ├── templates/ # HTML templates (webapp)
|
|
89
|
+
│ └── static/ # Static files
|
|
90
|
+
│ ├── css/ # Stylesheets
|
|
91
|
+
│ └── js/ # JavaScript files
|
|
92
|
+
├── tests/ # Test directory
|
|
93
|
+
├── requirements.txt # Python dependencies
|
|
94
|
+
├── .env # Environment variables
|
|
95
|
+
└── README.md # Project documentation
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 🎯 Supported Frameworks
|
|
99
|
+
|
|
100
|
+
| Framework | Description | Default Port | Status |
|
|
101
|
+
|-----------|-------------|--------------|--------|
|
|
102
|
+
| Flask | Lightweight WSGI web framework | 5000 | ✅ |
|
|
103
|
+
| FastAPI | Modern, fast web framework | 8000 | ✅ |
|
|
104
|
+
| Django | High-level Python web framework | 8000 | ❌ |
|
|
105
|
+
| Bottle | Fast, simple micro framework | 8080 | 🚧 |
|
|
106
|
+
| Pyramid | Flexible web framework | 6543 | 🚧 |
|
|
107
|
+
|
|
108
|
+
## Work in Progress
|
|
109
|
+
Currently implementing support for additional web frameworks:
|
|
110
|
+
|
|
111
|
+
- **Bottle**: Integration in development
|
|
112
|
+
- **Pyramid**: Initial implementation phase
|
|
113
|
+
|
|
114
|
+
These frameworks will enable:
|
|
115
|
+
- Route mapping and handling
|
|
116
|
+
- Request/response processing
|
|
117
|
+
- Middleware integration
|
|
118
|
+
- Template rendering support
|
|
119
|
+
|
|
120
|
+
Check back for updates or follow the project's issues for implementation progress. Contributions are welcome!
|
|
121
|
+
|
|
122
|
+
> Note: For now, please use our stable implementations for Flask or FastAPI.
|
|
123
|
+
## 🚗 Quick Start
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Install AMEN CLI
|
|
127
|
+
pip install amen-cli
|
|
128
|
+
|
|
129
|
+
# Create a new project
|
|
130
|
+
amen create
|
|
131
|
+
|
|
132
|
+
# Follow the interactive prompts
|
|
133
|
+
|
|
134
|
+
# Navigate to your project
|
|
135
|
+
cd your-project-name
|
|
136
|
+
|
|
137
|
+
# Activate virtual environment
|
|
138
|
+
source venv/bin/activate # Linux/Mac
|
|
139
|
+
venv\Scripts\activate # Windows
|
|
140
|
+
|
|
141
|
+
# Run your application
|
|
142
|
+
python run.py
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 🔧 Development
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Clone the repository
|
|
149
|
+
git clone https://github.com/taqsblaze/amen-cli.git
|
|
150
|
+
|
|
151
|
+
# Install for development and testing
|
|
152
|
+
pip install -e .
|
|
153
|
+
pip install pytest pytest-cov
|
|
154
|
+
|
|
155
|
+
# Run tests
|
|
156
|
+
pytest
|
|
157
|
+
|
|
158
|
+
# Run tests with coverage
|
|
159
|
+
pytest
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## 🤝 Contributing
|
|
163
|
+
|
|
164
|
+
Contributions are welcome! Here's how:
|
|
165
|
+
|
|
166
|
+
1. Fork the repository
|
|
167
|
+
2. Create your feature branch: `git checkout -b feature/amazing-feature`
|
|
168
|
+
3. Make your changes
|
|
169
|
+
4. Push to the branch: `git push origin feature/amazing-feature`
|
|
170
|
+
5. Open a Pull Request
|
|
171
|
+
|
|
172
|
+
## 📝 License
|
|
173
|
+
|
|
174
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
175
|
+
|
|
176
|
+
## 👥 Contact & Support
|
|
177
|
+
|
|
178
|
+
- 🌐 [GitHub Repository](https://github.com/taqsblaze/amen-cli)
|
|
179
|
+
- 🐛 [Issue Tracker](https://github.com/taqsblaze/amen-cli/issues)
|
|
180
|
+
- 📧 [Send Email](mailto:tanakah30@gmail.com)
|
|
181
|
+
|
|
182
|
+
## ⭐ Credits
|
|
183
|
+
|
|
184
|
+
Created by [Tanaka Chinengundu](https://www.linkedin.com/in/taqsblaze)
|
|
185
|
+
Inspired by Laravel's elegant development experience
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
Made with ❤️ by Tanaka Chinengundu
|
amen_cli-0.1.0/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# 🚀 AMEN CLI 
|
|
2
|
+
A composer-inspired Python Web Framework Scaffolding Tool that helps you create web applications with ease!
|
|
3
|
+
|
|
4
|
+
## ✨ Features
|
|
5
|
+
|
|
6
|
+
- 🎯 Interactive project setup wizard
|
|
7
|
+
- 🔧 Multiple framework support:
|
|
8
|
+
- Flask - Lightweight WSGI framework
|
|
9
|
+
- FastAPI - Modern, fast API framework
|
|
10
|
+
- Bottle - Simple micro web framework 🚧
|
|
11
|
+
- Pyramid - Flexible web framework 🚧
|
|
12
|
+
- 🎨 Project templates for both web apps and APIs
|
|
13
|
+
- 🔄 Automatic virtual environment setup
|
|
14
|
+
- 📦 Dependency management
|
|
15
|
+
- 🏗️ Structured project scaffolding
|
|
16
|
+
|
|
17
|
+
## 🛠️ Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install amen-cli
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 📖 Usage
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Create a new project
|
|
27
|
+
amen create
|
|
28
|
+
|
|
29
|
+
# Follow the interactive prompts to:
|
|
30
|
+
# 1. Select a framework
|
|
31
|
+
# 2. Choose application type (webapp/api)
|
|
32
|
+
# 3. Name your project
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 🌟 Project Structure
|
|
36
|
+
|
|
37
|
+
When you create a project, AMEN generates:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
your-app/
|
|
41
|
+
├── venv/ # Virtual environment
|
|
42
|
+
├── app/ # Main application code
|
|
43
|
+
│ ├── templates/ # HTML templates (webapp)
|
|
44
|
+
│ └── static/ # Static files
|
|
45
|
+
│ ├── css/ # Stylesheets
|
|
46
|
+
│ └── js/ # JavaScript files
|
|
47
|
+
├── tests/ # Test directory
|
|
48
|
+
├── requirements.txt # Python dependencies
|
|
49
|
+
├── .env # Environment variables
|
|
50
|
+
└── README.md # Project documentation
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 🎯 Supported Frameworks
|
|
54
|
+
|
|
55
|
+
| Framework | Description | Default Port | Status |
|
|
56
|
+
|-----------|-------------|--------------|--------|
|
|
57
|
+
| Flask | Lightweight WSGI web framework | 5000 | ✅ |
|
|
58
|
+
| FastAPI | Modern, fast web framework | 8000 | ✅ |
|
|
59
|
+
| Django | High-level Python web framework | 8000 | ❌ |
|
|
60
|
+
| Bottle | Fast, simple micro framework | 8080 | 🚧 |
|
|
61
|
+
| Pyramid | Flexible web framework | 6543 | 🚧 |
|
|
62
|
+
|
|
63
|
+
## Work in Progress
|
|
64
|
+
Currently implementing support for additional web frameworks:
|
|
65
|
+
|
|
66
|
+
- **Bottle**: Integration in development
|
|
67
|
+
- **Pyramid**: Initial implementation phase
|
|
68
|
+
|
|
69
|
+
These frameworks will enable:
|
|
70
|
+
- Route mapping and handling
|
|
71
|
+
- Request/response processing
|
|
72
|
+
- Middleware integration
|
|
73
|
+
- Template rendering support
|
|
74
|
+
|
|
75
|
+
Check back for updates or follow the project's issues for implementation progress. Contributions are welcome!
|
|
76
|
+
|
|
77
|
+
> Note: For now, please use our stable implementations for Flask or FastAPI.
|
|
78
|
+
## 🚗 Quick Start
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Install AMEN CLI
|
|
82
|
+
pip install amen-cli
|
|
83
|
+
|
|
84
|
+
# Create a new project
|
|
85
|
+
amen create
|
|
86
|
+
|
|
87
|
+
# Follow the interactive prompts
|
|
88
|
+
|
|
89
|
+
# Navigate to your project
|
|
90
|
+
cd your-project-name
|
|
91
|
+
|
|
92
|
+
# Activate virtual environment
|
|
93
|
+
source venv/bin/activate # Linux/Mac
|
|
94
|
+
venv\Scripts\activate # Windows
|
|
95
|
+
|
|
96
|
+
# Run your application
|
|
97
|
+
python run.py
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 🔧 Development
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Clone the repository
|
|
104
|
+
git clone https://github.com/taqsblaze/amen-cli.git
|
|
105
|
+
|
|
106
|
+
# Install for development and testing
|
|
107
|
+
pip install -e .
|
|
108
|
+
pip install pytest pytest-cov
|
|
109
|
+
|
|
110
|
+
# Run tests
|
|
111
|
+
pytest
|
|
112
|
+
|
|
113
|
+
# Run tests with coverage
|
|
114
|
+
pytest
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## 🤝 Contributing
|
|
118
|
+
|
|
119
|
+
Contributions are welcome! Here's how:
|
|
120
|
+
|
|
121
|
+
1. Fork the repository
|
|
122
|
+
2. Create your feature branch: `git checkout -b feature/amazing-feature`
|
|
123
|
+
3. Make your changes
|
|
124
|
+
4. Push to the branch: `git push origin feature/amazing-feature`
|
|
125
|
+
5. Open a Pull Request
|
|
126
|
+
|
|
127
|
+
## 📝 License
|
|
128
|
+
|
|
129
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
130
|
+
|
|
131
|
+
## 👥 Contact & Support
|
|
132
|
+
|
|
133
|
+
- 🌐 [GitHub Repository](https://github.com/taqsblaze/amen-cli)
|
|
134
|
+
- 🐛 [Issue Tracker](https://github.com/taqsblaze/amen-cli/issues)
|
|
135
|
+
- 📧 [Send Email](mailto:tanakah30@gmail.com)
|
|
136
|
+
|
|
137
|
+
## ⭐ Credits
|
|
138
|
+
|
|
139
|
+
Created by [Tanaka Chinengundu](https://www.linkedin.com/in/taqsblaze)
|
|
140
|
+
Inspired by Laravel's elegant development experience
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
Made with ❤️ by Tanaka Chinengundu
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""AMEN CLI - Python Web Framework Scaffolding Tool"""
|
|
2
|
+
__version__ = "0.1.0"
|
|
3
|
+
__author__ = "Tanaka Chinengundu"
|
|
4
|
+
|
|
5
|
+
__description__ = "A composer-inspired Python Web Framework Scaffolding Tool"
|
|
6
|
+
__license__ = "Modified MIT with Attribution Requirements"
|
|
7
|
+
__copyright__ = "Copyright (c) 2025 Tanaka Chinengundu"
|
|
8
|
+
__email__ = "tanakah30@gmail.com"
|
|
9
|
+
__url__ = "https://github.com/taqsblaze/amen-cli"
|
|
10
|
+
__docs__ = "https://github.com/taqsblaze/amen-cli/#readme"
|
|
11
|
+
__python_requires__ = ">=3.7"
|
|
12
|
+
|
|
13
|
+
SUPPORTED_FRAMEWORKS = {
|
|
14
|
+
"flask": {"version": ">=2.0.0", "port": 5000},
|
|
15
|
+
"fastapi": {"version": ">=0.68.0", "port": 8000}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
# Package status
|
|
19
|
+
__status__ = "Development"
|
|
20
|
+
__maintainer__ = "Tanaka Chinengundu"
|
|
21
|
+
__credits__ = ["Tanaka Chinengundu"]
|
|
22
|
+
|
|
23
|
+
# Feature flags
|
|
24
|
+
ENABLE_LOGGING = True
|
|
25
|
+
DEBUG_MODE = True
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import subprocess
|
|
4
|
+
import venv
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
import questionary
|
|
9
|
+
from rich.console import Console
|
|
10
|
+
from rich.panel import Panel
|
|
11
|
+
from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
12
|
+
|
|
13
|
+
from .frameworks import FRAMEWORKS
|
|
14
|
+
from .templates import TemplateManager
|
|
15
|
+
|
|
16
|
+
console = Console()
|
|
17
|
+
|
|
18
|
+
VALID_FRAMEWORKS = ['flask', 'fastapi', 'bottle', 'pyramid']
|
|
19
|
+
VALID_PROJECT_TYPES = ['webapp', 'api']
|
|
20
|
+
|
|
21
|
+
def create_project(path, framework, project_type):
|
|
22
|
+
"""
|
|
23
|
+
Create a new project with the specified framework and type.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
path (str): Project directory path
|
|
27
|
+
framework (str): Web framework to use
|
|
28
|
+
project_type (str): Type of project (webapp/api)
|
|
29
|
+
"""
|
|
30
|
+
if framework not in VALID_FRAMEWORKS:
|
|
31
|
+
raise ValueError(f"Invalid framework. Choose from: {VALID_FRAMEWORKS}")
|
|
32
|
+
|
|
33
|
+
if project_type not in VALID_PROJECT_TYPES:
|
|
34
|
+
raise ValueError(f"Invalid project type. Choose from: {VALID_PROJECT_TYPES}")
|
|
35
|
+
|
|
36
|
+
# Create project directory
|
|
37
|
+
os.makedirs(path, exist_ok=True)
|
|
38
|
+
|
|
39
|
+
# Create basic structure
|
|
40
|
+
os.makedirs(os.path.join(path, "app"), exist_ok=True)
|
|
41
|
+
os.makedirs(os.path.join(path, "app", "templates"), exist_ok=True)
|
|
42
|
+
os.makedirs(os.path.join(path, "app", "static"), exist_ok=True)
|
|
43
|
+
|
|
44
|
+
# Create empty files
|
|
45
|
+
open(os.path.join(path, "requirements.txt"), 'a').close()
|
|
46
|
+
open(os.path.join(path, "README.md"), 'a').close()
|
|
47
|
+
|
|
48
|
+
class AmenCLI:
|
|
49
|
+
def __init__(self):
|
|
50
|
+
self.template_manager = TemplateManager()
|
|
51
|
+
|
|
52
|
+
def welcome_banner(self):
|
|
53
|
+
"""Display welcome banner"""
|
|
54
|
+
console.print(Panel.fit(
|
|
55
|
+
"""AMEN: composer-inspired Python Web Framework Scaffolding
|
|
56
|
+
Create your web applications with ease!
|
|
57
|
+
By [bold magenta]Tanaka Chinengundu[/bold magenta]
|
|
58
|
+
[bold blue]
|
|
59
|
+
""",
|
|
60
|
+
border_style="magenta"
|
|
61
|
+
))
|
|
62
|
+
console.print()
|
|
63
|
+
|
|
64
|
+
def select_framework(self) -> str:
|
|
65
|
+
"""Interactive framework selection"""
|
|
66
|
+
frameworks = list(FRAMEWORKS.keys())
|
|
67
|
+
|
|
68
|
+
choice = questionary.select(
|
|
69
|
+
"🚀 Select a web framework:",
|
|
70
|
+
choices=[
|
|
71
|
+
questionary.Choice(f"{FRAMEWORKS[fw]['name']} - {FRAMEWORKS[fw]['description']}", fw)
|
|
72
|
+
for fw in frameworks
|
|
73
|
+
]
|
|
74
|
+
).ask()
|
|
75
|
+
|
|
76
|
+
return choice
|
|
77
|
+
|
|
78
|
+
def select_app_type(self) -> str:
|
|
79
|
+
"""Select application type"""
|
|
80
|
+
return questionary.select(
|
|
81
|
+
"🏗️ What type of application?",
|
|
82
|
+
choices=[
|
|
83
|
+
questionary.Choice("Full Web Application (with frontend)", "webapp"),
|
|
84
|
+
questionary.Choice("API Only", "api"),
|
|
85
|
+
]
|
|
86
|
+
).ask()
|
|
87
|
+
|
|
88
|
+
def get_app_name(self) -> str:
|
|
89
|
+
"""Get application name"""
|
|
90
|
+
return questionary.text(
|
|
91
|
+
"📝 Enter your application name:",
|
|
92
|
+
validate=lambda x: len(x.strip()) > 0 or "Application name cannot be empty"
|
|
93
|
+
).ask().strip()
|
|
94
|
+
|
|
95
|
+
def create_virtual_environment(self, app_path: Path) -> bool:
|
|
96
|
+
"""Create virtual environment"""
|
|
97
|
+
venv_path = app_path / "venv"
|
|
98
|
+
|
|
99
|
+
try:
|
|
100
|
+
with Progress(
|
|
101
|
+
SpinnerColumn(),
|
|
102
|
+
TextColumn("[progress.description]{task.description}"),
|
|
103
|
+
console=console,
|
|
104
|
+
) as progress:
|
|
105
|
+
task = progress.add_task("Creating virtual environment...", total=None)
|
|
106
|
+
venv.create(venv_path, with_pip=True)
|
|
107
|
+
progress.update(task, description="✅ Virtual environment created")
|
|
108
|
+
|
|
109
|
+
return True
|
|
110
|
+
except Exception as e:
|
|
111
|
+
console.print(f"❌ Error creating virtual environment: {e}", style="red")
|
|
112
|
+
return False
|
|
113
|
+
|
|
114
|
+
def install_framework(self, app_path: Path, framework: str) -> bool:
|
|
115
|
+
"""Install selected framework in virtual environment"""
|
|
116
|
+
venv_path = app_path / "venv"
|
|
117
|
+
|
|
118
|
+
# Determine pip path based on OS
|
|
119
|
+
if sys.platform == "win32":
|
|
120
|
+
pip_path = venv_path / "Scripts" / "pip"
|
|
121
|
+
else:
|
|
122
|
+
pip_path = venv_path / "bin" / "pip"
|
|
123
|
+
|
|
124
|
+
framework_info = FRAMEWORKS[framework]
|
|
125
|
+
packages = framework_info['packages']
|
|
126
|
+
|
|
127
|
+
try:
|
|
128
|
+
with Progress(
|
|
129
|
+
SpinnerColumn(),
|
|
130
|
+
TextColumn("[progress.description]{task.description}"),
|
|
131
|
+
console=console,
|
|
132
|
+
) as progress:
|
|
133
|
+
task = progress.add_task(f"Installing {framework_info['name']}...", total=None)
|
|
134
|
+
|
|
135
|
+
for package in packages:
|
|
136
|
+
subprocess.run([
|
|
137
|
+
str(pip_path), "install", package
|
|
138
|
+
], check=True, capture_output=True)
|
|
139
|
+
|
|
140
|
+
progress.update(task, description=f"✅ {framework_info['name']} installed")
|
|
141
|
+
|
|
142
|
+
return True
|
|
143
|
+
except subprocess.CalledProcessError as e:
|
|
144
|
+
console.print(f"❌ Error installing {framework_info['name']}: {e}", style="red")
|
|
145
|
+
return False
|
|
146
|
+
|
|
147
|
+
def create_app(self):
|
|
148
|
+
"""Main app creation flow"""
|
|
149
|
+
self.welcome_banner()
|
|
150
|
+
|
|
151
|
+
# Get user choices
|
|
152
|
+
framework = self.select_framework()
|
|
153
|
+
if not framework:
|
|
154
|
+
console.print("❌ No framework selected. Exiting.", style="red")
|
|
155
|
+
return
|
|
156
|
+
|
|
157
|
+
app_type = self.select_app_type()
|
|
158
|
+
if not app_type:
|
|
159
|
+
console.print("❌ No application type selected. Exiting.", style="red")
|
|
160
|
+
return
|
|
161
|
+
|
|
162
|
+
app_name = self.get_app_name()
|
|
163
|
+
if not app_name:
|
|
164
|
+
console.print("❌ No application name provided. Exiting.", style="red")
|
|
165
|
+
return
|
|
166
|
+
|
|
167
|
+
# Create application directory
|
|
168
|
+
app_path = Path.cwd() / app_name
|
|
169
|
+
|
|
170
|
+
if app_path.exists():
|
|
171
|
+
overwrite = questionary.confirm(
|
|
172
|
+
f"Directory '{app_name}' already exists. Overwrite?"
|
|
173
|
+
).ask()
|
|
174
|
+
|
|
175
|
+
if not overwrite:
|
|
176
|
+
console.print("❌ Operation cancelled.", style="yellow")
|
|
177
|
+
return
|
|
178
|
+
|
|
179
|
+
import shutil
|
|
180
|
+
shutil.rmtree(app_path)
|
|
181
|
+
|
|
182
|
+
app_path.mkdir()
|
|
183
|
+
console.print(f"📁 Created directory: {app_path}", style="green")
|
|
184
|
+
|
|
185
|
+
# Create virtual environment
|
|
186
|
+
if not self.create_virtual_environment(app_path):
|
|
187
|
+
return
|
|
188
|
+
|
|
189
|
+
# Install framework
|
|
190
|
+
if not self.install_framework(app_path, framework):
|
|
191
|
+
return
|
|
192
|
+
|
|
193
|
+
# Generate project structure
|
|
194
|
+
with Progress(
|
|
195
|
+
SpinnerColumn(),
|
|
196
|
+
TextColumn("[progress.description]{task.description}"),
|
|
197
|
+
console=console,
|
|
198
|
+
) as progress:
|
|
199
|
+
task = progress.add_task("Generating project structure...", total=None)
|
|
200
|
+
self.template_manager.generate_structure(app_path, framework, app_type, app_name)
|
|
201
|
+
progress.update(task, description="✅ Project structure generated")
|
|
202
|
+
|
|
203
|
+
# Success message
|
|
204
|
+
console.print(Panel(
|
|
205
|
+
f"""🎉 Successfully created '{app_name}'!
|
|
206
|
+
|
|
207
|
+
📁 Next Steps:
|
|
208
|
+
1. cd {app_name}
|
|
209
|
+
2. source venv/bin/activate (Linux/Mac) or venv\\Scripts\\activate (Windows)
|
|
210
|
+
3. python run.py
|
|
211
|
+
|
|
212
|
+
Your app will be running at http://localhost:{FRAMEWORKS[framework]['default_port']}
|
|
213
|
+
""".strip(),
|
|
214
|
+
title="🎊 Project Created Successfully!",
|
|
215
|
+
border_style="green"
|
|
216
|
+
))
|
|
217
|
+
|
|
218
|
+
@click.group()
|
|
219
|
+
def main():
|
|
220
|
+
"""Amen - composer-inspired Python web framework scaffolding tool"""
|
|
221
|
+
pass
|
|
222
|
+
|
|
223
|
+
@main.command()
|
|
224
|
+
def create():
|
|
225
|
+
"""Create a new web application"""
|
|
226
|
+
cli = AmenCLI()
|
|
227
|
+
cli.create_app()
|
|
228
|
+
|
|
229
|
+
if __name__ == "__main__":
|
|
230
|
+
main()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Framework configurations and metadata"""
|
|
2
|
+
|
|
3
|
+
FRAMEWORKS = {
|
|
4
|
+
'flask': {
|
|
5
|
+
'name': 'Flask',
|
|
6
|
+
'description': 'Lightweight WSGI web application framework',
|
|
7
|
+
'packages': ['flask', 'flask-cors', 'python-dotenv'],
|
|
8
|
+
'default_port': 5000,
|
|
9
|
+
'entry_file': 'app.py',
|
|
10
|
+
},
|
|
11
|
+
# 'django': {
|
|
12
|
+
# 'name': 'Django',
|
|
13
|
+
# 'description': 'High-level Python web framework',
|
|
14
|
+
# 'packages': ['django', 'django-cors-headers', 'python-dotenv'],
|
|
15
|
+
# 'default_port': 8000,
|
|
16
|
+
# 'entry_file': 'manage.py',
|
|
17
|
+
# },
|
|
18
|
+
'fastapi': {
|
|
19
|
+
'name': 'FastAPI',
|
|
20
|
+
'description': 'Modern, fast web framework for building APIs',
|
|
21
|
+
'packages': ['fastapi', 'uvicorn[standard]', 'python-dotenv'],
|
|
22
|
+
'default_port': 8000,
|
|
23
|
+
'entry_file': 'main.py',
|
|
24
|
+
},
|
|
25
|
+
# 'bottle': {
|
|
26
|
+
# 'name': 'Bottle',
|
|
27
|
+
# 'description': 'Fast, simple micro web framework',
|
|
28
|
+
# 'packages': ['bottle', 'python-dotenv'],
|
|
29
|
+
# 'default_port': 8080,
|
|
30
|
+
# 'entry_file': 'app.py',
|
|
31
|
+
# },
|
|
32
|
+
# 'pyramid': {
|
|
33
|
+
# 'name': 'Pyramid',
|
|
34
|
+
# 'description': 'Flexible, open source web framework',
|
|
35
|
+
# 'packages': ['pyramid', 'waitress', 'python-dotenv'],
|
|
36
|
+
# 'default_port': 6543,
|
|
37
|
+
# 'entry_file': 'app.py',
|
|
38
|
+
# },
|
|
39
|
+
# 'django-hotsauce': {
|
|
40
|
+
# 'name': 'Django Hotsauce',
|
|
41
|
+
# 'description': 'Django-based rapid development framework',
|
|
42
|
+
# 'packages': ['django', 'django-hotsauce', 'python-dotenv'],
|
|
43
|
+
# 'default_port': 8000,
|
|
44
|
+
# 'entry_file': 'manage.py',
|
|
45
|
+
# }
|
|
46
|
+
}
|