Commit e2717bf9 authored by Denis Bilenko's avatar Denis Bilenko

doc: add what's new in 1.0

parent c2049f8b
......@@ -99,7 +99,7 @@ resolver_ares:
- improve getaddrinfo: For string ports (e.g. "http") resolver_ares/getaddrinfo previously only checked either getservbyname(port, "tcp") or getservbyname(port, "udp"), but never both. It now checks both of them.
- gevent.ares.channel now accepts strings as arguments
- upgraded c-ares to cares-1_9_1-12-g805c736
- it is not possible to configure resolver_ares directly with environ, like GEVENTARES_SERVERS
- it is now possible to configure resolver_ares directly with environ, like GEVENTARES_SERVERS
os:
......@@ -198,7 +198,7 @@ Misc:
- Check that the argument of link() is callable. Raise TypeError when it's not.
- Fixed TypeError in baseserver when parsing an address.
- Pool: made add() and discard() usable by external users. Thanks to Danil Eremeev.
- When specifying a class to import, it is not possible to use format path/package.module.name
- When specifying a class to import, it is now possible to use format path/package.module.name
- pywsgi: Made sure format_request() does not fail if 'status' attribute is not set yet
- pywsgi: Added REMOTE_PORT variable to the environment.
......@@ -370,12 +370,6 @@ Fixed a bug in gevent.queue.Channel class. (Thanks to Alexey Borzenkov)
Release 1.0a1 (Aug 2, 2011)
---------------------------
TODO:
- gevent.http?
- gevent.httplib?
- gevent.wsgi? (Currently gevent/wsgi.py imports classes from gevent/pywsgi.py)
Backward-incompatible changes:
- Dropped support for Python 2.4.
......@@ -984,7 +978,7 @@ Release 0.9.2 (Jul 20, 2009)
and :meth:`__exit__ <event.__exit__>` now, so it can be used as a context
manager. :class:`event`'s :attr:`callback <event.callback>` signature has changed from ``(event, fd, evtype)`` to ``(event, evtype)``.
* Fixed :class:`Hub`'s mainloop to never return successfully as this will screw up main greenlet's ``switch()`` call.
Instead of returning it raises :class:`DispatchExit`.
Instead of returning it raises ``DispatchExit``.
* Added :func:`reinit` function - wrapper for libevent's ``event_reinit``.
This function is a must have at least for daemons, as it fixes ``epoll`` and some others eventloops to work after ``fork``.
* Trying to use gevent in another thread will now raise an exception immediately, since it's not implemented.
......
......@@ -5,6 +5,7 @@ Table Of Contents
intro
reference
whatsnew_1_0
changelog
* :ref:`genindex`
......
......@@ -3,6 +3,22 @@
.. automodule:: gevent.core
This module is a wrapper around libev__ and follower the libev API pretty closely. Note,
that gevent creates an event loop transparently for the user and runs it in a dedicated
greenlet (called hub), so using this module is not necessary. In fact, if you do use it,
chances are that your program is not compatible across different gevent version (gevent.core in
0.x has a completely different interface and 2.x will probably have yet another interface).
On Windows, this wrapper will accept Windows handles rather than stdio file descriptors which libev requires. This is to simplify
interaction with the rest of the Python, since it requires Windows handles.
The current event loop can be obtained with ``gevent.get_hub().loop``.
__ http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod
events
------
......
......@@ -7,8 +7,6 @@
:members:
:undoc-members:
.. autoexception:: DispatchExit
.. autofunction:: get_hub
.. autoclass:: Waiter
......@@ -97,8 +97,6 @@ Useful general functions
.. autofunction:: fork
.. autofunction:: shutdown
.. autofunction:: reinit
......@@ -111,3 +109,10 @@ Timeouts
.. autofunction:: with_timeout
Waiting
-------
.. autofunction:: wait
.. autofunction:: iwait
......@@ -10,7 +10,10 @@ Features include:
* API that re-uses concepts from the Python standard library (e.g. :class:`Event`, :class:`Queue`).
* Cooperative :mod:`socket` and :mod:`ssl` modules.
* Ability to use standard library and 3rd party modules written for standard blocking sockets (:mod:`gevent.monkey`).
* DNS queries performed through c-ares.
* DNS queries performed through threadpool (default) or through c-ares (enabled via GEVENT_RESOLVER=ares env var).
* TCP/UDP/HTTP servers
* Subprocess support (through :mod:`gevent.subprocess`)
* Thread pools
Installation
......@@ -18,7 +21,7 @@ Installation
gevent runs on Python 2.5 and newer and requires
* greenlet__ which can be installed with ``easy_install greenlet``.
* greenlet__ which can be installed with ``pip install greenlet``.
For ssl to work on Python older than 2.6, ssl_ package is required.
......@@ -87,6 +90,8 @@ the select backend, ``LIBEV_FLAGS=2`` for the poll backend,
kqueue backend. Please read the `libev documentation`_ for more
information.
.. _`libev documentation`: http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#FUNCTIONS_CONTROLLING_EVENT_LOOPS
The Libev API is available under :mod:`gevent.core` module. Note, that
the callbacks supplied to the libev API are run in the :class:`Hub`
greenlet and thus cannot use the synchronous gevent API. It is possible to
......@@ -206,7 +211,13 @@ Gevent comes with TCP/SSL/HTTP/WSGI servers. See :doc:`servers`.
.. _`example: dns_mass_resolve.py`: http://bitbucket.org/denis/gevent/src/tip/examples/dns_mass_resolve.py#cl-17
.. _`libev documentation`: http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#FUNCTIONS_CONTROLLING_EVENT_LOOPS
External resources
------------------
`Gevent for working Python developer`__ is a comprehensive tutorial.
__ http://sdiehl.github.io/gevent-tutorial/
.. rubric:: Footnotes
......
......@@ -5,7 +5,4 @@ Networking interfaces
gevent.socket
gevent.ssl
gevent.sslold
gevent.dns
gevent.select
......@@ -5,5 +5,5 @@ Synchronization primitives
gevent.event
gevent.queue
gevent.coros
gevent.lock
What's new gevent 1.0
---------------------
The detailed information is available in changelog. Below is the summary of all changes since 0.13.8.
Gevent 1.0 supports Python 2.5 - 2.7. The version of greenlet required is 0.3.2. The source distribution
now includes the dependencies (libev and c-ares) and has not dependencies other than greenlet.
New core
~~~~~~~~
New event loop is used libev instead of libevent (see http://blog.gevent.org/2011/04/28/libev-and-libevent/ for motivation).
The new :mod:`gevent.core` has been rewritten to wrap libev's API. (On Windows, the :mod:`gevent.core` accepts Windows handles
rather than stdio file descriptors.).
The signal handlers set with the standard signal module are no longer blocked by the event loop.
The event loops are now pluggable. The GEVENT_LOOP enviroment variable can specify the alternative class to use (the default is ``gevent.core.loop``).
The error handling is now done by Hub.handle_error().
The system errors that usually kill the process (SystemError, SystemExit, KeyboardInterrupt) are now re-raised in the main greenlet.
Thus ``sys.exit()`` when run inside a greenlet is no longer trapped and kills the process as expected.
New dns resolver
~~~~~~~~~~~~~~~~
Two new DNS resolvers: threadpool-based one (enabled by default) and c-ares based one. That threadpool-based resolver was added mostly for Windows and Mac OS X platforms where c-ares might behave differently w.r.t system configuration. On Linux, however, the c-ares based resolver is probably a better choice. To enable c-ares resolver set GEVENT_RESOLVER=ares environment variable.
This fixes some major issues with DNS on 0.13.x, namely:
- Issue #2: DNS resolver no longer breaks after ``fork()``. You still need to call :func:`gevent.fork` (``os.fork`` is monkey patched with it if ``monkey.patch_all()`` was called).
- DNS resolver no longer ignores ``/etc/resolv.conf`` and ``/etc/hosts``.
The following functions were added to socket module:
- gethostbyname_ex
- getnameinfo
- gethostbyaddr
- getfqdn
It is possible to implement your own DNS resolver and make gevent use it. The GEVENT_RESOLVER variable can point to alternative implementation using the format: ``package.module.class``. The default is ``gevent.resolver_thread.Resolver``. The alternative "ares" resolver is an alias for ``gevent.resolver_ares.Resolver``.
New API
~~~~~~~
- :func:`gevent.wait` and :func:`gevent.iwait`
- UDP server: gevent.server.DatagramServer
- Subprocess support
New :mod:`gevent.subprocess` implements the interface of the standard subprocess module in a cooperative way.
It is possible to monkey patch the standard subprocess module with ``patch_all(subprocess=True)`` (not done by default).
- Thread pool
**Warning:** this feature is experimental and should be used with care.
The :mod:`gevent.threadpool` module provides the usual pool methods (apply, map, imap, etc) but runs passed functions
in a real OS thread.
There's a default threadpool, available as ``gevent.get_hub().threadpool``.
Breaking changes
~~~~~~~~~~~~~~~~
Removed features
^^^^^^^^^^^^^^^^
- gevent.dns module (wrapper around libevent-dns)
- gevent.http module (wrapper around libevent-http)
- ``util.lazy_property`` property.
- deprecated gevent.sslold module
- deprecated gevent.rawgreenlet module
- deprecated name ``GreenletSet`` which used to be alias for :class:`Group`.
- link to greenlet feature of Greenlet
- undocumented bind_and_listen and tcp_listener
Renamed gevent.coros to gevent.lock. The gevent.coros is still available but deprecated.
API changes
^^^^^^^^^^^
In all servers, method "kill" was renamed to "close". The old name is available as deprecated alias.
- ``Queue(0)`` is now equivalent to an unbound queue and raises :exc:`DeprecationError`. Use :class:`gevent.queue.Channel` if you need a channel.
The :class:`Greenlet` objects:
- Added ``__nonzero__`` implementation that returns `True` after greenlet was started until it's dead. This overrides
greenlet's __nonzero__ which returned `False` after `start()` until it was first switched to.
Bugfixes
~~~~~~~~
- Issue #302: "python -m gevent.monkey" now sets __file__ properly.
- Issue #143: greenlet links are now executed in the order they were added
- Fixed monkey.patch_thread() to patch threading._DummyThread to avoid leak in threading._active.
- gevent.thread: allocate_lock is now an alias for LockType/Semaphore. That way it does not fail when being used as class member.
- It is now possible to add raw greenlets to the pool.
- The :meth:`map` and :meth:`imap` methods now start yielding the results as soon as possible.
- The :meth:`imap_unordered` no longer swallows an exception raised while iterating its argument.
- `gevent.sleep(<negative value>)` no longer raises an exception, instead it does `sleep(0)`.
- The :class:`WSGIServer` now sets `max_accept` to 1 if `wsgi.multiprocessing` is set to `True`.
- Added :func:`monkey.patch_module` function that monkey patches module using `__implements__` list provided by gevent module.
All of gevent modules that replace stdlib module now have `__implements__` attribute.
pywsgi:
- Fix logging when bound on unix socket (#295).
- readout request data to prevent ECONNRESET
- Fix #79: Properly handle HTTP versions.
- Fix #86: bytearray is now supported.
- Fix #92: raise IOError on truncated POST requests.
- Fix #93: do not sent multiple "100 continue" responses
- Fix #116: Multiline HTTP headers are now handled properly.
- Fix #216: propagate errors raised by Pool.map/imap
- Fix #303: 'requestline' AttributeError in pywsgi.
- Raise an AssertionError if non-zero content-length is passed to start_response(204/304) or if non-empty body is attempted to be written for 304/204 response
- Made sure format_request() does not fail if 'status' attribute is not set yet
- Added REMOTE_PORT variable to the environment.
- Removed unused deprecated 'wfile' property from WSGIHandler
......@@ -10,7 +10,7 @@ __all__ = ['Semaphore', 'DummySemaphore', 'BoundedSemaphore', 'RLock']
class DummySemaphore(object):
# XXX what is this used for?
"""A Semaphore initialized with "infinite" initial value. Neither of its methods ever block."""
"""A Semaphore initialized with "infinite" initial value. None of its methods ever block."""
def __str__(self):
return '<%s>' % self.__class__.__name__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment