Add extras_require for various worker types (#1718)

Fixes #1717
This commit is contained in:
Bruno Alla 2018-03-08 14:19:44 +00:00 committed by Berker Peksag
parent 9c8695b04f
commit d1f5268b15
4 changed files with 37 additions and 13 deletions

View File

@ -33,12 +33,15 @@ want to consider one of the alternate worker types.
:: ::
$ pip install greenlet # Required for both $ pip install greenlet # Required for both
$ pip install eventlet # For eventlet workers $ pip install eventlet # For eventlet workers
$ pip install gevent # For gevent workers $ pip install gunicorn[eventlet] # Or, using extra
$ pip install gevent # For gevent workers
$ pip install gunicorn[gevent] # Or, using extra
.. note:: .. note::
If installing ``greenlet`` fails you probably need to install Both require ``greenlet``, which should get installed automatically,
If its installation fails, you probably need to install
the Python headers. These headers are available in most package the Python headers. These headers are available in most package
managers. On Ubuntu the package name for ``apt-get`` is managers. On Ubuntu the package name for ``apt-get`` is
``python-dev``. ``python-dev``.

View File

@ -114,15 +114,20 @@ The type of workers to use.
The default class (``sync``) should handle most "normal" types of The default class (``sync``) should handle most "normal" types of
workloads. You'll want to read :doc:`design` for information on when workloads. You'll want to read :doc:`design` for information on when
you might want to choose one of the other worker classes. you might want to choose one of the other worker classes. Required
libraries may be installed using setuptools' ``extra_require`` feature.
A string referring to one of the following bundled classes: A string referring to one of the following bundled classes:
* ``sync`` * ``sync``
* ``eventlet`` - Requires eventlet >= 0.9.7 * ``eventlet`` - Requires eventlet >= 0.9.7 (or install it via
* ``gevent`` - Requires gevent >= 0.13 ``pip install gunicorn[eventlet]``)
* ``tornado`` - Requires tornado >= 0.2 * ``gevent`` - Requires gevent >= 0.13 (or install it via
``pip install gunicorn[gevent]``)
* ``tornado`` - Requires tornado >= 0.2 (or install it via
``pip install gunicorn[tornado]``)
* ``gthread`` - Python 2 requires the futures package to be installed * ``gthread`` - Python 2 requires the futures package to be installed
(or install it via ``pip install gunicorn[gthread]``)
* ``gaiohttp`` - Deprecated. * ``gaiohttp`` - Deprecated.
Optionally, you can provide your own worker by giving Gunicorn a Optionally, you can provide your own worker by giving Gunicorn a

View File

@ -605,15 +605,20 @@ class WorkerClass(Setting):
The default class (``sync``) should handle most "normal" types of The default class (``sync``) should handle most "normal" types of
workloads. You'll want to read :doc:`design` for information on when workloads. You'll want to read :doc:`design` for information on when
you might want to choose one of the other worker classes. you might want to choose one of the other worker classes. Required
libraries may be installed using setuptools' ``extra_require`` feature.
A string referring to one of the following bundled classes: A string referring to one of the following bundled classes:
* ``sync`` * ``sync``
* ``eventlet`` - Requires eventlet >= 0.9.7 * ``eventlet`` - Requires eventlet >= 0.9.7 (or install it via
* ``gevent`` - Requires gevent >= 0.13 ``pip install gunicorn[eventlet]``)
* ``tornado`` - Requires tornado >= 0.2 * ``gevent`` - Requires gevent >= 0.13 (or install it via
``pip install gunicorn[gevent]``)
* ``tornado`` - Requires tornado >= 0.2 (or install it via
``pip install gunicorn[tornado]``)
* ``gthread`` - Python 2 requires the futures package to be installed * ``gthread`` - Python 2 requires the futures package to be installed
(or install it via ``pip install gunicorn[gthread]``)
* ``gaiohttp`` - Deprecated. * ``gaiohttp`` - Deprecated.
Optionally, you can provide your own worker by giving Gunicorn a Optionally, you can provide your own worker by giving Gunicorn a

View File

@ -72,6 +72,16 @@ class PyTestCommand(TestCommand):
errno = pytest.main(self.test_args) errno = pytest.main(self.test_args)
sys.exit(errno) sys.exit(errno)
extra_require = {
'gevent': ['gevent>=0.13'],
'eventlet': ['eventlet>=0.9.7'],
'tornado': ['tornado>=0.2'],
'gthread': [],
}
if sys.version_info[0] < 3:
extra_require['gthread'] = ['futures']
setup( setup(
name='gunicorn', name='gunicorn',
version=__version__, version=__version__,
@ -98,5 +108,6 @@ setup(
[paste.server_runner] [paste.server_runner]
main=gunicorn.app.pasterapp:paste_server main=gunicorn.app.pasterapp:paste_server
""" """,
extras_require=extra_require,
) )