Mode

Latest version: v4.4.0

Safety actively analyzes 629599 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 14 of 15

1.6.0

=====
:release-date: 2018-02-05 11:10 P.M PST
:release-by: Ask Solem

- Fixed bug where ``Service.task`` background tasks were not started
in subclasses.

- Service: Now has two exit stacks: ``.exit_stack`` & ``.async_exit_stack``.

This is a backward incompatible change, but probably nobody was accessing
``.exit_stack`` directly.

Use ``await Service.enter_context(ctx)`` with both regular and
asynchronous context managers::

class X(Service):

async def on_start(self) -> None:
works with both context manager types.
await self.enter_context(async_context)
await self.enter_context(context)

- Adds :func:`~mode.utils.contextlib.asynccontextmanager`` decorator
from CPython 3.7b1.

This decorator works exactly the same as
:func:`contextlib.contextmanager`, but for :keyword:`async with`.

Import it from :mod:`mode.utils.contexts`::

from mode.utils.contexts import asynccontextmanager

asynccontextmanager
async def connection_or_default(conn: Connection = None) -> Connection:
if connection is None:
async with connection_pool.acquire():
yield
else:
yield connection

async def main():
async with connection_or_default() as connection:
...

- Adds :class:`~mode.utils.contexts.AsyncExitStack` from CPython 3.7b1

This works like :class:`contextlib.ExitStack`, but for asynchronous
context managers used with :keyword:`async with`.

- Logging: Worker debug log messages are now colored blue when colors are
enabled.


.. _version-1.5.0:

1.5.0

=====
:release-date: 2018-01-04 03:43 P.M PST
:release-by: Ask Solem

- Service: Adds new ``await self.add_context(context)``

This adds a new context manager to be entered when the service starts,
and exited once the service exits.

The context manager can be either a :class:`typing.AsyncContextManager`
(:keyword:`async with`) or a
regular :class:`typing.ContextManager` (:keyword:`with`).

- Service: Added ``await self.add_runtime_dependency()`` which unlike
``add_dependency`` starts the dependent service if the self is already
started.

- Worker: Now supports a new ``console_port`` argument to specify a port
for the :pypi:`aiomonitor` console, different than the default (50101).

.. note::

The aiomonitor console is only started when ``Worker(debug=True, ...)``
is set.

.. _version-1.4.0:

1.4.0

=====
:release-date: 2017-12-21 09:50 A.M PST
:release-by: Ask Solem

- Worker: Add support for parameterized logging handlers.

Contributed by Prithvi Narasimhan.

.. _version-1.3.0:

1.3.0

=====
:release-date: 2017-12-04 01:17 P.M PST
:release-by: Ask Solem

- Now supports color output in logs when logging to a terminal.

- Now depends on :pypi:`colorlog`

- Added :class:`mode.Signal`: async. implementation of the observer
pattern (think Django signals).

- DependencyGraph is now a generic type: ``DependencyGraph[int]``

- Node is now a generic type: ``Node[Service]``.

.. _version-1.2.1:

1.2.1

=====
:release-date: 2017-11-06 04:50 P.M PST
:release-by: Ask Solem

- Service: Subclasses can now override a Service.task method.

Previously it would unexpectedly start two tasks:
the task defined in the superclass and the task defined in
the subclass.

.. _version-1.2.0:

1.2.0

=====
:release-date: 2017-11-02 03:17 P.M PDT
:release-by: Ask Solem

- Renames PoisonpillSupervisor to CrashingSupervisor.

- Child services now stopped even if not fully started.

Previously ``child_service.stop()`` would not be called
if `child_service.start()` never completed, but as a service
might be in the process of starting other child services, we need
to call stop even if not fully started.

.. _version-1.1.1:

Page 14 of 15

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.