Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
FEATURE: Allow API-based control of gevent-wide behaviors without env vars #1090
Quite a few features of Gevent rely on setting env vars, such as DNS resolver, thread pool, etc.
Ideally, gevent would have two methods of configuring global behavioral settings that compliment each other and allow configuring from API.
Possible example (not advocating any particular module/naming convention):
Another advantage is that settings being aggregated that way in one place are easier to document. Right now it's almost impossible to be sure you found documentation on all of the configurable behaviors of gevent - have to grep repo code by hand.
added a commit
Feb 12, 2018
referenced this issue
Feb 12, 2018
I admit I was a little reluctant about this idea: I didn't like the fact that it put all these non-local concerns in one place (e.g., the only code that cares about
PR #1096 lets you do this:
>>> from gevent import config >>> config.loop = 'libuv' >>> config.fileobject = 'thread' >>> import gevent.core, gevent.fileobject >>> gevent.core.loop <class 'gevent.libuv.loop.loop'> >>> gevent.filegevent.fileobject.FileObject <class 'gevent._fileobjectcommon.FileObjectThread'>