Asphalt

Latest version: v4.11.1

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

Scan your dependencies

Page 1 of 5

4.11.1

- Worked around the presence of the ``importlib_metadata`` module on Python 3.10 and
later causing ``PluginContainer.create_component()`` to fail with ``AttributeError``

4.11.0

- Added the ``--set`` option for ``asphalt run`` for overriding specific values in
configuration (PR by David Brochart)
- Made configuration files optional (PR by David Brochart)

4.10.1

- Fixed root context being unset as the current context before its ``close()`` method is
run

4.10.0

- Changed ``executor`` to propagate the `PEP 567`_ context to the worker thread, just
like ``Context.call_in_executor()``

4.9.1

- Fixed type annotation for ``context_teardown``
- Improved type annotations

4.9.0

- Added ``asphalt.core.get_resources()`` as a top-level shortcut for
``current_context().get_resources(...)``
- Allowed resource retrieval and generation in teardown callbacks until the context has
been completely closed (this would previously raise
``RuntimeError("this context has already been closed")``)
- Allowed specifying optional dependencies with dependency injection, using either
``Optional[SomeType]`` (all Python versions) or ``SomeType | None`` (Python 3.10+)
- Allowed omitting the ``types`` argument in ``Context.add_resource_factory()`` if the
factory callable has a return type annotation
- ``Context.call_in_executor()`` now copies the current `PEP 567`_ context to the worker
thread, allowing operations that require the "current context" to be present (e.g.
dependency injection)
- Raise better errors when the developer forgets to call ``resource()`` or forgets to
add the ``inject`` decorator
- Raise a ``UserWarning`` when ``inject`` is used on a function that has no
``resource()`` declarations
- Fixed ``inject`` not resolving forward references in type annotations in locally
defined functions
- Improved type annotations

.. _PEP 567: https://peps.python.org/pep-0567/

Page 1 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.