Patch Python function objects with a gevent-backed go() helper.
Project description
goesque
goesque patches Python function objects with a go() method backed by
gevent.spawn, so regular functions can be launched in a Go-like style.
Quick example
import goesque
goesque.patch_all()
def side_effect():
print("Side effect!")
side_effect.go()
# out: Side effect!
How it works
goesque.patch_all() does two things:
- Calls
gevent.monkey.patch_all()so standard library I/O becomes cooperative. - Patches
types.FunctionTypeso every Python function gains ago()method.
The patching is process-wide for the current interpreter. After patching, any
new or existing Python function object can call .go(...).
How go() is implemented
The go() method is installed at runtime and is equivalent to:
def go(self, *args, **kwargs):
import gevent
greenlet = gevent.spawn(self, *args, **kwargs)
gevent.sleep(0) # yield once so spawned work can start promptly
return greenlet
Notes:
go()returns a geventGreenlet.- Use
join()orget()when you need to wait for completion. - This is cooperative concurrency (greenlets), not native thread-based parallelism.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file goesque-0.1.0.tar.gz.
File metadata
- Download URL: goesque-0.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6364443b199cc3beabe9953170a355b5d6ff68cd8fcac2df97b6ff6a6d18a5e6
|
|
| MD5 |
19e780c1f664758b7ab24106b9f48ba9
|
|
| BLAKE2b-256 |
5c6191b6e268209ed9d9558e14a797f897a469ccad12902e45a2522e6b284817
|
Provenance
The following attestation bundles were made for goesque-0.1.0.tar.gz:
Publisher:
publish.yml on mliezun/goesque
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goesque-0.1.0.tar.gz -
Subject digest:
6364443b199cc3beabe9953170a355b5d6ff68cd8fcac2df97b6ff6a6d18a5e6 - Sigstore transparency entry: 1450630427
- Sigstore integration time:
-
Permalink:
mliezun/goesque@48a33023fc5afcedbfa309f5a60709748d413ea5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mliezun
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@48a33023fc5afcedbfa309f5a60709748d413ea5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file goesque-0.1.0-py3-none-any.whl.
File metadata
- Download URL: goesque-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b94954cc8e2c6379063c5a645740fc731002ecd78812f953f064da3e728c0d85
|
|
| MD5 |
7878782c96e67c65a10a8130a5077767
|
|
| BLAKE2b-256 |
2ac2d4f65476ac3afe9a16e97dff6b51d5cb434a6613a8be35a479329d73677c
|
Provenance
The following attestation bundles were made for goesque-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on mliezun/goesque
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goesque-0.1.0-py3-none-any.whl -
Subject digest:
b94954cc8e2c6379063c5a645740fc731002ecd78812f953f064da3e728c0d85 - Sigstore transparency entry: 1450630994
- Sigstore integration time:
-
Permalink:
mliezun/goesque@48a33023fc5afcedbfa309f5a60709748d413ea5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mliezun
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@48a33023fc5afcedbfa309f5a60709748d413ea5 -
Trigger Event:
release
-
Statement type: