pintel 0.3.0.dev0__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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Astariul
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,230 @@
1
+ Metadata-Version: 2.4
2
+ Name: pintel
3
+ Version: 0.3.0.dev0
4
+ Summary: Scale your ML workers asynchronously across processes and machines
5
+ Home-page: https://github.com/astariul/pintel
6
+ Author: Nicolas REMOND
7
+ Author-email: remondnicola@gmail.com
8
+ Classifier: Programming Language :: Python :: 3.8
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: pyzmq<27.0,>=22.3
14
+ Requires-Dist: msgpack~=1.0
15
+ Requires-Dist: loguru~=0.6
16
+ Provides-Extra: test
17
+ Requires-Dist: pytest~=8.0; extra == "test"
18
+ Requires-Dist: pytest-asyncio~=0.18; extra == "test"
19
+ Requires-Dist: pytest-cov~=3.0; extra == "test"
20
+ Requires-Dist: coverage-badge~=1.0; extra == "test"
21
+ Provides-Extra: hook
22
+ Requires-Dist: pre-commit~=4.0; extra == "hook"
23
+ Provides-Extra: lint
24
+ Requires-Dist: isort~=5.9; extra == "lint"
25
+ Requires-Dist: black~=24.1; extra == "lint"
26
+ Requires-Dist: flake518~=1.2; extra == "lint"
27
+ Requires-Dist: darglint~=1.8; extra == "lint"
28
+ Provides-Extra: docs
29
+ Requires-Dist: mkdocs-material~=9.0; extra == "docs"
30
+ Requires-Dist: mkdocstrings[python]~=0.18; extra == "docs"
31
+ Requires-Dist: mike~=2.0; extra == "docs"
32
+ Provides-Extra: ex
33
+ Requires-Dist: fastapi~=0.75; extra == "ex"
34
+ Requires-Dist: uvicorn~=0.17; extra == "ex"
35
+ Requires-Dist: requests~=2.27; extra == "ex"
36
+ Requires-Dist: transformers~=4.17; extra == "ex"
37
+ Provides-Extra: all
38
+ Requires-Dist: pytest~=8.0; extra == "all"
39
+ Requires-Dist: pytest-asyncio~=0.18; extra == "all"
40
+ Requires-Dist: pytest-cov~=3.0; extra == "all"
41
+ Requires-Dist: coverage-badge~=1.0; extra == "all"
42
+ Requires-Dist: pre-commit~=4.0; extra == "all"
43
+ Requires-Dist: isort~=5.9; extra == "all"
44
+ Requires-Dist: black~=24.1; extra == "all"
45
+ Requires-Dist: flake518~=1.2; extra == "all"
46
+ Requires-Dist: darglint~=1.8; extra == "all"
47
+ Requires-Dist: mkdocs-material~=9.0; extra == "all"
48
+ Requires-Dist: mkdocstrings[python]~=0.18; extra == "all"
49
+ Requires-Dist: mike~=2.0; extra == "all"
50
+ Requires-Dist: fastapi~=0.75; extra == "all"
51
+ Requires-Dist: uvicorn~=0.17; extra == "all"
52
+ Requires-Dist: requests~=2.27; extra == "all"
53
+ Requires-Dist: transformers~=4.17; extra == "all"
54
+ Provides-Extra: dev
55
+ Requires-Dist: pytest~=8.0; extra == "dev"
56
+ Requires-Dist: pytest-asyncio~=0.18; extra == "dev"
57
+ Requires-Dist: pytest-cov~=3.0; extra == "dev"
58
+ Requires-Dist: coverage-badge~=1.0; extra == "dev"
59
+ Requires-Dist: pre-commit~=4.0; extra == "dev"
60
+ Requires-Dist: isort~=5.9; extra == "dev"
61
+ Requires-Dist: black~=24.1; extra == "dev"
62
+ Requires-Dist: flake518~=1.2; extra == "dev"
63
+ Requires-Dist: darglint~=1.8; extra == "dev"
64
+ Requires-Dist: mkdocs-material~=9.0; extra == "dev"
65
+ Requires-Dist: mkdocstrings[python]~=0.18; extra == "dev"
66
+ Requires-Dist: mike~=2.0; extra == "dev"
67
+ Dynamic: author
68
+ Dynamic: author-email
69
+ Dynamic: classifier
70
+ Dynamic: description
71
+ Dynamic: description-content-type
72
+ Dynamic: home-page
73
+ Dynamic: license-file
74
+ Dynamic: provides-extra
75
+ Dynamic: requires-dist
76
+ Dynamic: requires-python
77
+ Dynamic: summary
78
+
79
+ <h1 align="center">pintel</h1>
80
+ <p align="center">
81
+ Scale your ML workers asynchronously across processes and machines
82
+ </p>
83
+
84
+ <p align="center">
85
+ <a href="https://github.com/astariul/pintel/releases"><img src="https://img.shields.io/github/release/astariul/pintel.svg" alt="GitHub release" /></a>
86
+ <a href="https://github.com/astariul/pintel/actions/workflows/pytest.yaml"><img src="https://github.com/astariul/pintel/actions/workflows/pytest.yaml/badge.svg" alt="Test status" /></a>
87
+ <a href="https://github.com/astariul/pintel/actions/workflows/lint.yaml"><img src="https://github.com/astariul/pintel/actions/workflows/lint.yaml/badge.svg" alt="Lint status" /></a>
88
+ <img src=".github/badges/coverage.svg" alt="Coverage status" />
89
+ <a href="https://astariul.github.io/pintel"><img src="https://img.shields.io/website?down_message=failing&label=docs&up_color=green&up_message=passing&url=https%3A%2F%2Fastariul.github.io%2Fpintel" alt="Docs" /></a>
90
+ <a href="https://github.com/astariul/pintel/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="licence" /></a>
91
+ </p>
92
+
93
+ <p align="center">
94
+ <a href="#description">Description</a> •
95
+ <a href="#install">Install</a> •
96
+ <a href="#usage">Usage</a> •
97
+ <a href="#faq">FAQ</a> •
98
+ <a href="#contribute">Contribute</a>
99
+ <br>
100
+ <a href="https://astariul.github.io/pintel/" target="_blank">Documentation</a>
101
+ </p>
102
+
103
+
104
+ <h2 align="center">Description</h2>
105
+
106
+ **`pintel`** is a python package that helps you scale your ML workers (or any python code) across processes and machines, asynchronously.
107
+
108
+ `pintel` is :
109
+
110
+ * ⚡️ Highly performant
111
+ * 🔀 Asynchronous
112
+ * 🐥 Easy-to-use
113
+
114
+
115
+ <h2 align="center">Install</h2>
116
+
117
+ Install `pintel` by running :
118
+
119
+
120
+ ```
121
+ pip install pintel
122
+ ```
123
+
124
+
125
+ <h2 align="center">Usage</h2>
126
+
127
+ After defining your awesome model :
128
+
129
+ ```python
130
+ import time
131
+
132
+ class MyAwesomeModel:
133
+ def __init__(self, wait_time=0.25):
134
+ super().__init__()
135
+ self.w = wait_time
136
+
137
+ def __call__(self, x):
138
+ time.sleep(self.w)
139
+ return x**2
140
+ ```
141
+
142
+ You can simply start a few workers serving the model :
143
+
144
+ ```python
145
+ from pintel import Worker
146
+
147
+ for _ in range(4):
148
+ Worker(MyAwesomeModel).start()
149
+ ```
150
+
151
+ And send requests through the Hub :
152
+
153
+ ```python
154
+ from pintel import Hub
155
+
156
+ hub = Hub()
157
+
158
+ # In an async function
159
+ await hub.request(34)
160
+ ```
161
+
162
+ And that's it !
163
+
164
+ ---
165
+
166
+ Make sure to check the [documentation](https://astariul.github.io/pintel/usage/) for a more detailed explanation.
167
+
168
+ Or you can run some examples from the `examples/` folder.
169
+
170
+
171
+ <h2 align="center">FAQ</h2>
172
+
173
+ #### ❓ **How `pintel` works ?**
174
+
175
+ `pintel` simply run your model code in separate processes, and send requests to the right process to ensure requests are treated in parallel.
176
+
177
+ `pintel` uses a modified form of [the Paranoid Pirate Pattern from the zmq guide](https://zguide.zeromq.org/docs/chapter4/#Robust-Reliable-Queuing-Paranoid-Pirate-Pattern).
178
+
179
+ #### ❓ **Why the name "pintel" ?**
180
+
181
+ Pintel is one of the pirates of Captain Barbossa's crew on the Black Pearl.
182
+ Since we are using the Paranoid Pirate Pattern, we needed a pirate name !
183
+
184
+ <h2 align="center">Contribute</h2>
185
+
186
+ To contribute, install the package locally, create your own branch, add your code (and tests, and documentation), and open a PR !
187
+
188
+ ### Pre-commit hooks
189
+
190
+ Pre-commit hooks are set to check the code added whenever you commit something.
191
+
192
+ If you never ran the hooks before, install it with :
193
+
194
+ ```bash
195
+ pre-commit install
196
+ ```
197
+
198
+ ---
199
+
200
+ Then you can just try to commit your code. If you code does not meet the quality required by linters, it will not be committed. You can just fix your code and try to commit again !
201
+
202
+ ---
203
+
204
+ You can manually run the pre-commit hooks with :
205
+
206
+ ```bash
207
+ pre-commit run --all-files
208
+ ```
209
+
210
+ ### Tests
211
+
212
+ When you contribute, you need to make sure all the unit-tests pass. You should also add tests if necessary !
213
+
214
+ You can run the tests with :
215
+
216
+ ```bash
217
+ pytest
218
+ ```
219
+
220
+ ---
221
+
222
+ Pre-commit hooks will not run the tests, but it will automatically update the coverage badge !
223
+
224
+ ### Documentation
225
+
226
+ The documentation should be kept up-to-date. You can visualize the documentation locally by running :
227
+
228
+ ```bash
229
+ mkdocs serve
230
+ ```
@@ -0,0 +1,152 @@
1
+ <h1 align="center">pintel</h1>
2
+ <p align="center">
3
+ Scale your ML workers asynchronously across processes and machines
4
+ </p>
5
+
6
+ <p align="center">
7
+ <a href="https://github.com/astariul/pintel/releases"><img src="https://img.shields.io/github/release/astariul/pintel.svg" alt="GitHub release" /></a>
8
+ <a href="https://github.com/astariul/pintel/actions/workflows/pytest.yaml"><img src="https://github.com/astariul/pintel/actions/workflows/pytest.yaml/badge.svg" alt="Test status" /></a>
9
+ <a href="https://github.com/astariul/pintel/actions/workflows/lint.yaml"><img src="https://github.com/astariul/pintel/actions/workflows/lint.yaml/badge.svg" alt="Lint status" /></a>
10
+ <img src=".github/badges/coverage.svg" alt="Coverage status" />
11
+ <a href="https://astariul.github.io/pintel"><img src="https://img.shields.io/website?down_message=failing&label=docs&up_color=green&up_message=passing&url=https%3A%2F%2Fastariul.github.io%2Fpintel" alt="Docs" /></a>
12
+ <a href="https://github.com/astariul/pintel/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="licence" /></a>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="#description">Description</a> •
17
+ <a href="#install">Install</a> •
18
+ <a href="#usage">Usage</a> •
19
+ <a href="#faq">FAQ</a> •
20
+ <a href="#contribute">Contribute</a>
21
+ <br>
22
+ <a href="https://astariul.github.io/pintel/" target="_blank">Documentation</a>
23
+ </p>
24
+
25
+
26
+ <h2 align="center">Description</h2>
27
+
28
+ **`pintel`** is a python package that helps you scale your ML workers (or any python code) across processes and machines, asynchronously.
29
+
30
+ `pintel` is :
31
+
32
+ * ⚡️ Highly performant
33
+ * 🔀 Asynchronous
34
+ * 🐥 Easy-to-use
35
+
36
+
37
+ <h2 align="center">Install</h2>
38
+
39
+ Install `pintel` by running :
40
+
41
+
42
+ ```
43
+ pip install pintel
44
+ ```
45
+
46
+
47
+ <h2 align="center">Usage</h2>
48
+
49
+ After defining your awesome model :
50
+
51
+ ```python
52
+ import time
53
+
54
+ class MyAwesomeModel:
55
+ def __init__(self, wait_time=0.25):
56
+ super().__init__()
57
+ self.w = wait_time
58
+
59
+ def __call__(self, x):
60
+ time.sleep(self.w)
61
+ return x**2
62
+ ```
63
+
64
+ You can simply start a few workers serving the model :
65
+
66
+ ```python
67
+ from pintel import Worker
68
+
69
+ for _ in range(4):
70
+ Worker(MyAwesomeModel).start()
71
+ ```
72
+
73
+ And send requests through the Hub :
74
+
75
+ ```python
76
+ from pintel import Hub
77
+
78
+ hub = Hub()
79
+
80
+ # In an async function
81
+ await hub.request(34)
82
+ ```
83
+
84
+ And that's it !
85
+
86
+ ---
87
+
88
+ Make sure to check the [documentation](https://astariul.github.io/pintel/usage/) for a more detailed explanation.
89
+
90
+ Or you can run some examples from the `examples/` folder.
91
+
92
+
93
+ <h2 align="center">FAQ</h2>
94
+
95
+ #### ❓ **How `pintel` works ?**
96
+
97
+ `pintel` simply run your model code in separate processes, and send requests to the right process to ensure requests are treated in parallel.
98
+
99
+ `pintel` uses a modified form of [the Paranoid Pirate Pattern from the zmq guide](https://zguide.zeromq.org/docs/chapter4/#Robust-Reliable-Queuing-Paranoid-Pirate-Pattern).
100
+
101
+ #### ❓ **Why the name "pintel" ?**
102
+
103
+ Pintel is one of the pirates of Captain Barbossa's crew on the Black Pearl.
104
+ Since we are using the Paranoid Pirate Pattern, we needed a pirate name !
105
+
106
+ <h2 align="center">Contribute</h2>
107
+
108
+ To contribute, install the package locally, create your own branch, add your code (and tests, and documentation), and open a PR !
109
+
110
+ ### Pre-commit hooks
111
+
112
+ Pre-commit hooks are set to check the code added whenever you commit something.
113
+
114
+ If you never ran the hooks before, install it with :
115
+
116
+ ```bash
117
+ pre-commit install
118
+ ```
119
+
120
+ ---
121
+
122
+ Then you can just try to commit your code. If you code does not meet the quality required by linters, it will not be committed. You can just fix your code and try to commit again !
123
+
124
+ ---
125
+
126
+ You can manually run the pre-commit hooks with :
127
+
128
+ ```bash
129
+ pre-commit run --all-files
130
+ ```
131
+
132
+ ### Tests
133
+
134
+ When you contribute, you need to make sure all the unit-tests pass. You should also add tests if necessary !
135
+
136
+ You can run the tests with :
137
+
138
+ ```bash
139
+ pytest
140
+ ```
141
+
142
+ ---
143
+
144
+ Pre-commit hooks will not run the tests, but it will automatically update the coverage badge !
145
+
146
+ ### Documentation
147
+
148
+ The documentation should be kept up-to-date. You can visualize the documentation locally by running :
149
+
150
+ ```bash
151
+ mkdocs serve
152
+ ```
@@ -0,0 +1,7 @@
1
+ from loguru import logger
2
+
3
+ from .hub import Hub, UserCodeException
4
+ from .worker import Worker
5
+
6
+
7
+ logger.disable("pintel")