workflowforge 1.0b2__tar.gz → 1.0b4__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.

Potentially problematic release.


This version of workflowforge might be problematic. Click here for more details.

Files changed (60) hide show
  1. {workflowforge-1.0b2 → workflowforge-1.0b4}/.github/workflows/publish.yml +6 -0
  2. workflowforge-1.0b4/CHANGELOG.md +46 -0
  3. {workflowforge-1.0b2 → workflowforge-1.0b4}/PKG-INFO +138 -41
  4. {workflowforge-1.0b2 → workflowforge-1.0b4}/README.md +137 -40
  5. workflowforge-1.0b4/codebuild_spec.png +0 -0
  6. workflowforge-1.0b4/examples/README.md +58 -0
  7. workflowforge-1.0b4/examples/codebuild/buildspec.yml +19 -0
  8. workflowforge-1.0b4/examples/codebuild/node_app.py +44 -0
  9. workflowforge-1.0b4/examples/github_actions/basic_ci.py +31 -0
  10. workflowforge-1.0b4/examples/github_actions/basic_ci.yml +14 -0
  11. workflowforge-1.0b4/examples/github_actions/python_matrix.py +51 -0
  12. workflowforge-1.0b4/examples/github_actions/python_matrix.yml +28 -0
  13. workflowforge-1.0b4/examples/jenkins/Jenkinsfile +24 -0
  14. workflowforge-1.0b4/examples/jenkins/maven_build.py +35 -0
  15. {workflowforge-1.0b2 → workflowforge-1.0b4}/pyproject.toml +10 -1
  16. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/__init__.py +9 -1
  17. workflowforge-1.0b4/src/workflowforge/github_actions_module.py +72 -0
  18. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge.egg-info/PKG-INFO +138 -41
  19. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge.egg-info/SOURCES.txt +12 -6
  20. workflowforge-1.0b2/examples/ai_documentation_example.py +0 -126
  21. workflowforge-1.0b2/examples/basic_workflow.py +0 -75
  22. workflowforge-1.0b2/examples/codebuild_example.py +0 -95
  23. workflowforge-1.0b2/examples/jenkins_advanced.py +0 -113
  24. workflowforge-1.0b2/examples/jenkins_example.py +0 -54
  25. workflowforge-1.0b2/examples/visualization_example.py +0 -169
  26. {workflowforge-1.0b2 → workflowforge-1.0b4}/.flake8 +0 -0
  27. {workflowforge-1.0b2 → workflowforge-1.0b4}/.gitignore +0 -0
  28. {workflowforge-1.0b2 → workflowforge-1.0b4}/.pre-commit-config.yaml +0 -0
  29. {workflowforge-1.0b2 → workflowforge-1.0b4}/AUTHORS.md +0 -0
  30. {workflowforge-1.0b2 → workflowforge-1.0b4}/LICENSE +0 -0
  31. {workflowforge-1.0b2 → workflowforge-1.0b4}/MANIFEST.in +0 -0
  32. {workflowforge-1.0b2 → workflowforge-1.0b4}/README_PRECOMMIT.md +0 -0
  33. {workflowforge-1.0b2 → workflowforge-1.0b4}/setup.cfg +0 -0
  34. {workflowforge-1.0b2 → workflowforge-1.0b4}/setup.py +0 -0
  35. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/ai_documentation.py +0 -0
  36. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/codebuild.py +0 -0
  37. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/environment.py +0 -0
  38. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/jenkins.py +0 -0
  39. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/jenkins_plugins.py +0 -0
  40. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/job.py +0 -0
  41. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/schema_validation.py +0 -0
  42. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/secrets.py +0 -0
  43. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/step.py +0 -0
  44. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/strategy.py +0 -0
  45. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/templates.py +0 -0
  46. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/triggers.py +0 -0
  47. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/validation.py +0 -0
  48. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/visualization.py +0 -0
  49. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge/workflow.py +0 -0
  50. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge.egg-info/dependency_links.txt +0 -0
  51. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge.egg-info/requires.txt +0 -0
  52. {workflowforge-1.0b2 → workflowforge-1.0b4}/src/workflowforge.egg-info/top_level.txt +0 -0
  53. {workflowforge-1.0b2 → workflowforge-1.0b4}/tests/__init__.py +0 -0
  54. {workflowforge-1.0b2 → workflowforge-1.0b4}/tests/test_ai_documentation.py +0 -0
  55. {workflowforge-1.0b2 → workflowforge-1.0b4}/tests/test_codebuild.py +0 -0
  56. {workflowforge-1.0b2 → workflowforge-1.0b4}/tests/test_jenkins.py +0 -0
  57. {workflowforge-1.0b2 → workflowforge-1.0b4}/tests/test_secrets.py +0 -0
  58. {workflowforge-1.0b2 → workflowforge-1.0b4}/tests/test_templates.py +0 -0
  59. {workflowforge-1.0b2 → workflowforge-1.0b4}/tests/test_validation.py +0 -0
  60. {workflowforge-1.0b2 → workflowforge-1.0b4}/tests/test_workflow.py +0 -0
@@ -23,10 +23,16 @@ jobs:
23
23
  name: Install pip
24
24
  - run: pip install -e .[dev]
25
25
  name: Install dependencies
26
+ - run: pip install types-PyYAML types-requests
27
+ name: Install type stubs
26
28
  - run: black --check src/ tests/
27
29
  name: Check code formatting
28
30
  - run: isort --check-only src/ tests/
29
31
  name: Check import sorting
32
+ - run: flake8 src/ tests/ examples/
33
+ name: Lint with flake8
34
+ - run: mypy src/
35
+ name: Type check with mypy
30
36
  - run: pytest tests/ --cov=workflowforge --cov-report=xml
31
37
  name: Run tests with coverage
32
38
  strategy:
@@ -0,0 +1,46 @@
1
+ # Changelog
2
+
3
+ All notable changes to WorkflowForge will be documented in this file.
4
+
5
+ ## [1.0b3] - 2024-12-26
6
+
7
+ ### Added
8
+ - **Modular Import Structure**: Platform-specific imports for better organization
9
+ - `from workflowforge import github_actions`
10
+ - `from workflowforge import jenkins_platform`
11
+ - `from workflowforge import aws_codebuild`
12
+ - **Snake Case Naming**: Following Python PEP 8 conventions
13
+ - `github_actions.workflow()` instead of `Workflow()`
14
+ - `github_actions.job()` instead of `Job()`
15
+ - All functions now use snake_case
16
+ - **Examples Directory**: Complete working examples for all platforms
17
+ - GitHub Actions: basic CI and Python matrix testing
18
+ - Jenkins: Maven build pipeline
19
+ - AWS CodeBuild: Node.js application build
20
+ - **Backwards Compatibility**: Legacy imports still supported
21
+
22
+ ### Changed
23
+ - README updated with new import structure and examples
24
+ - Documentation reflects snake_case naming convention
25
+ - Version bumped to 1.0b3
26
+
27
+ ### Fixed
28
+ - Circular import issues resolved
29
+ - All examples tested and working
30
+ - Automatic diagram generation for all platforms
31
+
32
+ ## [1.0b2] - 2024-12-26
33
+
34
+ ### Fixed
35
+ - PyPI publishing pipeline with API tokens
36
+ - Safety command updated from deprecated 'check' to 'scan'
37
+ - TestPyPI vs PyPI URL configuration
38
+
39
+ ## [1.0b1] - 2024-12-26
40
+
41
+ ### Added
42
+ - Initial release with GitHub Actions, Jenkins, and AWS CodeBuild support
43
+ - AI documentation generation with Ollama
44
+ - Pipeline visualization with Graphviz
45
+ - Comprehensive test suite
46
+ - PyPI publishing workflow
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: workflowforge
3
- Version: 1.0b2
3
+ Version: 1.0b4
4
4
  Summary: A robust and flexible library for creating GitHub Actions workflows, Jenkins pipelines, and AWS CodeBuild BuildSpecs programmatically in Python
5
5
  Author-email: "Brainy Nimbus, LLC" <info@brainynimbus.io>
6
6
  License: MIT
@@ -37,6 +37,15 @@ Dynamic: license-file
37
37
 
38
38
  # WorkflowForge 🔨
39
39
 
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
41
+ [![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3110/)
42
+ [![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3120/)
43
+ [![Python 3.13](https://img.shields.io/badge/python-3.13-blue.svg)](https://www.python.org/downloads/release/python-3130/)
44
+ [![PyPI version](https://badge.fury.io/py/workflowforge.svg)](https://badge.fury.io/py/workflowforge)
45
+ [![Downloads](https://pepy.tech/badge/workflowforge)](https://pepy.tech/project/workflowforge)
46
+ [![Test PyPI](https://img.shields.io/badge/Test%20PyPI-published-green)](https://test.pypi.org/project/workflowforge/)
47
+ [![Tests](https://github.com/brainynimbus/workflowforge/workflows/Publish%20WorkflowForge%20to%20PyPI/badge.svg)](https://github.com/brainynimbus/workflowforge/actions)
48
+
40
49
  A robust and flexible library for creating GitHub Actions workflows, Jenkins pipelines, and AWS CodeBuild BuildSpecs programmatically in Python.
41
50
 
42
51
  ## ✨ Features
@@ -57,6 +66,22 @@ A robust and flexible library for creating GitHub Actions workflows, Jenkins pip
57
66
  pip install workflowforge
58
67
  ```
59
68
 
69
+ ## 📚 Examples
70
+
71
+ Check out the `examples/` directory for complete working examples:
72
+
73
+ ```bash
74
+ # Run all examples to see the new modular structure in action
75
+ python examples/run_all_examples.py
76
+
77
+ # Or run individual examples
78
+ python examples/github_actions/basic_ci.py
79
+ python examples/jenkins/maven_build.py
80
+ python examples/codebuild/node_app.py
81
+ ```
82
+
83
+ This will generate actual pipeline files and diagrams using the new import structure.
84
+
60
85
  ## 🤖 AI Documentation (Optional)
61
86
 
62
87
  WorkflowForge can automatically generate comprehensive README documentation for your workflows using **Ollama** (free local AI):
@@ -121,23 +146,21 @@ workflow.generate_diagram("pdf") # PDF document
121
146
 
122
147
  ## 📖 Basic Usage
123
148
 
149
+ ### New Modular Import Style (Recommended)
150
+
124
151
  ```python
125
- from workflowforge import (
126
- Workflow, Job,
127
- action, run,
128
- on_push, on_pull_request
129
- )
152
+ from workflowforge import github_actions
130
153
 
131
- # Create workflow
132
- workflow = Workflow(
154
+ # Create workflow using snake_case functions
155
+ workflow = github_actions.workflow(
133
156
  name="My Workflow",
134
- on=on_push(branches=["main"])
157
+ on=github_actions.on_push(branches=["main"])
135
158
  )
136
159
 
137
160
  # Create job
138
- job = Job(runs_on="ubuntu-latest")
139
- job.add_step(action("actions/checkout@v4", name="Checkout"))
140
- job.add_step(run("echo 'Hello World!'", name="Say Hello"))
161
+ job = github_actions.job(runs_on="ubuntu-latest")
162
+ job.add_step(github_actions.action("actions/checkout@v4", name="Checkout"))
163
+ job.add_step(github_actions.run("echo 'Hello World!'", name="Say Hello"))
141
164
 
142
165
  # Add job to workflow
143
166
  workflow.add_job("hello", job)
@@ -150,48 +173,63 @@ workflow.save(".github/workflows/hello.yml", generate_readme=True, generate_diag
150
173
  # Creates: hello.yml + hello_README.md + My_Workflow.png
151
174
  ```
152
175
 
153
- ### Jenkins Pipeline Usage
176
+ ### Legacy Import Style (Still Supported)
154
177
 
155
178
  ```python
156
179
  from workflowforge import (
157
- JenkinsPipeline, stage,
158
- agent_docker, pipeline
180
+ Workflow, Job,
181
+ action, run,
182
+ on_push, on_pull_request
159
183
  )
160
184
 
161
- # Create Jenkins pipeline
162
- jp = pipeline()
163
- jp.set_agent(agent_docker("maven:3.9.3-eclipse-temurin-17"))
185
+ # Create workflow (PascalCase classes)
186
+ workflow = Workflow(
187
+ name="My Workflow",
188
+ on=on_push(branches=["main"])
189
+ )
190
+ ```
191
+
192
+ ### Jenkins Pipeline Usage
193
+
194
+ ```python
195
+ from workflowforge import jenkins_platform
196
+
197
+ # Create Jenkins pipeline using snake_case
198
+ pipeline = jenkins_platform.pipeline()
199
+ pipeline.set_agent(jenkins_platform.agent_docker("maven:3.9.3-eclipse-temurin-17"))
164
200
 
165
201
  # Add stages
166
- build_stage = stage("Build")
202
+ build_stage = jenkins_platform.stage("Build")
167
203
  build_stage.add_step("mvn clean compile")
168
- jp.add_stage(build_stage)
204
+ pipeline.add_stage(build_stage)
169
205
 
170
- # Generate Jenkinsfile
171
- print(jp.to_jenkinsfile())
172
- jp.save("Jenkinsfile")
206
+ # Generate Jenkinsfile with diagram
207
+ pipeline.save("Jenkinsfile", generate_diagram=True)
208
+ # Creates: Jenkinsfile + jenkins_pipeline.png
173
209
  ```
174
210
 
175
211
  ### AWS CodeBuild BuildSpec Usage
176
212
 
177
213
  ```python
178
- from workflowforge import (
179
- buildspec, phase, environment, artifacts
180
- )
214
+ from workflowforge import aws_codebuild
181
215
 
182
- # Create BuildSpec
183
- spec = buildspec()
216
+ # Create BuildSpec using snake_case
217
+ spec = aws_codebuild.buildspec()
184
218
 
185
219
  # Add environment
186
- env = environment()
220
+ env = aws_codebuild.environment()
187
221
  env.add_variable("JAVA_HOME", "/usr/lib/jvm/java-17-openjdk")
188
222
  spec.set_env(env)
189
223
 
190
224
  # Add build phase
191
- build_phase = phase()
225
+ build_phase = aws_codebuild.phase()
192
226
  build_phase.add_command("mvn clean package")
193
227
  spec.set_build_phase(build_phase)
194
228
 
229
+ # Set artifacts
230
+ artifacts_obj = aws_codebuild.artifacts(["target/*.jar"])
231
+ spec.set_artifacts(artifacts_obj)
232
+
195
233
  # Generate buildspec.yml with AI documentation and diagram
196
234
  spec.save("buildspec.yml", generate_readme=True, use_ai=True, generate_diagram=True)
197
235
  # Creates: buildspec.yml + buildspec_README.md + codebuild_spec.png
@@ -229,18 +267,60 @@ else:
229
267
  print("Using template documentation (Ollama not running)")
230
268
  ```
231
269
 
270
+ ## 🆕 New Modular Import Structure
271
+
272
+ WorkflowForge now supports **platform-specific imports** with **snake_case naming** following Python conventions:
273
+
274
+ ### Platform Modules
275
+
276
+ ```python
277
+ # Import specific platforms
278
+ from workflowforge import github_actions, jenkins_platform, aws_codebuild
279
+
280
+ # Or use short aliases
281
+ from workflowforge import github_actions as gh
282
+ from workflowforge import jenkins_platform as jenkins
283
+ from workflowforge import aws_codebuild as cb
284
+ ```
285
+
286
+ ### Benefits
287
+
288
+ ✅ **Platform separation** - Clear namespace for each platform
289
+ ✅ **Snake case naming** - Follows Python PEP 8 conventions
290
+ ✅ **IDE autocompletion** - Better IntelliSense support
291
+ ✅ **Backwards compatibility** - Old imports still work
292
+ ✅ **Shorter code** - `gh.action()` vs `github_actions.action()`
293
+
294
+ ### Migration Guide
295
+
296
+ ```python
297
+ # Old style (still works)
298
+ from workflowforge import Workflow, Job, action, run, on_push
299
+
300
+ workflow = Workflow(name="CI", on=on_push())
301
+ job = Job(runs_on="ubuntu-latest")
302
+ job.add_step(action("actions/checkout@v4"))
303
+
304
+ # New style (recommended)
305
+ from workflowforge import github_actions as gh
306
+
307
+ workflow = gh.workflow(name="CI", on=gh.on_push())
308
+ job = gh.job(runs_on="ubuntu-latest")
309
+ job.add_step(gh.action("actions/checkout@v4"))
310
+ ```
311
+
232
312
  ## 🔧 Advanced Examples
233
313
 
234
314
  ### Build Matrix Workflow
235
315
 
236
316
  ```python
237
- from workflowforge import matrix, strategy
317
+ from workflowforge import github_actions as gh
238
318
 
239
- job = Job(
319
+ job = gh.job(
240
320
  runs_on="ubuntu-latest",
241
- strategy=strategy(
242
- matrix=matrix(
243
- python_version=["3.8", "3.9", "3.10", "3.11"],
321
+ strategy=gh.strategy(
322
+ matrix=gh.matrix(
323
+ python_version=["3.11", "3.12", "3.13"],
244
324
  os=["ubuntu-latest", "windows-latest"]
245
325
  )
246
326
  )
@@ -250,12 +330,14 @@ job = Job(
250
330
  ### Multiple Triggers
251
331
 
252
332
  ```python
253
- workflow = Workflow(
333
+ from workflowforge import github_actions as gh
334
+
335
+ workflow = gh.workflow(
254
336
  name="CI/CD",
255
337
  on=[
256
- on_push(branches=["main"]),
257
- on_pull_request(branches=["main"]),
258
- on_schedule("0 2 * * *") # Daily at 2 AM
338
+ gh.on_push(branches=["main"]),
339
+ gh.on_pull_request(branches=["main"]),
340
+ gh.on_schedule("0 2 * * *") # Daily at 2 AM
259
341
  ]
260
342
  )
261
343
  ```
@@ -263,9 +345,13 @@ workflow = Workflow(
263
345
  ### Jobs with Dependencies
264
346
 
265
347
  ```python
266
- test_job = Job(runs_on="ubuntu-latest")
267
- deploy_job = Job(runs_on="ubuntu-latest").set_needs("test")
348
+ from workflowforge import github_actions as gh
349
+
350
+ test_job = gh.job(runs_on="ubuntu-latest")
351
+ deploy_job = gh.job(runs_on="ubuntu-latest")
352
+ deploy_job.needs = "test"
268
353
 
354
+ workflow = gh.workflow(name="CI/CD")
269
355
  workflow.add_job("test", test_job)
270
356
  workflow.add_job("deploy", deploy_job)
271
357
  ```
@@ -331,6 +417,17 @@ MIT License - see [LICENSE](LICENSE) for details.
331
417
 
332
418
  ## 🔗 Links
333
419
 
420
+ **GitHub Actions:**
334
421
  - [GitHub Actions Documentation](https://docs.github.com/en/actions)
335
422
  - [Actions Marketplace](https://github.com/marketplace?type=actions)
336
423
  - [Workflow Syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
424
+
425
+ **Jenkins:**
426
+ - [Jenkins Documentation](https://www.jenkins.io/doc/)
427
+ - [Pipeline Syntax](https://www.jenkins.io/doc/book/pipeline/syntax/)
428
+ - [Jenkins Plugins](https://plugins.jenkins.io/)
429
+
430
+ **AWS CodeBuild:**
431
+ - [CodeBuild Documentation](https://docs.aws.amazon.com/codebuild/)
432
+ - [BuildSpec Reference](https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html)
433
+ - [CodeBuild Samples](https://docs.aws.amazon.com/codebuild/latest/userguide/samples.html)
@@ -1,5 +1,14 @@
1
1
  # WorkflowForge 🔨
2
2
 
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3110/)
5
+ [![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3120/)
6
+ [![Python 3.13](https://img.shields.io/badge/python-3.13-blue.svg)](https://www.python.org/downloads/release/python-3130/)
7
+ [![PyPI version](https://badge.fury.io/py/workflowforge.svg)](https://badge.fury.io/py/workflowforge)
8
+ [![Downloads](https://pepy.tech/badge/workflowforge)](https://pepy.tech/project/workflowforge)
9
+ [![Test PyPI](https://img.shields.io/badge/Test%20PyPI-published-green)](https://test.pypi.org/project/workflowforge/)
10
+ [![Tests](https://github.com/brainynimbus/workflowforge/workflows/Publish%20WorkflowForge%20to%20PyPI/badge.svg)](https://github.com/brainynimbus/workflowforge/actions)
11
+
3
12
  A robust and flexible library for creating GitHub Actions workflows, Jenkins pipelines, and AWS CodeBuild BuildSpecs programmatically in Python.
4
13
 
5
14
  ## ✨ Features
@@ -20,6 +29,22 @@ A robust and flexible library for creating GitHub Actions workflows, Jenkins pip
20
29
  pip install workflowforge
21
30
  ```
22
31
 
32
+ ## 📚 Examples
33
+
34
+ Check out the `examples/` directory for complete working examples:
35
+
36
+ ```bash
37
+ # Run all examples to see the new modular structure in action
38
+ python examples/run_all_examples.py
39
+
40
+ # Or run individual examples
41
+ python examples/github_actions/basic_ci.py
42
+ python examples/jenkins/maven_build.py
43
+ python examples/codebuild/node_app.py
44
+ ```
45
+
46
+ This will generate actual pipeline files and diagrams using the new import structure.
47
+
23
48
  ## 🤖 AI Documentation (Optional)
24
49
 
25
50
  WorkflowForge can automatically generate comprehensive README documentation for your workflows using **Ollama** (free local AI):
@@ -84,23 +109,21 @@ workflow.generate_diagram("pdf") # PDF document
84
109
 
85
110
  ## 📖 Basic Usage
86
111
 
112
+ ### New Modular Import Style (Recommended)
113
+
87
114
  ```python
88
- from workflowforge import (
89
- Workflow, Job,
90
- action, run,
91
- on_push, on_pull_request
92
- )
115
+ from workflowforge import github_actions
93
116
 
94
- # Create workflow
95
- workflow = Workflow(
117
+ # Create workflow using snake_case functions
118
+ workflow = github_actions.workflow(
96
119
  name="My Workflow",
97
- on=on_push(branches=["main"])
120
+ on=github_actions.on_push(branches=["main"])
98
121
  )
99
122
 
100
123
  # Create job
101
- job = Job(runs_on="ubuntu-latest")
102
- job.add_step(action("actions/checkout@v4", name="Checkout"))
103
- job.add_step(run("echo 'Hello World!'", name="Say Hello"))
124
+ job = github_actions.job(runs_on="ubuntu-latest")
125
+ job.add_step(github_actions.action("actions/checkout@v4", name="Checkout"))
126
+ job.add_step(github_actions.run("echo 'Hello World!'", name="Say Hello"))
104
127
 
105
128
  # Add job to workflow
106
129
  workflow.add_job("hello", job)
@@ -113,48 +136,63 @@ workflow.save(".github/workflows/hello.yml", generate_readme=True, generate_diag
113
136
  # Creates: hello.yml + hello_README.md + My_Workflow.png
114
137
  ```
115
138
 
116
- ### Jenkins Pipeline Usage
139
+ ### Legacy Import Style (Still Supported)
117
140
 
118
141
  ```python
119
142
  from workflowforge import (
120
- JenkinsPipeline, stage,
121
- agent_docker, pipeline
143
+ Workflow, Job,
144
+ action, run,
145
+ on_push, on_pull_request
122
146
  )
123
147
 
124
- # Create Jenkins pipeline
125
- jp = pipeline()
126
- jp.set_agent(agent_docker("maven:3.9.3-eclipse-temurin-17"))
148
+ # Create workflow (PascalCase classes)
149
+ workflow = Workflow(
150
+ name="My Workflow",
151
+ on=on_push(branches=["main"])
152
+ )
153
+ ```
154
+
155
+ ### Jenkins Pipeline Usage
156
+
157
+ ```python
158
+ from workflowforge import jenkins_platform
159
+
160
+ # Create Jenkins pipeline using snake_case
161
+ pipeline = jenkins_platform.pipeline()
162
+ pipeline.set_agent(jenkins_platform.agent_docker("maven:3.9.3-eclipse-temurin-17"))
127
163
 
128
164
  # Add stages
129
- build_stage = stage("Build")
165
+ build_stage = jenkins_platform.stage("Build")
130
166
  build_stage.add_step("mvn clean compile")
131
- jp.add_stage(build_stage)
167
+ pipeline.add_stage(build_stage)
132
168
 
133
- # Generate Jenkinsfile
134
- print(jp.to_jenkinsfile())
135
- jp.save("Jenkinsfile")
169
+ # Generate Jenkinsfile with diagram
170
+ pipeline.save("Jenkinsfile", generate_diagram=True)
171
+ # Creates: Jenkinsfile + jenkins_pipeline.png
136
172
  ```
137
173
 
138
174
  ### AWS CodeBuild BuildSpec Usage
139
175
 
140
176
  ```python
141
- from workflowforge import (
142
- buildspec, phase, environment, artifacts
143
- )
177
+ from workflowforge import aws_codebuild
144
178
 
145
- # Create BuildSpec
146
- spec = buildspec()
179
+ # Create BuildSpec using snake_case
180
+ spec = aws_codebuild.buildspec()
147
181
 
148
182
  # Add environment
149
- env = environment()
183
+ env = aws_codebuild.environment()
150
184
  env.add_variable("JAVA_HOME", "/usr/lib/jvm/java-17-openjdk")
151
185
  spec.set_env(env)
152
186
 
153
187
  # Add build phase
154
- build_phase = phase()
188
+ build_phase = aws_codebuild.phase()
155
189
  build_phase.add_command("mvn clean package")
156
190
  spec.set_build_phase(build_phase)
157
191
 
192
+ # Set artifacts
193
+ artifacts_obj = aws_codebuild.artifacts(["target/*.jar"])
194
+ spec.set_artifacts(artifacts_obj)
195
+
158
196
  # Generate buildspec.yml with AI documentation and diagram
159
197
  spec.save("buildspec.yml", generate_readme=True, use_ai=True, generate_diagram=True)
160
198
  # Creates: buildspec.yml + buildspec_README.md + codebuild_spec.png
@@ -192,18 +230,60 @@ else:
192
230
  print("Using template documentation (Ollama not running)")
193
231
  ```
194
232
 
233
+ ## 🆕 New Modular Import Structure
234
+
235
+ WorkflowForge now supports **platform-specific imports** with **snake_case naming** following Python conventions:
236
+
237
+ ### Platform Modules
238
+
239
+ ```python
240
+ # Import specific platforms
241
+ from workflowforge import github_actions, jenkins_platform, aws_codebuild
242
+
243
+ # Or use short aliases
244
+ from workflowforge import github_actions as gh
245
+ from workflowforge import jenkins_platform as jenkins
246
+ from workflowforge import aws_codebuild as cb
247
+ ```
248
+
249
+ ### Benefits
250
+
251
+ ✅ **Platform separation** - Clear namespace for each platform
252
+ ✅ **Snake case naming** - Follows Python PEP 8 conventions
253
+ ✅ **IDE autocompletion** - Better IntelliSense support
254
+ ✅ **Backwards compatibility** - Old imports still work
255
+ ✅ **Shorter code** - `gh.action()` vs `github_actions.action()`
256
+
257
+ ### Migration Guide
258
+
259
+ ```python
260
+ # Old style (still works)
261
+ from workflowforge import Workflow, Job, action, run, on_push
262
+
263
+ workflow = Workflow(name="CI", on=on_push())
264
+ job = Job(runs_on="ubuntu-latest")
265
+ job.add_step(action("actions/checkout@v4"))
266
+
267
+ # New style (recommended)
268
+ from workflowforge import github_actions as gh
269
+
270
+ workflow = gh.workflow(name="CI", on=gh.on_push())
271
+ job = gh.job(runs_on="ubuntu-latest")
272
+ job.add_step(gh.action("actions/checkout@v4"))
273
+ ```
274
+
195
275
  ## 🔧 Advanced Examples
196
276
 
197
277
  ### Build Matrix Workflow
198
278
 
199
279
  ```python
200
- from workflowforge import matrix, strategy
280
+ from workflowforge import github_actions as gh
201
281
 
202
- job = Job(
282
+ job = gh.job(
203
283
  runs_on="ubuntu-latest",
204
- strategy=strategy(
205
- matrix=matrix(
206
- python_version=["3.8", "3.9", "3.10", "3.11"],
284
+ strategy=gh.strategy(
285
+ matrix=gh.matrix(
286
+ python_version=["3.11", "3.12", "3.13"],
207
287
  os=["ubuntu-latest", "windows-latest"]
208
288
  )
209
289
  )
@@ -213,12 +293,14 @@ job = Job(
213
293
  ### Multiple Triggers
214
294
 
215
295
  ```python
216
- workflow = Workflow(
296
+ from workflowforge import github_actions as gh
297
+
298
+ workflow = gh.workflow(
217
299
  name="CI/CD",
218
300
  on=[
219
- on_push(branches=["main"]),
220
- on_pull_request(branches=["main"]),
221
- on_schedule("0 2 * * *") # Daily at 2 AM
301
+ gh.on_push(branches=["main"]),
302
+ gh.on_pull_request(branches=["main"]),
303
+ gh.on_schedule("0 2 * * *") # Daily at 2 AM
222
304
  ]
223
305
  )
224
306
  ```
@@ -226,9 +308,13 @@ workflow = Workflow(
226
308
  ### Jobs with Dependencies
227
309
 
228
310
  ```python
229
- test_job = Job(runs_on="ubuntu-latest")
230
- deploy_job = Job(runs_on="ubuntu-latest").set_needs("test")
311
+ from workflowforge import github_actions as gh
312
+
313
+ test_job = gh.job(runs_on="ubuntu-latest")
314
+ deploy_job = gh.job(runs_on="ubuntu-latest")
315
+ deploy_job.needs = "test"
231
316
 
317
+ workflow = gh.workflow(name="CI/CD")
232
318
  workflow.add_job("test", test_job)
233
319
  workflow.add_job("deploy", deploy_job)
234
320
  ```
@@ -294,6 +380,17 @@ MIT License - see [LICENSE](LICENSE) for details.
294
380
 
295
381
  ## 🔗 Links
296
382
 
383
+ **GitHub Actions:**
297
384
  - [GitHub Actions Documentation](https://docs.github.com/en/actions)
298
385
  - [Actions Marketplace](https://github.com/marketplace?type=actions)
299
386
  - [Workflow Syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
387
+
388
+ **Jenkins:**
389
+ - [Jenkins Documentation](https://www.jenkins.io/doc/)
390
+ - [Pipeline Syntax](https://www.jenkins.io/doc/book/pipeline/syntax/)
391
+ - [Jenkins Plugins](https://plugins.jenkins.io/)
392
+
393
+ **AWS CodeBuild:**
394
+ - [CodeBuild Documentation](https://docs.aws.amazon.com/codebuild/)
395
+ - [BuildSpec Reference](https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html)
396
+ - [CodeBuild Samples](https://docs.aws.amazon.com/codebuild/latest/userguide/samples.html)
Binary file
@@ -0,0 +1,58 @@
1
+ # WorkflowForge Examples
2
+
3
+ This directory contains examples demonstrating the new modular import structure of WorkflowForge.
4
+
5
+ ## New Import Style
6
+
7
+ Instead of importing everything from the main module:
8
+
9
+ ```python
10
+ # Old style (still works)
11
+ from workflowforge import Workflow, Job, action, run, on_push
12
+
13
+ # New modular style (recommended)
14
+ from workflowforge import github_actions
15
+
16
+ workflow = github_actions.workflow(name="CI")
17
+ job = github_actions.job(runs_on="ubuntu-latest")
18
+ job.add_step(github_actions.action("actions/checkout@v4"))
19
+ ```
20
+
21
+ ## Examples
22
+
23
+ ### GitHub Actions
24
+
25
+ - **basic_ci.py** - Simple CI pipeline with checkout and hello world
26
+ - **python_matrix.py** - Matrix testing across Python versions and OS
27
+
28
+ ### Jenkins
29
+
30
+ - **maven_build.py** - Maven build pipeline with multiple stages
31
+
32
+ ### AWS CodeBuild
33
+
34
+ - **node_app.py** - Node.js application build with testing and artifacts
35
+
36
+ ## Running Examples
37
+
38
+ Run individual examples:
39
+
40
+ ```bash
41
+ python examples/github_actions/basic_ci.py
42
+ python examples/jenkins/maven_build.py
43
+ python examples/codebuild/node_app.py
44
+ ```
45
+
46
+ Run all examples at once:
47
+
48
+ ```bash
49
+ python examples/run_all_examples.py
50
+ ```
51
+
52
+ ## Benefits of New Structure
53
+
54
+ ✅ **Platform separation** - Clear namespace for each platform
55
+ ✅ **Snake case naming** - Follows Python conventions
56
+ ✅ **IDE autocompletion** - Better IntelliSense support
57
+ ✅ **Backwards compatibility** - Old imports still work
58
+ ✅ **Shorter aliases** - `gh = github_actions` for convenience