prefect-shell 0.3.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.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2021 Prefect Technologies, Inc.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,9 @@
1
+ # Things to always exclude
2
+ global-exclude .git*
3
+ global-exclude .ipynb_checkpoints
4
+ global-exclude *.py[co]
5
+ global-exclude __pycache__/**
6
+
7
+ # Top-level Config
8
+ include LICENSE
9
+ include MANIFEST.in
@@ -0,0 +1,201 @@
1
+ Metadata-Version: 2.1
2
+ Name: prefect-shell
3
+ Version: 0.3.0
4
+ Summary: Prefect integrations for interacting with shell commands.
5
+ Author-email: "Prefect Technologies, Inc." <help@prefect.io>
6
+ License: Apache License 2.0
7
+ Project-URL: Homepage, https://github.com/PrefectHQ/prefect/tree/main/src/integrations/prefect-shell
8
+ Keywords: prefect
9
+ Classifier: Natural Language :: English
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: prefect>=3.0.0rc1
23
+ Provides-Extra: dev
24
+ Requires-Dist: aiohttp; extra == "dev"
25
+ Requires-Dist: coverage; extra == "dev"
26
+ Requires-Dist: interrogate; extra == "dev"
27
+ Requires-Dist: mkdocs-gen-files; extra == "dev"
28
+ Requires-Dist: mkdocs-material; extra == "dev"
29
+ Requires-Dist: mkdocs; extra == "dev"
30
+ Requires-Dist: mkdocstrings[python]; extra == "dev"
31
+ Requires-Dist: mypy; extra == "dev"
32
+ Requires-Dist: pillow; extra == "dev"
33
+ Requires-Dist: pre-commit; extra == "dev"
34
+ Requires-Dist: pytest-asyncio; extra == "dev"
35
+ Requires-Dist: pytest; extra == "dev"
36
+ Requires-Dist: pytest-env; extra == "dev"
37
+ Requires-Dist: pytest-xdist; extra == "dev"
38
+
39
+ # Integrating shell commands into your dataflow with `prefect-shell`
40
+
41
+ <p align="center">
42
+ <a href="https://pypi.python.org/pypi/prefect-shell/" alt="PyPI version">
43
+ <img alt="PyPI" src="https://img.shields.io/pypi/v/prefect-shell?color=0052FF&labelColor=090422"></a>
44
+ <a href="https://pepy.tech/badge/prefect-shell/" alt="Downloads">
45
+ <img src="https://img.shields.io/pypi/dm/prefect-shell?color=0052FF&labelColor=090422" /></a>
46
+ </p>
47
+
48
+ Visit the full docs [here](https://PrefectHQ.github.io/prefect-shell) to see additional examples and the API reference.
49
+
50
+ The prefect-shell collection makes it easy to execute shell commands in your Prefect flows. Check out the examples below to get started!
51
+
52
+ ## Getting Started
53
+
54
+ ### Integrate with Prefect flows
55
+
56
+ With prefect-shell, you can bring your trusty shell commands (and/or scripts) straight into the Prefect flow party, complete with awesome Prefect logging.
57
+
58
+ No more separate logs, just seamless integration. Let's get the shell-abration started!
59
+
60
+ ```python
61
+ from prefect import flow
62
+ from datetime import datetime
63
+ from prefect_shell import ShellOperation
64
+
65
+ @flow
66
+ def download_data():
67
+ today = datetime.today().strftime("%Y%m%d")
68
+
69
+ # for short running operations, you can use the `run` method
70
+ # which automatically manages the context
71
+ ShellOperation(
72
+ commands=[
73
+ "mkdir -p data",
74
+ "mkdir -p data/${today}"
75
+ ],
76
+ env={"today": today}
77
+ ).run()
78
+
79
+ # for long running operations, you can use a context manager
80
+ with ShellOperation(
81
+ commands=[
82
+ "curl -O https://masie_web.apps.nsidc.org/pub/DATASETS/NOAA/G02135/north/daily/data/N_seaice_extent_daily_v3.0.csv",
83
+ ],
84
+ working_dir=f"data/{today}",
85
+ ) as download_csv_operation:
86
+
87
+ # trigger runs the process in the background
88
+ download_csv_process = download_csv_operation.trigger()
89
+
90
+ # then do other things here in the meantime, like download another file
91
+ ...
92
+
93
+ # when you're ready, wait for the process to finish
94
+ download_csv_process.wait_for_completion()
95
+
96
+ # if you'd like to get the output lines, you can use the `fetch_result` method
97
+ output_lines = download_csv_process.fetch_result()
98
+
99
+ download_data()
100
+ ```
101
+
102
+ Outputs:
103
+ ```bash
104
+ 14:48:16.550 | INFO | prefect.engine - Created flow run 'tentacled-chachalaca' for flow 'download-data'
105
+ 14:48:17.977 | INFO | Flow run 'tentacled-chachalaca' - PID 19360 triggered with 2 commands running inside the '.' directory.
106
+ 14:48:17.987 | INFO | Flow run 'tentacled-chachalaca' - PID 19360 completed with return code 0.
107
+ 14:48:17.994 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 triggered with 1 commands running inside the PosixPath('data/20230201') directory.
108
+ 14:48:18.009 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
109
+ % Total % Received % Xferd Average Speed Time Time Time Current
110
+ Dl
111
+ 14:48:18.010 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
112
+ oad Upload Total Spent Left Speed
113
+ 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
114
+ 14:48:18.840 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
115
+ 11 1630k 11 192k 0 0 229k 0 0:00:07 --:--:-- 0:00:07 231k
116
+ 14:48:19.839 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
117
+ 83 1630k 83 1368k 0 0 745k 0 0:00:02 0:00:01 0:00:01 747k
118
+ 14:48:19.993 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
119
+ 100 1630k 100 1630k 0 0 819k 0 0
120
+ 14:48:19.994 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
121
+ :00:01 0:00:01 --:--:-- 821k
122
+ 14:48:19.996 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 completed with return code 0.
123
+ 14:48:19.998 | INFO | Flow run 'tentacled-chachalaca' - Successfully closed all open processes.
124
+ 14:48:20.203 | INFO | Flow run 'tentacled-chachalaca' - Finished in state Completed()
125
+ ```
126
+
127
+ !!! info "Utilize Previously Saved Blocks"
128
+
129
+ You can save commands within a `ShellOperation` block, then reuse them across multiple flows, or even plain Python scripts.
130
+
131
+ Save the block with desired commands:
132
+
133
+ ```python
134
+ from prefect_shell import ShellOperation
135
+
136
+ ping_op = ShellOperation(commands=["ping -t 1 prefect.io"])
137
+ ping_op.save("block-name")
138
+ ```
139
+
140
+ Load the saved block:
141
+
142
+ ```python
143
+ from prefect_shell import ShellOperation
144
+
145
+ ping_op = ShellOperation.load("block-name")
146
+ ```
147
+
148
+ To [view and edit the blocks](https://orion-docs.prefect.io/ui/blocks/) on Prefect UI:
149
+
150
+ ```bash
151
+ prefect block register -m prefect_shell
152
+ ```
153
+
154
+ ## Resources
155
+
156
+ For more tips on how to use tasks and flows in a Collection, check out [Using Collections](https://orion-docs.prefect.io/collections/usage/)!
157
+
158
+ ### Installation
159
+
160
+ Install `prefect-shell` with `pip`:
161
+
162
+ ```bash
163
+ pip install -U prefect-shell
164
+ ```
165
+
166
+ A list of available blocks in `prefect-shell` and their setup instructions can be found [here](https://PrefectHQ.github.io/prefect-shell/blocks_catalog).
167
+
168
+ Requires an installation of Python 3.7+.
169
+
170
+ We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.
171
+
172
+ These tasks are designed to work with Prefect 2. For more information about how to use Prefect, please refer to the [Prefect documentation](https://orion-docs.prefect.io/).
173
+
174
+ ### Feedback
175
+
176
+ If you encounter any bugs while using `prefect-shell`, feel free to open an issue in the [prefect-shell](https://github.com/PrefectHQ/prefect-shell) repository.
177
+
178
+ If you have any questions or issues while using `prefect-shell`, you can find help in either the [Prefect Discourse forum](https://discourse.prefect.io/) or the [Prefect Slack community](https://prefect.io/slack).
179
+
180
+ Feel free to star or watch [`prefect-shell`](https://github.com/PrefectHQ/prefect-shell) for updates too!
181
+
182
+ ### Contributing
183
+
184
+ If you'd like to help contribute to fix an issue or add a feature to `prefect-shell`, please [propose changes through a pull request from a fork of the repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork).
185
+
186
+ Here are the steps:
187
+
188
+ 1. [Fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository)
189
+ 2. [Clone the forked repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository)
190
+ 3. Install the repository and its dependencies:
191
+ ```
192
+ pip install -e ".[dev]"
193
+ ```
194
+ 4. Make desired changes
195
+ 5. Add tests
196
+ 6. Insert an entry to [CHANGELOG.md](https://github.com/PrefectHQ/prefect-shell/blob/main/CHANGELOG.md)
197
+ 7. Install `pre-commit` to perform quality checks prior to commit:
198
+ ```
199
+ pre-commit install
200
+ ```
201
+ 8. `git commit`, `git push`, and create a pull request
@@ -0,0 +1,163 @@
1
+ # Integrating shell commands into your dataflow with `prefect-shell`
2
+
3
+ <p align="center">
4
+ <a href="https://pypi.python.org/pypi/prefect-shell/" alt="PyPI version">
5
+ <img alt="PyPI" src="https://img.shields.io/pypi/v/prefect-shell?color=0052FF&labelColor=090422"></a>
6
+ <a href="https://pepy.tech/badge/prefect-shell/" alt="Downloads">
7
+ <img src="https://img.shields.io/pypi/dm/prefect-shell?color=0052FF&labelColor=090422" /></a>
8
+ </p>
9
+
10
+ Visit the full docs [here](https://PrefectHQ.github.io/prefect-shell) to see additional examples and the API reference.
11
+
12
+ The prefect-shell collection makes it easy to execute shell commands in your Prefect flows. Check out the examples below to get started!
13
+
14
+ ## Getting Started
15
+
16
+ ### Integrate with Prefect flows
17
+
18
+ With prefect-shell, you can bring your trusty shell commands (and/or scripts) straight into the Prefect flow party, complete with awesome Prefect logging.
19
+
20
+ No more separate logs, just seamless integration. Let's get the shell-abration started!
21
+
22
+ ```python
23
+ from prefect import flow
24
+ from datetime import datetime
25
+ from prefect_shell import ShellOperation
26
+
27
+ @flow
28
+ def download_data():
29
+ today = datetime.today().strftime("%Y%m%d")
30
+
31
+ # for short running operations, you can use the `run` method
32
+ # which automatically manages the context
33
+ ShellOperation(
34
+ commands=[
35
+ "mkdir -p data",
36
+ "mkdir -p data/${today}"
37
+ ],
38
+ env={"today": today}
39
+ ).run()
40
+
41
+ # for long running operations, you can use a context manager
42
+ with ShellOperation(
43
+ commands=[
44
+ "curl -O https://masie_web.apps.nsidc.org/pub/DATASETS/NOAA/G02135/north/daily/data/N_seaice_extent_daily_v3.0.csv",
45
+ ],
46
+ working_dir=f"data/{today}",
47
+ ) as download_csv_operation:
48
+
49
+ # trigger runs the process in the background
50
+ download_csv_process = download_csv_operation.trigger()
51
+
52
+ # then do other things here in the meantime, like download another file
53
+ ...
54
+
55
+ # when you're ready, wait for the process to finish
56
+ download_csv_process.wait_for_completion()
57
+
58
+ # if you'd like to get the output lines, you can use the `fetch_result` method
59
+ output_lines = download_csv_process.fetch_result()
60
+
61
+ download_data()
62
+ ```
63
+
64
+ Outputs:
65
+ ```bash
66
+ 14:48:16.550 | INFO | prefect.engine - Created flow run 'tentacled-chachalaca' for flow 'download-data'
67
+ 14:48:17.977 | INFO | Flow run 'tentacled-chachalaca' - PID 19360 triggered with 2 commands running inside the '.' directory.
68
+ 14:48:17.987 | INFO | Flow run 'tentacled-chachalaca' - PID 19360 completed with return code 0.
69
+ 14:48:17.994 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 triggered with 1 commands running inside the PosixPath('data/20230201') directory.
70
+ 14:48:18.009 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
71
+ % Total % Received % Xferd Average Speed Time Time Time Current
72
+ Dl
73
+ 14:48:18.010 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
74
+ oad Upload Total Spent Left Speed
75
+ 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
76
+ 14:48:18.840 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
77
+ 11 1630k 11 192k 0 0 229k 0 0:00:07 --:--:-- 0:00:07 231k
78
+ 14:48:19.839 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
79
+ 83 1630k 83 1368k 0 0 745k 0 0:00:02 0:00:01 0:00:01 747k
80
+ 14:48:19.993 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
81
+ 100 1630k 100 1630k 0 0 819k 0 0
82
+ 14:48:19.994 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 stream output:
83
+ :00:01 0:00:01 --:--:-- 821k
84
+ 14:48:19.996 | INFO | Flow run 'tentacled-chachalaca' - PID 19363 completed with return code 0.
85
+ 14:48:19.998 | INFO | Flow run 'tentacled-chachalaca' - Successfully closed all open processes.
86
+ 14:48:20.203 | INFO | Flow run 'tentacled-chachalaca' - Finished in state Completed()
87
+ ```
88
+
89
+ !!! info "Utilize Previously Saved Blocks"
90
+
91
+ You can save commands within a `ShellOperation` block, then reuse them across multiple flows, or even plain Python scripts.
92
+
93
+ Save the block with desired commands:
94
+
95
+ ```python
96
+ from prefect_shell import ShellOperation
97
+
98
+ ping_op = ShellOperation(commands=["ping -t 1 prefect.io"])
99
+ ping_op.save("block-name")
100
+ ```
101
+
102
+ Load the saved block:
103
+
104
+ ```python
105
+ from prefect_shell import ShellOperation
106
+
107
+ ping_op = ShellOperation.load("block-name")
108
+ ```
109
+
110
+ To [view and edit the blocks](https://orion-docs.prefect.io/ui/blocks/) on Prefect UI:
111
+
112
+ ```bash
113
+ prefect block register -m prefect_shell
114
+ ```
115
+
116
+ ## Resources
117
+
118
+ For more tips on how to use tasks and flows in a Collection, check out [Using Collections](https://orion-docs.prefect.io/collections/usage/)!
119
+
120
+ ### Installation
121
+
122
+ Install `prefect-shell` with `pip`:
123
+
124
+ ```bash
125
+ pip install -U prefect-shell
126
+ ```
127
+
128
+ A list of available blocks in `prefect-shell` and their setup instructions can be found [here](https://PrefectHQ.github.io/prefect-shell/blocks_catalog).
129
+
130
+ Requires an installation of Python 3.7+.
131
+
132
+ We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.
133
+
134
+ These tasks are designed to work with Prefect 2. For more information about how to use Prefect, please refer to the [Prefect documentation](https://orion-docs.prefect.io/).
135
+
136
+ ### Feedback
137
+
138
+ If you encounter any bugs while using `prefect-shell`, feel free to open an issue in the [prefect-shell](https://github.com/PrefectHQ/prefect-shell) repository.
139
+
140
+ If you have any questions or issues while using `prefect-shell`, you can find help in either the [Prefect Discourse forum](https://discourse.prefect.io/) or the [Prefect Slack community](https://prefect.io/slack).
141
+
142
+ Feel free to star or watch [`prefect-shell`](https://github.com/PrefectHQ/prefect-shell) for updates too!
143
+
144
+ ### Contributing
145
+
146
+ If you'd like to help contribute to fix an issue or add a feature to `prefect-shell`, please [propose changes through a pull request from a fork of the repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork).
147
+
148
+ Here are the steps:
149
+
150
+ 1. [Fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository)
151
+ 2. [Clone the forked repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository)
152
+ 3. Install the repository and its dependencies:
153
+ ```
154
+ pip install -e ".[dev]"
155
+ ```
156
+ 4. Make desired changes
157
+ 5. Add tests
158
+ 6. Insert an entry to [CHANGELOG.md](https://github.com/PrefectHQ/prefect-shell/blob/main/CHANGELOG.md)
159
+ 7. Install `pre-commit` to perform quality checks prior to commit:
160
+ ```
161
+ pre-commit install
162
+ ```
163
+ 8. `git commit`, `git push`, and create a pull request
@@ -0,0 +1,4 @@
1
+ from . import _version
2
+ from .commands import shell_run_command, ShellOperation # noqa
3
+
4
+ __version__ = _version.__version__
@@ -0,0 +1,16 @@
1
+ # file generated by setuptools_scm
2
+ # don't change, don't track in version control
3
+ TYPE_CHECKING = False
4
+ if TYPE_CHECKING:
5
+ from typing import Tuple, Union
6
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
7
+ else:
8
+ VERSION_TUPLE = object
9
+
10
+ version: str
11
+ __version__: str
12
+ __version_tuple__: VERSION_TUPLE
13
+ version_tuple: VERSION_TUPLE
14
+
15
+ __version__ = version = '0.3.0'
16
+ __version_tuple__ = version_tuple = (0, 3, 0)