Skip to content

Commit

Permalink
Add extras_require for various worker types (#1718)
Browse files Browse the repository at this point in the history
Fixes #1717
  • Loading branch information
browniebroke authored and berkerpeksag committed Mar 8, 2018
1 parent 9c8695b commit d1f5268
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
11 changes: 7 additions & 4 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down
13 changes: 9 additions & 4 deletions docs/source/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions gunicorn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ def run_tests(self):
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__,
Expand All @@ -98,5 +108,6 @@ def run_tests(self):
[paste.server_runner]
main=gunicorn.app.pasterapp:paste_server
"""
""",
extras_require=extra_require,
)

0 comments on commit d1f5268

Please sign in to comment.