pipeforge 1.0.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.
Files changed (28) hide show
  1. pipeforge-1.0.0/PKG-INFO +198 -0
  2. pipeforge-1.0.0/README.md +183 -0
  3. pipeforge-1.0.0/pipeforge/__init__.py +1201 -0
  4. pipeforge-1.0.0/pipeforge/__main__.py +208 -0
  5. pipeforge-1.0.0/pipeforge/_internal/__init__.py +0 -0
  6. pipeforge-1.0.0/pipeforge/_internal/core_loop.py +700 -0
  7. pipeforge-1.0.0/pipeforge/_internal/database.py +515 -0
  8. pipeforge-1.0.0/pipeforge/_internal/drawing.py +544 -0
  9. pipeforge-1.0.0/pipeforge/_internal/file_loader.py +654 -0
  10. pipeforge-1.0.0/pipeforge/_internal/inspector.py +555 -0
  11. pipeforge-1.0.0/pipeforge/_internal/params.py +148 -0
  12. pipeforge-1.0.0/pipeforge/_internal/pipeline.py +212 -0
  13. pipeforge-1.0.0/pipeforge/_internal/script.py +1004 -0
  14. pipeforge-1.0.0/pipeforge/_internal/utils.py +122 -0
  15. pipeforge-1.0.0/pipeforge/examples/hello_jenkins.toml +16 -0
  16. pipeforge-1.0.0/pipeforge/examples/hello_world.toml +67 -0
  17. pipeforge-1.0.0/pipeforge/examples/merge_pull_request.toml +240 -0
  18. pipeforge-1.0.0/pipeforge/examples/multi_pipeline.toml +93 -0
  19. pipeforge-1.0.0/pipeforge/examples/multi_pipeline_2.toml +54 -0
  20. pipeforge-1.0.0/pipeforge/examples/nightly.toml +19 -0
  21. pipeforge-1.0.0/pipeforge/examples/retries.toml +43 -0
  22. pipeforge-1.0.0/pipeforge/examples/scripts/hello_world__get_purpose_in_life.py +34 -0
  23. pipeforge-1.0.0/pipeforge/examples/scripts/hello_world__print_summary.py +27 -0
  24. pipeforge-1.0.0/pipeforge/examples/scripts/hello_world__repeat_purpose.py +33 -0
  25. pipeforge-1.0.0/pipeforge/examples/scripts/retry.py +25 -0
  26. pipeforge-1.0.0/pipeforge/examples/scripts/timeout.py +25 -0
  27. pipeforge-1.0.0/pipeforge/examples/timeout.toml +37 -0
  28. pipeforge-1.0.0/pyproject.toml +45 -0
@@ -0,0 +1,198 @@
1
+ Metadata-Version: 2.4
2
+ Name: pipeforge
3
+ Version: 1.0.0
4
+ Summary: A pipeline jobs orchestrator
5
+ Project-URL: Homepage, https://git.sr.ht/~greenfoo/pipeforge
6
+ Project-URL: Issues, https://todo.sr.ht/~greenfoo/pipeforge
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Programming Language :: Python :: 3
9
+ Requires-Python: >=3.7
10
+ Requires-Dist: mongoengine
11
+ Requires-Dist: toml
12
+ Provides-Extra: jenkins
13
+ Requires-Dist: python-jenkins; extra == 'jenkins'
14
+ Description-Content-Type: text/markdown
15
+
16
+ # 1. One line description
17
+
18
+ A pipeline jobs orchestrator library *and* stand-alone script (which can be used
19
+ directly from the command line)
20
+
21
+
22
+ # 2. Information for users
23
+
24
+
25
+ ## 2.1. Installation
26
+
27
+ You don't want to use this repository directly. Instead you should install the
28
+ latest released version by running this command:
29
+
30
+ $ python -m pip install pipeforge
31
+
32
+
33
+ ## 2.2. User guide
34
+
35
+ Check [this file](pipeforge/__init__.py) for the full guide.
36
+
37
+ You can also access this same information from python itself:
38
+
39
+ import pipeforge
40
+
41
+ help(pipeforge)
42
+
43
+
44
+ All public classes and functions are fully documented:
45
+
46
+ import pipeforge
47
+
48
+ help(pipeforge.log_configure)
49
+ help(pipeforge.ScriptManager)
50
+ help(pipeforge.Pipeline)
51
+
52
+ help(pipeforge.JobParams)
53
+
54
+
55
+ # 3. Information for developers
56
+
57
+
58
+ ## 3.1. Development environment
59
+
60
+ First of all you need a mongoDB server running somewhere. You can deploy one
61
+ locally and make it listen on port 27017 by running this command:
62
+
63
+ $ podman run -p 27017:27017 docker.io/library/mongo
64
+
65
+ Leave it running as "pipeforge" needs it in order to work.
66
+
67
+ Next, make sure you have all python modules listed in "dependencies" section
68
+ found inside the pyproject.toml file already installed, if not, use your distro
69
+ package manager to install them:
70
+
71
+ $ cat pyproject.toml | awk '/dependencies/,/]/'
72
+ $ pacman -S ...
73
+
74
+ NOTE: This (installing dependencies through the global package manager) is
75
+ preferred to creating a virtual environment and using "python -m pip
76
+ install" inside of it because it makes it simpler to run the examples.
77
+ If you insist on using a virtual environment, this is what you need to do:
78
+
79
+ $ python -m venv .venv
80
+ $ source .venv/bin/activate
81
+ $ python -m pip install .
82
+
83
+
84
+ Next, update the value of PYTHONPATH to make sure it searches for "pipeforce" in
85
+ the current folder (where the source code is) instead of in system paths (in
86
+ case you had already "pip install"ed it in the past):
87
+
88
+ $ export PYTHONPATH=`pwd`:$PYTHONPATH
89
+
90
+
91
+ You can now run the different demos like this:
92
+
93
+ DEMO #1:
94
+ Run (locally) a few python scripts that share inputs and outputs one with
95
+ each other. It takes ~10 seconds to complete.
96
+
97
+ $ export PIPEFORGERUNNER_HEARTBEAT_SECONDS=1
98
+ $ python pipeforge run mongodb://localhost:27017/pipelines__test pipeforge/examples/hello_world.toml LocalScriptManager
99
+
100
+ DEMO #2:
101
+ Simulate running a more complex pipeline with many steps without actually
102
+ executing anything. It takes ~1 minute to complete.
103
+
104
+ $ export PIPEFORGE__TARGET_BRANCH=origin/master
105
+ $ export PIPEFORGE__FEATURE_BRANCH=origin/my_new_feature
106
+ $ python pipeforge run mongodb://localhost:27017/pipelines__test pipeforge/examples/merge_pull_request.toml DummyScriptManager
107
+
108
+
109
+ While any of the previous demos is running you can monitor its real-time
110
+ execution progress by opening another terminal and running this command:
111
+
112
+ $ python pipeforge inspector mongodb://localhost:27017/pipelines__test
113
+
114
+
115
+ ## 3.2. Running built-in tests
116
+
117
+ In addition to running "demo pipelines" (such as those in the
118
+ "pipeforge/examples" folder that we used in the previous section) you can also
119
+ run a full suite of pre-built test cases:
120
+
121
+ $ ./tests/run.py
122
+
123
+ Note you *must* make sure this command returns "OK" after making any change to
124
+ the source code!
125
+
126
+ If one test fail you can obtain a detailed log of what is going on by re-running
127
+ it in isolation like this:
128
+
129
+ $ ./tests/run.py --test=A:7 # (or A:4, or B:3, ... depending on the test
130
+ # template and number)
131
+
132
+
133
+ ## 3.3. Running the code linter
134
+
135
+ Before merging new changes you *must* also check that the following command
136
+ returns an empty list of warnings:
137
+
138
+ $ ruff check .
139
+
140
+ NOTE: You might need to install "ruff" first. If so, use you distro's package
141
+ manager.
142
+
143
+
144
+ ## 3.4. Distribution
145
+
146
+
147
+ ### 3.4.1. As a python package
148
+
149
+ The source code in this repository is meant to be distributed as a python
150
+ package that can be "pip install"ed.
151
+
152
+ Once you are ready to make a release:
153
+
154
+ 1. Increase the "version" number in file "pyproject.toml"
155
+ 2. Run the next command:
156
+
157
+ $ ./release.sh package
158
+
159
+ 3. Publish the contents of the "dist" folder to a remote package repository
160
+ such as PyPi (see
161
+ [here](https://packaging.python.org/en/latest/tutorials/packaging-projects/))
162
+
163
+ 4. Tell your users that a new version is available and that they can install
164
+ it by running this command:
165
+
166
+ $ python -m pip install pipeforge
167
+
168
+
169
+ ### 3.4.2. As a python standalone script
170
+
171
+ You can also create a "single file" script that can be run directly from the
172
+ command line without the need to install it as a package.
173
+
174
+ In order to do that, run this command:
175
+
176
+ $ ./release.sh script
177
+
178
+ The resulting binary ("pipeforge.pyz") can be copied to a different computer and
179
+ run like this:
180
+
181
+ $ python pipeforge.pyz --help
182
+
183
+
184
+ ### 3.4.3. As a standalone executable
185
+
186
+ Finally, you can create a single binary which does not even require python to be
187
+ installed in the system to work.
188
+
189
+ $ ./release.sh exe
190
+
191
+ The resulting binary ("pipeforge.exe") can be copied to a different computer and
192
+ run like this:
193
+
194
+ $ ./pipeforge.exe --help
195
+
196
+ NOTE: This will generate a Linux ELF executable if you run "release.sh exe" from
197
+ a Linux system, and a Windows EXE file if you run it from a Windows system.
198
+
@@ -0,0 +1,183 @@
1
+ # 1. One line description
2
+
3
+ A pipeline jobs orchestrator library *and* stand-alone script (which can be used
4
+ directly from the command line)
5
+
6
+
7
+ # 2. Information for users
8
+
9
+
10
+ ## 2.1. Installation
11
+
12
+ You don't want to use this repository directly. Instead you should install the
13
+ latest released version by running this command:
14
+
15
+ $ python -m pip install pipeforge
16
+
17
+
18
+ ## 2.2. User guide
19
+
20
+ Check [this file](pipeforge/__init__.py) for the full guide.
21
+
22
+ You can also access this same information from python itself:
23
+
24
+ import pipeforge
25
+
26
+ help(pipeforge)
27
+
28
+
29
+ All public classes and functions are fully documented:
30
+
31
+ import pipeforge
32
+
33
+ help(pipeforge.log_configure)
34
+ help(pipeforge.ScriptManager)
35
+ help(pipeforge.Pipeline)
36
+
37
+ help(pipeforge.JobParams)
38
+
39
+
40
+ # 3. Information for developers
41
+
42
+
43
+ ## 3.1. Development environment
44
+
45
+ First of all you need a mongoDB server running somewhere. You can deploy one
46
+ locally and make it listen on port 27017 by running this command:
47
+
48
+ $ podman run -p 27017:27017 docker.io/library/mongo
49
+
50
+ Leave it running as "pipeforge" needs it in order to work.
51
+
52
+ Next, make sure you have all python modules listed in "dependencies" section
53
+ found inside the pyproject.toml file already installed, if not, use your distro
54
+ package manager to install them:
55
+
56
+ $ cat pyproject.toml | awk '/dependencies/,/]/'
57
+ $ pacman -S ...
58
+
59
+ NOTE: This (installing dependencies through the global package manager) is
60
+ preferred to creating a virtual environment and using "python -m pip
61
+ install" inside of it because it makes it simpler to run the examples.
62
+ If you insist on using a virtual environment, this is what you need to do:
63
+
64
+ $ python -m venv .venv
65
+ $ source .venv/bin/activate
66
+ $ python -m pip install .
67
+
68
+
69
+ Next, update the value of PYTHONPATH to make sure it searches for "pipeforce" in
70
+ the current folder (where the source code is) instead of in system paths (in
71
+ case you had already "pip install"ed it in the past):
72
+
73
+ $ export PYTHONPATH=`pwd`:$PYTHONPATH
74
+
75
+
76
+ You can now run the different demos like this:
77
+
78
+ DEMO #1:
79
+ Run (locally) a few python scripts that share inputs and outputs one with
80
+ each other. It takes ~10 seconds to complete.
81
+
82
+ $ export PIPEFORGERUNNER_HEARTBEAT_SECONDS=1
83
+ $ python pipeforge run mongodb://localhost:27017/pipelines__test pipeforge/examples/hello_world.toml LocalScriptManager
84
+
85
+ DEMO #2:
86
+ Simulate running a more complex pipeline with many steps without actually
87
+ executing anything. It takes ~1 minute to complete.
88
+
89
+ $ export PIPEFORGE__TARGET_BRANCH=origin/master
90
+ $ export PIPEFORGE__FEATURE_BRANCH=origin/my_new_feature
91
+ $ python pipeforge run mongodb://localhost:27017/pipelines__test pipeforge/examples/merge_pull_request.toml DummyScriptManager
92
+
93
+
94
+ While any of the previous demos is running you can monitor its real-time
95
+ execution progress by opening another terminal and running this command:
96
+
97
+ $ python pipeforge inspector mongodb://localhost:27017/pipelines__test
98
+
99
+
100
+ ## 3.2. Running built-in tests
101
+
102
+ In addition to running "demo pipelines" (such as those in the
103
+ "pipeforge/examples" folder that we used in the previous section) you can also
104
+ run a full suite of pre-built test cases:
105
+
106
+ $ ./tests/run.py
107
+
108
+ Note you *must* make sure this command returns "OK" after making any change to
109
+ the source code!
110
+
111
+ If one test fail you can obtain a detailed log of what is going on by re-running
112
+ it in isolation like this:
113
+
114
+ $ ./tests/run.py --test=A:7 # (or A:4, or B:3, ... depending on the test
115
+ # template and number)
116
+
117
+
118
+ ## 3.3. Running the code linter
119
+
120
+ Before merging new changes you *must* also check that the following command
121
+ returns an empty list of warnings:
122
+
123
+ $ ruff check .
124
+
125
+ NOTE: You might need to install "ruff" first. If so, use you distro's package
126
+ manager.
127
+
128
+
129
+ ## 3.4. Distribution
130
+
131
+
132
+ ### 3.4.1. As a python package
133
+
134
+ The source code in this repository is meant to be distributed as a python
135
+ package that can be "pip install"ed.
136
+
137
+ Once you are ready to make a release:
138
+
139
+ 1. Increase the "version" number in file "pyproject.toml"
140
+ 2. Run the next command:
141
+
142
+ $ ./release.sh package
143
+
144
+ 3. Publish the contents of the "dist" folder to a remote package repository
145
+ such as PyPi (see
146
+ [here](https://packaging.python.org/en/latest/tutorials/packaging-projects/))
147
+
148
+ 4. Tell your users that a new version is available and that they can install
149
+ it by running this command:
150
+
151
+ $ python -m pip install pipeforge
152
+
153
+
154
+ ### 3.4.2. As a python standalone script
155
+
156
+ You can also create a "single file" script that can be run directly from the
157
+ command line without the need to install it as a package.
158
+
159
+ In order to do that, run this command:
160
+
161
+ $ ./release.sh script
162
+
163
+ The resulting binary ("pipeforge.pyz") can be copied to a different computer and
164
+ run like this:
165
+
166
+ $ python pipeforge.pyz --help
167
+
168
+
169
+ ### 3.4.3. As a standalone executable
170
+
171
+ Finally, you can create a single binary which does not even require python to be
172
+ installed in the system to work.
173
+
174
+ $ ./release.sh exe
175
+
176
+ The resulting binary ("pipeforge.exe") can be copied to a different computer and
177
+ run like this:
178
+
179
+ $ ./pipeforge.exe --help
180
+
181
+ NOTE: This will generate a Linux ELF executable if you run "release.sh exe" from
182
+ a Linux system, and a Windows EXE file if you run it from a Windows system.
183
+