Skip to content

0.80.0

Choose a tag to compare

@antonrh antonrh released this 31 Aug 08:00
· 8 commits to main since this release
2172c0c

Breaking

  • Only the class a decorator was applied to is provided. is_provided read __provided__ with hasattr, and a subclass inherits it, so container.scan() registered classes nobody marked, an inherited alias registered the same interface twice, and an inherited from_context claimed a registration nobody made. A subclass that used to resolve by inheriting its base's scope now raises LookupError naming the class, so decorate it too. by @antonrh in #331
@singleton
class BaseSender: ...

@singleton
class SmtpSender(BaseSender): ...

Lifespan

  • Closing a container drops the instances whose finalisers ran, so reopening it makes the resources again. An instance with no resource of its own stays. by @antonrh in #328
  • container.release(T) closes the resource by @antonrh in #316
  • container.release(T) drops the instance even when the finaliser raises, and container.reset() releases everything before re-raising the first failure by @antonrh in #327
  • A scope whose entry fails closes what it had already opened, which Python skips when __enter__ raises by @antonrh in #312
  • Exiting a context with with while it holds an async resource raises, instead of leaving the resource open by @antonrh in #315

Resolution

  • A module subclass keeps the providers its base declared, and replaces the ones it redefines by @antonrh in #331
  • A TypeVar renamed by a base class resolves, including nested in an argument like Repo[Box[T]] by @antonrh in #329
  • A scoped instance is created once when tasks share the scope by @antonrh in #313

Extensions

  • FastAPI: routes in a mounted application are wired, and a route added after install() is validated as it is added. FastStream: every handler of a subscriber is injected, not only the first. pydantic_settings.install() can run twice with override=True, and names the model and the field on a clash. by @antonrh in #330
  • An extension whose package is missing says what to install by @antonrh in #323
  • The pytest plugin no longer breaks every test run when anyio renames a helper by @antonrh in #325

Documentation

  • A getting started page, a reference generated from the docstrings, and every snippet checked to run by @antonrh in #322
  • The pages say it plainly, and how they are written and checked is written down by @antonrh in #321

Dependencies

  • wrapt>=1.17.3. container.ref() builds on the pure-Python ObjectProxy, which wrapt.wrappers exposes from that version, because the C one ignores the __wrapped__ override that makes a reference lazy. by @antonrh in #314
What's changed
  • Run the tests on the Python the matrix names by @antonrh in #311
  • Fix scope entry unwind by @antonrh in #312
  • Create a scoped instance once when tasks share the scope by @antonrh in #313
  • Require the wrapt that has the proxy Ref needs by @antonrh in #314
  • Refuse to close a context that holds async resources by @antonrh in #315
  • Close the resource when an instance is released by @antonrh in #316
  • Docs fix broken snippets by @antonrh in #318
  • Say it plainly in the extension pages by @antonrh in #319
  • Write down how the documentation is written and checked by @antonrh in #321
  • Correct the docs, and give them a getting started and a reference by @antonrh in #322
  • Say what to install when an extension's package is missing by @antonrh in #323
  • Add release job and skill by @antonrh in #324
  • Keep a renamed anyio helper from breaking every test run by @antonrh in #325
  • Open the testing page with what a test does by @antonrh in #326
  • Forget an instance even when its finaliser raises by @antonrh in #327
  • Forget an instance whose resource the context closed by @antonrh in #328
  • Resolve generic parameters that a base class renamed by @antonrh in #329
  • Fix injection in mounted apps, late routes and stacked subscribers by @antonrh in #330
  • Keep the base module providers on a subclass by @antonrh in #331
  • Release 0.80.0 by @antonrh in #332

Full Changelog: 0.79.1...0.80.0