Debian Codegraph @

PKG-INFO

raw
1 Metadata-Version: 2.1
2 Name: crochet
3 Version: 2.1.1
4 Summary: Use Twisted anywhere!
5 Home-page: https://github.com/itamarst/crochet
6 Maintainer: Itamar Turner-Trauring
7 Maintainer-email: [email protected]
8 License: MIT
9 Keywords: twisted threading
10 Classifier: Intended Audience :: Developers
11 Classifier: License :: OSI Approved :: MIT License
12 Classifier: Operating System :: OS Independent
13 Classifier: Programming Language :: Python
14 Classifier: Programming Language :: Python :: 3.8
15 Classifier: Programming Language :: Python :: 3.9
16 Classifier: Programming Language :: Python :: 3.10
17 Classifier: Programming Language :: Python :: 3.11
18 Classifier: Programming Language :: Python :: Implementation :: CPython
19 Classifier: Programming Language :: Python :: Implementation :: PyPy
20 Requires-Python: >=3.8.0
21 License-File: LICENSE
22
23 Crochet: Use Twisted anywhere!
24 ==============================
25
26 Crochet is an MIT-licensed library that makes it easier to use Twisted from
27 regular blocking code. Some use cases include:
28
29 * Easily use Twisted from a blocking framework like Django or Flask.
30 * Write a library that provides a blocking API, but uses Twisted for its
31 implementation.
32 * Port blocking code to Twisted more easily, by keeping a backwards
33 compatibility layer.
34 * Allow normal Twisted programs that use threads to interact with Twisted more
35 cleanly from their threaded parts. For example, this can be useful when using
36 Twisted as a `WSGI container`_.
37
38 .. _WSGI container: https://twistedmatrix.com/documents/current/web/howto/web-in-60/wsgi.html
39
40 Crochet is maintained by Itamar Turner-Trauring.
41
42 **Note:** Crochet development is pretty slow these days because mostly it **Just Works**. PyPI shows about 30,000 downloads a month, so existing users seem happy: https://pypistats.org/packages/crochet
43
44 You can install Crochet by running::
45
46 $ pip install crochet
47
48 Downloads are available on `PyPI`_.
49
50 Documentation can be found on `Read The Docs`_.
51
52 Bugs and feature requests should be filed at the project `Github page`_.
53
54 .. _Read the Docs: https://crochet.readthedocs.org/
55 .. _Github page: https://github.com/itamarst/crochet/
56 .. _PyPI: https://pypi.python.org/pypi/crochet
57
58
59 API and features
60 ================
61
62 Crochet supports Python 3.8, 3.9, 3.10, and 3.11 as well as PyPy3.
63
64 Crochet provides the following basic APIs:
65
66 * Allow blocking code to call into Twisted and block until results are available
67 or a timeout is hit, using the ``crochet.wait_for`` decorator.
68 * A lower-level API (``crochet.run_in_reactor``) allows blocking code to run
69 code "in the background" in the Twisted thread, with the ability to repeatedly
70 check if it's done.
71
72 Crochet will do the following on your behalf in order to enable these APIs:
73
74 * Transparently start Twisted's reactor in a thread it manages.
75 * Shut down the reactor automatically when the process' main thread finishes.
76 * Hook up Twisted's log system to the Python standard library ``logging``
77 framework. Unlike Twisted's built-in ``logging`` bridge, this includes
78 support for blocking `Handler` instances.
79
80 What's New
81 ==========
82
83 2.1.0
84 ^^^^^
85
86 * Various internal modernizations and maintenance.
87 * Dropped Python 3.6 and 3.7 support.
88
89 2.0.0
90 ^^^^^
91
92 New features:
93
94 * It's possible to decorate ``async/await`` Twisted functions with ``@wait_for`` and ``@run_in_reactor``, thanks to Árni Már Jónsson.
95 * Added type hints, thanks to Merlin Davis.
96 * Added formal support for Python 3.9.
97
98
99 Removed features:
100
101 * Dropped the deprecated APIs ``@wait_for_reactor``, ``@in_reactor``, ``DeferredResult``, the ``wrapped_function`` attribute, and unlimited timeouts on ``EventualResult.wait()``.
102 * Dropped support for Python 2.7 and 3.5.
103
104 1.12.0
105 ^^^^^^
106
107 Bug fixes:
108
109 * Fix a timeout overflow bug in 32-bit machines.
110
111
112 1.11.0
113 ^^^^^^
114
115 New features:
116
117 * Added support for Python 3.8 and PyPy 3.
118
119 Backwards incompatibility:
120
121 * Dropped support for Python 3.4, since latest Twisted doesn't support it.
122
123 1.10.0
124 ^^^^^^
125
126 New features:
127
128 * Added support for Python 3.7. Thanks to Jeremy Cline for the patch.
129
130 1.9.0
131 ^^^^^
132
133 New features:
134
135 * The underlying callable wrapped ``@run_in_reactor`` and ``@wait_for`` is now available via the more standard ``__wrapped__`` attribute.
136
137 Backwards incompatibility (in tests):
138
139 * This was actually introduced in 1.8.0: ``wrapped_function`` may not always be available on decorated callables.
140 You should use ``__wrapped__`` instead.
141
142 Bug fixes:
143
144 * Fixed regression in 1.8.0 where bound method couldn't be wrapped.
145 Thanks to 2mf for the bug report.
146
147 1.8.0
148 ^^^^^
149
150 New features:
151
152 * Signatures on decorated functions now match the original functions.
153 Thanks to Mikhail Terekhov for the original patch.
154 * Documentation improvements, including an API reference.
155
156 Bug fixes:
157
158 * Switched to EPoll reactor for logging thread.
159 Anecdotal evidence suggests this fixes some issues on AWS Lambda, but it's not clear why.
160 Thanks to Rolando Espinoza for the patch.
161 * It's now possible to call ``@run_in_reactor`` and ``@wait_for`` above a ``@classmethod``.
162 Thanks to vak for the bug report.
163
164 1.7.0
165 ^^^^^
166
167 Bug fixes:
168
169 * If the Python ``logging.Handler`` throws an exception Crochet no longer goes into a death spiral.
170 Thanks to Michael Schlenker for the bug report.
171
172 Removed features:
173
174 * Versions of Twisted < 16.0 are no longer supported (i.e. no longer tested in CI.)
175
176 1.6.0
177 ^^^^^
178
179 New features:
180
181 * Added support for Python 3.6.
182
183 1.5.0
184 ^^^^^
185
186 New features:
187
188 * Added support for Python 3.5.
189
190 Removed features:
191
192 * Python 2.6, Python 3.3, and versions of Twisted < 15.0 are no longer supported.
193
194 1.4.0
195 ^^^^^
196
197 New features:
198
199 * Added support for Python 3.4.
200
201 Documentation:
202
203 * Added a section on known issues and workarounds.
204
205 Bug fixes:
206
207 * Main thread detection (used to determine when Crochet should shutdown) is now less fragile.
208 This means Crochet now supports more environments, e.g. uWSGI.
209 Thanks to Ben Picolo for the patch.
210
211 1.3.0
212 ^^^^^
213
214 Bug fixes:
215
216 * It is now possible to call ``EventualResult.wait()`` (or functions
217 wrapped in ``wait_for``) at import time if another thread holds the
218 import lock. Thanks to Ken Struys for the patch.
219
220 1.2.0
221 ^^^^^
222 New features:
223
224 * ``crochet.wait_for`` implements the timeout/cancellation pattern documented
225 in previous versions of Crochet. ``crochet.wait_for_reactor`` and
226 ``EventualResult.wait(timeout=None)`` are now deprecated, since lacking
227 timeouts they could potentially block forever.
228 * Functions wrapped with ``wait_for`` and ``run_in_reactor`` can now be accessed
229 via the ``wrapped_function`` attribute, to ease unit testing of the underlying
230 Twisted code.
231
232 API changes:
233
234 * It is no longer possible to call ``EventualResult.wait()`` (or functions
235 wrapped with ``wait_for``) at import time, since this can lead to deadlocks
236 or prevent other threads from importing. Thanks to Tom Prince for the bug
237 report.
238
239 Bug fixes:
240
241 * ``warnings`` are no longer erroneously turned into Twisted log messages.
242 * The reactor is now only imported when ``crochet.setup()`` or
243 ``crochet.no_setup()`` are called, allowing daemonization if only ``crochet``
244 is imported (http://tm.tl/7105). Thanks to Daniel Nephin for the bug report.
245
246 Documentation:
247
248 * Improved motivation, added contact info and news to the documentation.
249 * Better example of using Crochet from a normal Twisted application.
250
251 1.1.0
252 ^^^^^
253 Bug fixes:
254
255 * ``EventualResult.wait()`` can now be used safely from multiple threads,
256 thanks to Gavin Panella for reporting the bug.
257 * Fixed reentrancy deadlock in the logging code caused by
258 http://bugs.python.org/issue14976, thanks to Rod Morehead for reporting the
259 bug.
260 * Crochet now installs on Python 3.3 again, thanks to Ben Cordero.
261 * Crochet should now work on Windows, thanks to Konstantinos Koukopoulos.
262 * Crochet tests can now run without adding its absolute path to PYTHONPATH or
263 installing it first.
264
265 Documentation:
266
267 * ``EventualResult.original_failure`` is now documented.
268
269 1.0.0
270 ^^^^^
271 Documentation:
272
273 * Added section on use cases and alternatives. Thanks to Tobias Oberstein for
274 the suggestion.
275
276 Bug fixes:
277
278 * Twisted does not have to be pre-installed to run ``setup.py``, thanks to
279 Paul Weaver for bug report and Chris Scutcher for patch.
280 * Importing Crochet does not have side-effects (installing reactor event)
281 any more.
282 * Blocking calls are interrupted earlier in the shutdown process, to reduce
283 scope for deadlocks. Thanks to rmorehead for bug report.
284
285 0.9.0
286 ^^^^^
287 New features:
288
289 * Expanded and much improved documentation, including a new section with
290 design suggestions.
291 * New decorator ``@wait_for_reactor`` added, a simpler alternative to
292 ``@run_in_reactor``.
293 * Refactored ``@run_in_reactor``, making it a bit more responsive.
294 * Blocking operations which would otherwise never finish due to reactor having
295 stopped (``EventualResult.wait()`` or ``@wait_for_reactor`` decorated call)
296 will be interrupted with a ``ReactorStopped`` exception. Thanks to rmorehead
297 for the bug report.
298
299 Bug fixes:
300
301 * ``@run_in_reactor`` decorated functions (or rather, their generated wrapper)
302 are interrupted by Ctrl-C.
303 * On POSIX platforms, a workaround is installed to ensure processes started by
304 `reactor.spawnProcess` have their exit noticed. See `Twisted ticket 6378`_
305 for more details about the underlying issue.
306
307 .. _Twisted ticket 6378: http://tm.tl/6738
308
309 0.8.1
310 ^^^^^
311 * ``EventualResult.wait()`` now raises error if called in the reactor thread,
312 thanks to David Buchmann.
313 * Unittests are now included in the release tarball.
314 * Allow Ctrl-C to interrupt ``EventualResult.wait(timeout=None)``.
315
316 0.7.0
317 ^^^^^
318 * Improved documentation.
319
320 0.6.0
321 ^^^^^
322 * Renamed ``DeferredResult`` to ``EventualResult``, to reduce confusion with
323 Twisted's ``Deferred`` class. The old name still works, but is deprecated.
324 * Deprecated ``@in_reactor``, replaced with ``@run_in_reactor`` which doesn't
325 change the arguments to the wrapped function. The deprecated API still works,
326 however.
327 * Unhandled exceptions in ``EventualResult`` objects are logged.
328 * Added more examples.
329 * ``setup.py sdist`` should work now.
330
331 0.5.0
332 ^^^^^
333 * Initial release.