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 eventlet # For eventlet workers
$ pip install gevent # For gevent workers
$ pip install greenlet # Required for both
$ pip install eventlet # For eventlet workers
$ pip install gunicorn[eventlet] # Or, using extra
$ pip install gevent # For gevent workers
$ pip install gunicorn[gevent] # Or, using extra
.. 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
managers. On Ubuntu the package name for ``apt-get`` is
``python-dev``.

View File

@ -114,15 +114,20 @@ The type of workers to use.
The default class (``sync``) should handle most "normal" types of
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:
* ``sync``
* ``eventlet`` - Requires eventlet >= 0.9.7
* ``gevent`` - Requires gevent >= 0.13
* ``tornado`` - Requires tornado >= 0.2
* ``eventlet`` - Requires eventlet >= 0.9.7 (or install it via
``pip install gunicorn[eventlet]``)
* ``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
(or install it via ``pip install gunicorn[gthread]``)
* ``gaiohttp`` - Deprecated.
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
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:
* ``sync``
* ``eventlet`` - Requires eventlet >= 0.9.7
* ``gevent`` - Requires gevent >= 0.13
* ``tornado`` - Requires tornado >= 0.2
* ``eventlet`` - Requires eventlet >= 0.9.7 (or install it via
``pip install gunicorn[eventlet]``)
* ``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
(or install it via ``pip install gunicorn[gthread]``)
* ``gaiohttp`` - Deprecated.
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)
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(
name='gunicorn',
version=__version__,
@ -98,5 +108,6 @@ setup(
[paste.server_runner]
main=gunicorn.app.pasterapp:paste_server
"""
""",
extras_require=extra_require,
)