devops-project-generator 1.0.0__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.
cli/__init__.py ADDED
@@ -0,0 +1,7 @@
1
+ """
2
+ CLI module for DevOps Project Generator
3
+ """
4
+
5
+ from .cli import app
6
+
7
+ __all__ = ["app"]
cli/cli.py ADDED
@@ -0,0 +1,286 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ CLI interface for DevOps Project Generator
4
+ """
5
+
6
+ import os
7
+ import sys
8
+ from pathlib import Path
9
+ from typing import Optional, List
10
+ import typer
11
+ from rich.console import Console
12
+ from rich.panel import Panel
13
+ from rich.table import Table
14
+ from rich.progress import Progress, SpinnerColumn, TextColumn
15
+
16
+ from generator import ProjectConfig, DevOpsProjectGenerator
17
+
18
+ app = typer.Typer(
19
+ name="devops-project-generator",
20
+ help="🚀 DevOps Project Generator - Scaffold production-ready DevOps repositories",
21
+ no_args_is_help=True,
22
+ )
23
+
24
+ console = Console()
25
+
26
+
27
+ @app.command()
28
+ def init(
29
+ ci: Optional[str] = typer.Option(
30
+ None,
31
+ "--ci",
32
+ help="CI/CD platform: github-actions, gitlab-ci, jenkins, none",
33
+ show_choices=True,
34
+ ),
35
+ infra: Optional[str] = typer.Option(
36
+ None,
37
+ "--infra",
38
+ help="Infrastructure tool: terraform, cloudformation, none",
39
+ show_choices=True,
40
+ ),
41
+ deploy: Optional[str] = typer.Option(
42
+ None,
43
+ "--deploy",
44
+ help="Deployment method: vm, docker, kubernetes",
45
+ show_choices=True,
46
+ ),
47
+ envs: Optional[str] = typer.Option(
48
+ None,
49
+ "--envs",
50
+ help="Environments: single, dev,stage,prod",
51
+ ),
52
+ observability: Optional[str] = typer.Option(
53
+ None,
54
+ "--observability",
55
+ help="Observability level: logs, logs-metrics, full",
56
+ show_choices=True,
57
+ ),
58
+ security: Optional[str] = typer.Option(
59
+ None,
60
+ "--security",
61
+ help="Security level: basic, standard, strict",
62
+ show_choices=True,
63
+ ),
64
+ project_name: Optional[str] = typer.Option(
65
+ "devops-project",
66
+ "--name",
67
+ help="Project name",
68
+ ),
69
+ output_dir: Optional[str] = typer.Option(
70
+ ".",
71
+ "--output",
72
+ help="Output directory",
73
+ ),
74
+ interactive: bool = typer.Option(
75
+ True,
76
+ "--interactive/--no-interactive",
77
+ help="Interactive mode",
78
+ ),
79
+ ) -> None:
80
+ """Initialize a new DevOps project"""
81
+
82
+ console.print(Panel.fit(
83
+ "[bold blue]🚀 DevOps Project Generator[/bold blue]\n"
84
+ "[dim]Scaffold production-ready DevOps repositories[/dim]",
85
+ border_style="blue"
86
+ ))
87
+
88
+ if interactive:
89
+ config = _interactive_mode()
90
+ else:
91
+ config = ProjectConfig(
92
+ ci=ci,
93
+ infra=infra,
94
+ deploy=deploy,
95
+ envs=envs,
96
+ observability=observability,
97
+ security=security,
98
+ project_name=project_name,
99
+ )
100
+
101
+ # Validate configuration
102
+ if not config.validate():
103
+ console.print("[red]❌ Invalid configuration. Please check your options.[/red]")
104
+ raise typer.Exit(1)
105
+
106
+ # Generate project
107
+ generator = DevOpsProjectGenerator(config, output_dir)
108
+
109
+ with Progress(
110
+ SpinnerColumn(),
111
+ TextColumn("[progress.description]{task.description}"),
112
+ console=console,
113
+ ) as progress:
114
+ task = progress.add_task("Generating DevOps project...", total=None)
115
+
116
+ try:
117
+ generator.generate()
118
+ progress.update(task, description="✅ Project generated successfully!")
119
+
120
+ console.print("\n[green]✅ DevOps project generated successfully![/green]")
121
+ console.print(f"\n[bold]Project location:[/bold] {output_dir}/{config.project_name}")
122
+ console.print("\n[bold]Next steps:[/bold]")
123
+ console.print(f" cd {config.project_name}")
124
+ console.print(" make help")
125
+
126
+ except Exception as e:
127
+ progress.update(task, description="❌ Generation failed!")
128
+ console.print(f"\n[red]❌ Error generating project: {str(e)}[/red]")
129
+ raise typer.Exit(1)
130
+
131
+
132
+ def _interactive_mode() -> ProjectConfig:
133
+ """Interactive configuration mode"""
134
+ console.print("\n[bold]🔧 Interactive Configuration[/bold]\n")
135
+
136
+ # CI/CD selection
137
+ ci_table = Table(title="CI/CD Platforms")
138
+ ci_table.add_column("Option", style="cyan")
139
+ ci_table.add_column("Description")
140
+ ci_table.add_row("github-actions", "GitHub Actions workflows")
141
+ ci_table.add_row("gitlab-ci", "GitLab CI/CD pipelines")
142
+ ci_table.add_row("jenkins", "Jenkins pipeline files")
143
+ ci_table.add_row("none", "No CI/CD")
144
+ console.print(ci_table)
145
+
146
+ ci = typer.prompt("Choose CI/CD platform", type=str)
147
+
148
+ # Infrastructure selection
149
+ infra_table = Table(title="Infrastructure Tools")
150
+ infra_table.add_column("Option", style="cyan")
151
+ infra_table.add_column("Description")
152
+ infra_table.add_row("terraform", "Terraform IaC")
153
+ infra_table.add_row("cloudformation", "AWS CloudFormation")
154
+ infra_table.add_row("none", "No IaC")
155
+ console.print(infra_table)
156
+
157
+ infra = typer.prompt("Choose infrastructure tool", type=str)
158
+
159
+ # Deployment selection
160
+ deploy_table = Table(title="Deployment Methods")
161
+ deploy_table.add_column("Option", style="cyan")
162
+ deploy_table.add_column("Description")
163
+ deploy_table.add_row("vm", "Virtual Machine deployment")
164
+ deploy_table.add_row("docker", "Docker container deployment")
165
+ deploy_table.add_row("kubernetes", "Kubernetes deployment")
166
+ console.print(deploy_table)
167
+
168
+ deploy = typer.prompt("Choose deployment method", type=str)
169
+
170
+ # Environments
171
+ envs = typer.prompt("Choose environments (single, dev,stage,prod)", type=str)
172
+
173
+ # Observability
174
+ obs_table = Table(title="Observability Levels")
175
+ obs_table.add_column("Option", style="cyan")
176
+ obs_table.add_column("Description")
177
+ obs_table.add_row("logs", "Logs only")
178
+ obs_table.add_row("logs-metrics", "Logs + Metrics")
179
+ obs_table.add_row("full", "Logs + Metrics + Alerts")
180
+ console.print(obs_table)
181
+
182
+ observability = typer.prompt("Choose observability level", type=str)
183
+
184
+ # Security
185
+ sec_table = Table(title="Security Levels")
186
+ sec_table.add_column("Option", style="cyan")
187
+ sec_table.add_column("Description")
188
+ sec_table.add_row("basic", "Basic security practices")
189
+ sec_table.add_row("standard", "Standard security measures")
190
+ sec_table.add_row("strict", "Strict security controls")
191
+ console.print(sec_table)
192
+
193
+ security = typer.prompt("Choose security level", type=str)
194
+
195
+ project_name = typer.prompt("Project name", default="devops-project")
196
+
197
+ return ProjectConfig(
198
+ ci=ci,
199
+ infra=infra,
200
+ deploy=deploy,
201
+ envs=envs,
202
+ observability=observability,
203
+ security=security,
204
+ project_name=project_name,
205
+ )
206
+
207
+
208
+ @app.command()
209
+ def list_options() -> None:
210
+ """List all available options"""
211
+ console.print(Panel.fit(
212
+ "[bold blue]📋 Available Options[/bold blue]",
213
+ border_style="blue"
214
+ ))
215
+
216
+ # CI/CD Options
217
+ console.print("\n[bold]🔄 CI/CD Platforms:[/bold]")
218
+ ci_table = Table()
219
+ ci_table.add_column("Option", style="cyan")
220
+ ci_table.add_column("Description")
221
+ ci_table.add_row("github-actions", "GitHub Actions workflows")
222
+ ci_table.add_row("gitlab-ci", "GitLab CI/CD pipelines")
223
+ ci_table.add_row("jenkins", "Jenkins pipeline files")
224
+ ci_table.add_row("none", "No CI/CD")
225
+ console.print(ci_table)
226
+
227
+ # Infrastructure Options
228
+ console.print("\n[bold]🏗️ Infrastructure Tools:[/bold]")
229
+ infra_table = Table()
230
+ infra_table.add_column("Option", style="cyan")
231
+ infra_table.add_column("Description")
232
+ infra_table.add_row("terraform", "Terraform IaC")
233
+ infra_table.add_row("cloudformation", "AWS CloudFormation")
234
+ infra_table.add_row("none", "No IaC")
235
+ console.print(infra_table)
236
+
237
+ # Deployment Options
238
+ console.print("\n[bold]🚀 Deployment Methods:[/bold]")
239
+ deploy_table = Table()
240
+ deploy_table.add_column("Option", style="cyan")
241
+ deploy_table.add_column("Description")
242
+ deploy_table.add_row("vm", "Virtual Machine deployment")
243
+ deploy_table.add_row("docker", "Docker container deployment")
244
+ deploy_table.add_row("kubernetes", "Kubernetes deployment")
245
+ console.print(deploy_table)
246
+
247
+ # Environment Options
248
+ console.print("\n[bold]🌍 Environment Options:[/bold]")
249
+ env_table = Table()
250
+ env_table.add_column("Option", style="cyan")
251
+ env_table.add_column("Description")
252
+ env_table.add_row("single", "Single environment")
253
+ env_table.add_row("dev", "Development environment")
254
+ env_table.add_row("dev,stage,prod", "Multi-environment setup")
255
+ console.print(env_table)
256
+
257
+ # Observability Options
258
+ console.print("\n[bold]📊 Observability Levels:[/bold]")
259
+ obs_table = Table()
260
+ obs_table.add_column("Option", style="cyan")
261
+ obs_table.add_column("Description")
262
+ obs_table.add_row("logs", "Logs only")
263
+ obs_table.add_row("logs-metrics", "Logs + Metrics")
264
+ obs_table.add_row("full", "Logs + Metrics + Alerts")
265
+ console.print(obs_table)
266
+
267
+ # Security Options
268
+ console.print("\n[bold]🔒 Security Levels:[/bold]")
269
+ sec_table = Table()
270
+ sec_table.add_column("Option", style="cyan")
271
+ sec_table.add_column("Description")
272
+ sec_table.add_row("basic", "Basic security practices")
273
+ sec_table.add_row("standard", "Standard security measures")
274
+ sec_table.add_row("strict", "Strict security controls")
275
+ console.print(sec_table)
276
+
277
+
278
+ @app.command()
279
+ def version() -> None:
280
+ """Show version information"""
281
+ from . import __version__
282
+ console.print(f"[bold blue]DevOps Project Generator[/bold blue] v{__version__}")
283
+
284
+
285
+ if __name__ == "__main__":
286
+ app()
@@ -0,0 +1,404 @@
1
+ Metadata-Version: 2.4
2
+ Name: devops-project-generator
3
+ Version: 1.0.0
4
+ Summary: A CLI tool that scaffolds production-ready DevOps repositories
5
+ Author-email: NotHarshhaa <devops-project-generator@notHarshhaa.com>
6
+ License: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: typer[all]>=0.9.0
20
+ Requires-Dist: rich>=13.0.0
21
+ Requires-Dist: jinja2>=3.1.0
22
+ Requires-Dist: pyyaml>=6.0
23
+ Requires-Dist: click>=8.0.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
26
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
27
+ Requires-Dist: black>=23.0.0; extra == "dev"
28
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
29
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # 🚀 DevOps Project Generator
33
+
34
+ A powerful CLI tool that scaffolds production-ready DevOps repositories based on user-selected options like CI/CD, infrastructure, deployment, environments, observability, and security.
35
+
36
+ ## ✨ Why DevOps Project Generator?
37
+
38
+ Setting up a real-world DevOps project from scratch is repetitive and error-prone. This tool helps you bootstrap a complete DevOps-ready repository in seconds, following industry best practices.
39
+
40
+ ✔ Opinionated but configurable
41
+ ✔ Beginner-friendly, production-oriented
42
+ ✔ CLI support
43
+ ✔ No tool lock-in
44
+
45
+ ## 🎯 Who Is This For?
46
+
47
+ - **DevOps Engineers**
48
+ - **Cloud Engineers**
49
+ - **Platform Engineers**
50
+ - **SREs**
51
+ - **Students & freshers building real DevOps projects**
52
+
53
+ ## 🧠 What This Generator Creates
54
+
55
+ A full DevOps project structure covering:
56
+ - CI/CD pipelines
57
+ - Containerization
58
+ - Infrastructure (IaC-ready)
59
+ - Deployment models
60
+ - Environment separation
61
+ - Observability
62
+ - Security basics
63
+
64
+ All generated based on your selected options.
65
+
66
+ ## ⚙️ Supported Options (v1)
67
+
68
+ ### CI/CD
69
+ - **GitHub Actions**
70
+ - **GitLab CI**
71
+ - **Jenkins**
72
+ - **None**
73
+
74
+ ### Infrastructure
75
+ - **Terraform**
76
+ - **CloudFormation**
77
+ - **None**
78
+
79
+ ### Deployment
80
+ - **VM**
81
+ - **Docker**
82
+ - **Kubernetes**
83
+
84
+ ### Environments
85
+ - **Single**
86
+ - **Dev / Stage / Prod**
87
+
88
+ ### Observability
89
+ - **Logs only**
90
+ - **Logs + Metrics**
91
+ - **Full (Logs + Metrics + Alerts)**
92
+
93
+ ### Security
94
+ - **Basic**
95
+ - **Standard**
96
+ - **Strict**
97
+
98
+ ## 🖥️ Usage
99
+
100
+ ### CLI Usage
101
+
102
+ ```bash
103
+ devops-project-generator init \
104
+ --ci github-actions \
105
+ --infra terraform \
106
+ --deploy kubernetes \
107
+ --envs dev,stage,prod \
108
+ --observability full \
109
+ --security standard
110
+ ```
111
+
112
+ ### Interactive Mode
113
+
114
+ ```bash
115
+ devops-project-generator init --interactive
116
+ ```
117
+
118
+ ### List Available Options
119
+
120
+ ```bash
121
+ devops-project-generator list-options
122
+ ```
123
+
124
+ ## 🏗️ Generated Project Structure (Example)
125
+
126
+ ```
127
+ devops-project/
128
+ ├── app/
129
+ │ └── sample-app/
130
+ ├── ci/
131
+ │ ├── pipelines/
132
+ │ └── README.md
133
+ ├── infra/
134
+ │ ├── terraform/
135
+ │ └── environments/
136
+ ├── containers/
137
+ │ ├── Dockerfile
138
+ │ └── docker-compose.yml
139
+ ├── k8s/
140
+ │ ├── base/
141
+ │ └── overlays/
142
+ ├── monitoring/
143
+ │ ├── logs/
144
+ │ ├── metrics/
145
+ │ └── alerts/
146
+ ├── security/
147
+ │ ├── secrets/
148
+ │ └── scanning/
149
+ ├── scripts/
150
+ │ └── automation/
151
+ ├── Makefile
152
+ └── README.md
153
+ ```
154
+
155
+ ## 🛠️ Tech Stack
156
+
157
+ ### Generator Core
158
+ - **Python**
159
+ - **Jinja2**
160
+ - **YAML-based configuration**
161
+
162
+ ### CLI
163
+ - **Typer**
164
+ - **Rich**
165
+
166
+ ## 📦 Installation
167
+
168
+ ### From PyPI
169
+
170
+ ```bash
171
+ pip install devops-project-generator
172
+ ```
173
+
174
+ ### From Source
175
+
176
+ ```bash
177
+ git clone https://github.com/NotHarshhaa/devops-project-generator.git
178
+ cd devops-project-generator
179
+ pip install -e .
180
+ ```
181
+
182
+ ### Development Setup
183
+
184
+ ```bash
185
+ git clone https://github.com/NotHarshhaa/devops-project-generator.git
186
+ cd devops-project-generator
187
+ python -m venv venv
188
+ source venv/bin/activate # On Windows: venv\Scripts\activate
189
+ pip install -e ".[dev]"
190
+ ```
191
+
192
+ ## 🚀 Quick Start
193
+
194
+ 1. **Generate a new project**
195
+ ```bash
196
+ devops-project-generator init --name my-app --ci github-actions --deploy kubernetes
197
+ ```
198
+
199
+ 2. **Navigate to your project**
200
+ ```bash
201
+ cd my-app
202
+ ```
203
+
204
+ 3. **Setup the environment**
205
+ ```bash
206
+ make setup
207
+ ```
208
+
209
+ 4. **Start the application**
210
+ ```bash
211
+ make start
212
+ ```
213
+
214
+ 5. **Check health**
215
+ ```bash
216
+ make health
217
+ ```
218
+
219
+ ## 📖 Examples
220
+
221
+ ### Basic Web App with Docker
222
+
223
+ ```bash
224
+ devops-project-generator init \
225
+ --name my-webapp \
226
+ --ci github-actions \
227
+ --deploy docker \
228
+ --envs single \
229
+ --observability logs \
230
+ --security basic
231
+ ```
232
+
233
+ ### Enterprise Kubernetes App
234
+
235
+ ```bash
236
+ devops-project-generator init \
237
+ --name enterprise-app \
238
+ --ci github-actions \
239
+ --infra terraform \
240
+ --deploy kubernetes \
241
+ --envs dev,stage,prod \
242
+ --observability full \
243
+ --security strict
244
+ ```
245
+
246
+ ### Simple VM Deployment
247
+
248
+ ```bash
249
+ devops-project-generator init \
250
+ --name simple-app \
251
+ --ci jenkins \
252
+ --deploy vm \
253
+ --envs dev,prod \
254
+ --observability logs-metrics \
255
+ --security standard
256
+ ```
257
+
258
+ ## 🔧 Configuration
259
+
260
+ ### Global Configuration
261
+
262
+ You can set default options in `~/.devops-generator/config.yaml`:
263
+
264
+ ```yaml
265
+ defaults:
266
+ ci: github-actions
267
+ deploy: kubernetes
268
+ observability: logs-metrics
269
+ security: standard
270
+ ```
271
+
272
+ ### Project Templates
273
+
274
+ The generator supports custom templates. Place your templates in:
275
+
276
+ ```
277
+ ~/.devops-generator/templates/
278
+ ├── ci/
279
+ ├── infra/
280
+ ├── deploy/
281
+ ├── monitoring/
282
+ └── security/
283
+ ```
284
+
285
+ ## 🧪 Testing
286
+
287
+ ### Run Tests
288
+
289
+ ```bash
290
+ pytest
291
+ ```
292
+
293
+ ### Run Tests with Coverage
294
+
295
+ ```bash
296
+ pytest --cov=devops_project_generator --cov-report=html
297
+ ```
298
+
299
+ ### Run Linting
300
+
301
+ ```bash
302
+ flake8 devops_project_generator/
303
+ black devops_project_generator/
304
+ mypy devops_project_generator/
305
+ ```
306
+
307
+ ## 🤝 Contributing
308
+
309
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
310
+
311
+ ### Development Workflow
312
+
313
+ 1. Fork the repository
314
+ 2. Create a feature branch
315
+ 3. Make your changes
316
+ 4. Add tests for new functionality
317
+ 5. Run the test suite
318
+ 6. Submit a pull request
319
+
320
+ ### Adding New Features
321
+
322
+ 1. **New CI/CD Platform**: Add templates in `templates/ci/`
323
+ 2. **New Infrastructure Tool**: Add templates in `templates/infra/`
324
+ 3. **New Deployment Method**: Add templates in `templates/deploy/`
325
+ 4. **New Security Level**: Add templates in `templates/security/`
326
+
327
+ ## 📚 Documentation
328
+
329
+ - [User Guide](docs/user-guide.md)
330
+ - [Developer Guide](docs/developer-guide.md)
331
+ - [Template Reference](docs/template-reference.md)
332
+ - [API Documentation](docs/api.md)
333
+
334
+ ## 🐛 Troubleshooting
335
+
336
+ ### Common Issues
337
+
338
+ 1. **Permission Denied**
339
+ ```bash
340
+ chmod +x scripts/setup.sh scripts/deploy.sh
341
+ ```
342
+
343
+ 2. **Template Not Found**
344
+ - Check if template files exist in `templates/`
345
+ - Verify template syntax
346
+
347
+ 3. **Generated Files Not Executable**
348
+ ```bash
349
+ find . -name "*.sh" -exec chmod +x {} \;
350
+ ```
351
+
352
+ ### Getting Help
353
+
354
+ - **Issues**: [GitHub Issues](https://github.com/NotHarshhaa/devops-project-generator/issues)
355
+ - **Discussions**: [GitHub Discussions](https://github.com/NotHarshhaa/devops-project-generator/discussions)
356
+ - **Documentation**: [Wiki](https://github.com/NotHarshhaa/devops-project-generator/wiki)
357
+
358
+ ## 🗺️ Roadmap
359
+
360
+ ### v1.1
361
+ - [ ] Support for Azure DevOps
362
+ - [ ] Additional cloud providers (GCP, Azure)
363
+ - [ ] More deployment targets (AWS ECS, Fargate)
364
+ - [ ] Advanced monitoring templates
365
+
366
+ ### v1.2
367
+ - [ ] Template marketplace
368
+ - [ ] Plugin system
369
+ - [ ] GUI interface
370
+ - [ ] Integration with popular tools
371
+
372
+ ### v2.0
373
+ - [ ] Multi-language support
374
+ - [ ] Advanced project customization
375
+ - [ ] AI-powered recommendations
376
+ - [ ] Enterprise features
377
+
378
+ ## 📄 License
379
+
380
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
381
+
382
+ ## 🙏 Acknowledgments
383
+
384
+ - **Typer** - For the amazing CLI framework
385
+ - **Rich** - For beautiful terminal output
386
+ - **Jinja2** - For powerful templating
387
+ - **DevOps Community** - For best practices and inspiration
388
+
389
+ ## 📞 Contact
390
+
391
+ This project is crafted with 💡 by **[Harshhaa](https://github.com/NotHarshhaa)**.
392
+ Your feedback is always welcome! Let's build together. 🚀
393
+
394
+ 📧 **Connect with me:**
395
+ 🔗 **GitHub**: [@NotHarshhaa](https://github.com/NotHarshhaa)
396
+ 🔗 **Portfolio**: [Personal Portfolio](https://notharshhaa.site)
397
+ 🔗 **Links - Portfolio**: [Links](https://link.notharshhaa.site)
398
+ 🔗 **Telegram Community**: [Join Here](https://t.me/prodevopsguy)
399
+ 🔗 **LinkedIn**: [Harshhaa Vardhan Reddy](https://www.linkedin.com/in/NotHarshhaa/)
400
+
401
+ ---
402
+
403
+ **Built with ❤️ by the DevOps community**
404
+ *Making DevOps accessible to everyone*
@@ -0,0 +1,11 @@
1
+ cli/__init__.py,sha256=w2vLcMzDL8VTCvr4FpIO2huINs7VakcPwwwgET9CZn0,96
2
+ cli/cli.py,sha256=XUXqhsS9rTyeV-K0E6gUsq_KIdGKihfBMqcBpvIiCdk,9833
3
+ devops_project_generator-1.0.0.dist-info/licenses/LICENSE,sha256=_HdG8K47lc8y4-RxCcg8kF9Sky3s9ISv6hq3Htf_4xE,1093
4
+ generator/__init__.py,sha256=ZvV3XJ6NSqJtexzoSuiGO_sunxcJsnh0Y2Ygae28DOI,223
5
+ generator/config.py,sha256=F15LBjUc1jsnpM5TW7jMnpTOdg1io5kG7-pHNXYOvZg,4188
6
+ generator/generator.py,sha256=YtmlJNA5M55R5NioLmzYvHxL4c_s4gyRnYNixasxDxg,9095
7
+ devops_project_generator-1.0.0.dist-info/METADATA,sha256=2IjjmxSqKycWr-dJJ1vUNN0UwBUtell9A_5oCpbnGQ4,9283
8
+ devops_project_generator-1.0.0.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
9
+ devops_project_generator-1.0.0.dist-info/entry_points.txt,sha256=rRjyaDvT7HXOGTyTjESukJY6vudqQSaORIDja2ajE_M,53
10
+ devops_project_generator-1.0.0.dist-info/top_level.txt,sha256=wLC3-qeRvJyOHnTMJFtpJQXgQvkzgioPJQix2SQZhFM,14
11
+ devops_project_generator-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ devops-project-generator = cli:app
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 H A R S H H A A
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.
@@ -0,0 +1,2 @@
1
+ cli
2
+ generator
generator/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ """
2
+ DevOps Project Generator Core Module
3
+ """
4
+
5
+ from .config import ProjectConfig, TemplateConfig
6
+ from .generator import DevOpsProjectGenerator
7
+
8
+ __all__ = ["ProjectConfig", "TemplateConfig", "DevOpsProjectGenerator"]
generator/config.py ADDED
@@ -0,0 +1,117 @@
1
+ """
2
+ Configuration management for DevOps Project Generator
3
+ """
4
+
5
+ from typing import List, Optional, Dict, Any
6
+ from dataclasses import dataclass, field
7
+ from pathlib import Path
8
+
9
+
10
+ @dataclass
11
+ class ProjectConfig:
12
+ """Configuration for DevOps project generation"""
13
+
14
+ ci: Optional[str] = None
15
+ infra: Optional[str] = None
16
+ deploy: Optional[str] = None
17
+ envs: Optional[str] = None
18
+ observability: Optional[str] = None
19
+ security: Optional[str] = None
20
+ project_name: str = "devops-project"
21
+
22
+ # Valid options
23
+ VALID_CI_OPTIONS = ["github-actions", "gitlab-ci", "jenkins", "none"]
24
+ VALID_INFRA_OPTIONS = ["terraform", "cloudformation", "none"]
25
+ VALID_DEPLOY_OPTIONS = ["vm", "docker", "kubernetes"]
26
+ VALID_OBS_OPTIONS = ["logs", "logs-metrics", "full"]
27
+ VALID_SEC_OPTIONS = ["basic", "standard", "strict"]
28
+
29
+ def validate(self) -> bool:
30
+ """Validate configuration options"""
31
+ if self.ci and self.ci not in self.VALID_CI_OPTIONS:
32
+ return False
33
+ if self.infra and self.infra not in self.VALID_INFRA_OPTIONS:
34
+ return False
35
+ if self.deploy and self.deploy not in self.VALID_DEPLOY_OPTIONS:
36
+ return False
37
+ if self.observability and self.observability not in self.VALID_OBS_OPTIONS:
38
+ return False
39
+ if self.security and self.security not in self.VALID_SEC_OPTIONS:
40
+ return False
41
+ return True
42
+
43
+ def get_environments(self) -> List[str]:
44
+ """Parse environments string into list"""
45
+ if not self.envs:
46
+ return ["production"]
47
+
48
+ envs = [env.strip() for env in self.envs.split(",")]
49
+ if self.envs == "single":
50
+ return ["production"]
51
+ return envs
52
+
53
+ def has_ci(self) -> bool:
54
+ """Check if CI/CD is enabled"""
55
+ return self.ci and self.ci != "none"
56
+
57
+ def has_infra(self) -> bool:
58
+ """Check if infrastructure is enabled"""
59
+ return self.infra and self.infra != "none"
60
+
61
+ def has_docker(self) -> bool:
62
+ """Check if Docker is used"""
63
+ return self.deploy in ["docker", "kubernetes"]
64
+
65
+ def has_kubernetes(self) -> bool:
66
+ """Check if Kubernetes is used"""
67
+ return self.deploy == "kubernetes"
68
+
69
+ def has_metrics(self) -> bool:
70
+ """Check if metrics are enabled"""
71
+ return self.observability in ["logs-metrics", "full"]
72
+
73
+ def has_alerts(self) -> bool:
74
+ """Check if alerts are enabled"""
75
+ return self.observability == "full"
76
+
77
+ def get_security_level(self) -> str:
78
+ """Get security level"""
79
+ return self.security or "basic"
80
+
81
+ def get_template_context(self) -> Dict[str, Any]:
82
+ """Get template context for Jinja2"""
83
+ return {
84
+ "project_name": self.project_name,
85
+ "ci": self.ci,
86
+ "infra": self.infra,
87
+ "deploy": self.deploy,
88
+ "environments": self.get_environments(),
89
+ "observability": self.observability,
90
+ "security": self.get_security_level(),
91
+ "has_ci": self.has_ci(),
92
+ "has_infra": self.has_infra(),
93
+ "has_docker": self.has_docker(),
94
+ "has_kubernetes": self.has_kubernetes(),
95
+ "has_metrics": self.has_metrics(),
96
+ "has_alerts": self.has_alerts(),
97
+ "is_multi_env": len(self.get_environments()) > 1,
98
+ }
99
+
100
+
101
+ @dataclass
102
+ class TemplateConfig:
103
+ """Template configuration"""
104
+
105
+ template_dir: Path = field(default_factory=lambda: Path(__file__).parent / "templates")
106
+
107
+ def get_template_path(self, category: str, template_name: str) -> Path:
108
+ """Get full template path"""
109
+ return self.template_dir / category / template_name
110
+
111
+ def list_templates(self, category: str) -> List[str]:
112
+ """List available templates in a category"""
113
+ category_path = self.template_dir / category
114
+ if not category_path.exists():
115
+ return []
116
+
117
+ return [f.name for f in category_path.iterdir() if f.is_file()]
generator/generator.py ADDED
@@ -0,0 +1,231 @@
1
+ """
2
+ Core DevOps project generator
3
+ """
4
+
5
+ import os
6
+ import shutil
7
+ from pathlib import Path
8
+ from typing import Dict, Any, List
9
+ from jinja2 import Environment, FileSystemLoader, select_autoescape
10
+ from rich.console import Console
11
+
12
+ from .config import ProjectConfig, TemplateConfig
13
+
14
+ console = Console()
15
+
16
+
17
+ class DevOpsProjectGenerator:
18
+ """Main DevOps project generator class"""
19
+
20
+ def __init__(self, config: ProjectConfig, output_dir: str = "."):
21
+ self.config = config
22
+ self.output_dir = Path(output_dir)
23
+ self.template_config = TemplateConfig()
24
+ self.project_path = self.output_dir / config.project_name
25
+
26
+ # Setup Jinja2 environment
27
+ template_path = Path("templates")
28
+ self.jinja_env = Environment(
29
+ loader=FileSystemLoader(str(template_path)),
30
+ autoescape=select_autoescape(["html", "xml"]),
31
+ trim_blocks=True,
32
+ lstrip_blocks=True,
33
+ )
34
+
35
+ def generate(self) -> None:
36
+ """Generate the complete DevOps project"""
37
+ console.print(f"🏗️ Creating project structure for '{self.config.project_name}'...")
38
+
39
+ # Create project directory
40
+ self._create_project_structure()
41
+
42
+ # Generate components based on configuration
43
+ if self.config.has_ci():
44
+ self._generate_ci_cd()
45
+
46
+ if self.config.has_infra():
47
+ self._generate_infrastructure()
48
+
49
+ self._generate_deployment()
50
+ self._generate_monitoring()
51
+ self._generate_security()
52
+ self._generate_base_files()
53
+
54
+ console.print("✅ Project generation completed!")
55
+
56
+ def _create_project_structure(self) -> None:
57
+ """Create base project directory structure"""
58
+ directories = [
59
+ "app/sample-app",
60
+ "ci/pipelines",
61
+ "infra/environments",
62
+ "containers",
63
+ "k8s/base",
64
+ "k8s/overlays",
65
+ "monitoring/logs",
66
+ "monitoring/metrics",
67
+ "monitoring/alerts",
68
+ "security/secrets",
69
+ "security/scanning",
70
+ "scripts/automation",
71
+ ]
72
+
73
+ for directory in directories:
74
+ dir_path = self.project_path / directory
75
+ dir_path.mkdir(parents=True, exist_ok=True)
76
+
77
+ def _generate_ci_cd(self) -> None:
78
+ """Generate CI/CD pipeline files"""
79
+ console.print("🔄 Generating CI/CD pipelines...")
80
+
81
+ ci_templates = {
82
+ "github-actions": "github-actions.yml.j2",
83
+ "gitlab-ci": "gitlab-ci.yml.j2",
84
+ "jenkins": "jenkinsfile.j2",
85
+ }
86
+
87
+ if self.config.ci in ci_templates:
88
+ template_name = ci_templates[self.config.ci]
89
+ self._render_template(
90
+ f"ci/{template_name}",
91
+ f"ci/pipelines/{self.config.ci}.yml",
92
+ )
93
+
94
+ # Generate CI README
95
+ self._render_template("ci/README.md.j2", "ci/README.md")
96
+
97
+ def _generate_infrastructure(self) -> None:
98
+ """Generate infrastructure as code files"""
99
+ console.print("🏗️ Generating infrastructure...")
100
+
101
+ infra_templates = {
102
+ "terraform": "terraform/main.tf.j2",
103
+ "cloudformation": "cloudformation/template.yml.j2",
104
+ }
105
+
106
+ if self.config.infra in infra_templates:
107
+ template_path = infra_templates[self.config.infra]
108
+ output_path = f"infra/{self.config.infra}"
109
+
110
+ if self.config.infra == "terraform":
111
+ self._render_template(template_path, f"{output_path}/main.tf")
112
+ self._render_template("terraform/variables.tf.j2", f"{output_path}/variables.tf")
113
+ self._render_template("terraform/outputs.tf.j2", f"{output_path}/outputs.tf")
114
+ elif self.config.infra == "cloudformation":
115
+ self._render_template(template_path, f"{output_path}/template.yml")
116
+
117
+ # Generate environment configs
118
+ for env in self.config.get_environments():
119
+ self._render_template(
120
+ f"infra/environment-{self.config.infra}.j2",
121
+ f"infra/environments/{env}.tf" if self.config.infra == "terraform" else f"infra/environments/{env}.yml",
122
+ env=env,
123
+ )
124
+
125
+ def _generate_deployment(self) -> None:
126
+ """Generate deployment files"""
127
+ console.print("🚀 Generating deployment files...")
128
+
129
+ if self.config.has_docker():
130
+ self._render_template("deploy/Dockerfile.j2", "containers/Dockerfile")
131
+ self._render_template("deploy/docker-compose.yml.j2", "containers/docker-compose.yml")
132
+
133
+ if self.config.has_kubernetes():
134
+ self._render_template("deploy/k8s-deployment.yml.j2", "k8s/base/deployment.yml")
135
+ self._render_template("deploy/k8s-service.yml.j2", "k8s/base/service.yml")
136
+
137
+ # Generate environment overlays
138
+ for env in self.config.get_environments():
139
+ env_dir = f"k8s/overlays/{env}"
140
+ (self.project_path / env_dir).mkdir(exist_ok=True)
141
+ self._render_template(
142
+ "deploy/k8s-overlay.yml.j2",
143
+ f"{env_dir}/kustomization.yml",
144
+ env=env,
145
+ )
146
+
147
+ if self.config.deploy == "vm":
148
+ self._render_template("deploy/vm-deploy.sh.j2", "scripts/automation/vm-deploy.sh")
149
+
150
+ def _generate_monitoring(self) -> None:
151
+ """Generate monitoring and observability files"""
152
+ console.print("📊 Generating monitoring...")
153
+
154
+ # Always generate logs
155
+ self._render_template("monitoring/logging.yml.j2", "monitoring/logs/logging.yml")
156
+
157
+ if self.config.has_metrics():
158
+ self._render_template("monitoring/metrics.yml.j2", "monitoring/metrics/metrics.yml")
159
+
160
+ if self.config.has_alerts():
161
+ self._render_template("monitoring/alerts.yml.j2", "monitoring/alerts/alerts.yml")
162
+
163
+ def _generate_security(self) -> None:
164
+ """Generate security files"""
165
+ console.print("🔒 Generating security...")
166
+
167
+ sec_level = self.config.get_security_level()
168
+
169
+ # Base security files
170
+ self._render_template(f"security/{sec_level}-secrets.yml.j2", "security/secrets/secrets.yml")
171
+ self._render_template(f"security/{sec_level}-scan.yml.j2", "security/scanning/scan.yml")
172
+
173
+ if sec_level in ["standard", "strict"]:
174
+ self._render_template("security/security-policy.yml.j2", "security/security-policy.yml")
175
+
176
+ if sec_level == "strict":
177
+ self._render_template("security/compliance.yml.j2", "security/compliance.yml")
178
+
179
+ def _generate_base_files(self) -> None:
180
+ """Generate base project files"""
181
+ console.print("📄 Generating base files...")
182
+
183
+ # Sample application
184
+ self._render_template("app/sample-app/main.py.j2", "app/sample-app/main.py")
185
+ self._render_template("app/sample-app/requirements.txt.j2", "app/sample-app/requirements.txt")
186
+
187
+ # Scripts
188
+ self._render_template("scripts/setup.sh.j2", "scripts/setup.sh")
189
+ self._render_template("scripts/deploy.sh.j2", "scripts/deploy.sh")
190
+
191
+ # Makefile
192
+ self._render_template("Makefile.j2", "Makefile")
193
+
194
+ # README
195
+ self._render_template("README.md.j2", "README.md")
196
+
197
+ # .gitignore
198
+ self._render_template("gitignore.j2", ".gitignore")
199
+
200
+ # Make scripts executable
201
+ script_files = [
202
+ "scripts/setup.sh",
203
+ "scripts/deploy.sh",
204
+ "scripts/automation/vm-deploy.sh",
205
+ ]
206
+
207
+ for script in script_files:
208
+ script_path = self.project_path / script
209
+ if script_path.exists():
210
+ os.chmod(script_path, 0o755)
211
+
212
+ def _render_template(self, template_path: str, output_path: str, **kwargs) -> None:
213
+ """Render a template to an output file"""
214
+ try:
215
+ template = self.jinja_env.get_template(template_path)
216
+
217
+ # Merge template context with additional kwargs
218
+ context = self.config.get_template_context()
219
+ context.update(kwargs)
220
+
221
+ rendered_content = template.render(**context)
222
+
223
+ output_file = self.project_path / output_path
224
+ output_file.parent.mkdir(parents=True, exist_ok=True)
225
+
226
+ with open(output_file, "w", encoding="utf-8") as f:
227
+ f.write(rendered_content)
228
+
229
+ except Exception as e:
230
+ console.print(f"[red]❌ Error rendering template {template_path}: {str(e)}[/red]")
231
+ raise