From fbdeeb1f0d8126eb39dc677179016d9383e6bd8b Mon Sep 17 00:00:00 2001 From: Artur Shiriev Date: Sat, 19 Sep 2026 14:10:56 +0300 Subject: [PATCH] docs(adr): compress to 1 record in the domain-modeling format 0001 kept and rewritten as a single paragraph, 301 words to 151. No records dropped or merged; the numbering and slug are unchanged, so no citation moved. Corrected a stale claim: the skip-non-Provider rule lives in modern_di.Group.get_named_providers, not in _collect_fixtures. --- .../0001-expose-installs-into-modules-only.md | 42 ++++++------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/docs/adr/0001-expose-installs-into-modules-only.md b/docs/adr/0001-expose-installs-into-modules-only.md index 6a6d43f..3a28c65 100644 --- a/docs/adr/0001-expose-installs-into-modules-only.md +++ b/docs/adr/0001-expose-installs-into-modules-only.md @@ -1,30 +1,12 @@ -# `expose` installs into modules only; no `FixtureSet` install seam - -**Decision:** `expose()` installs fixtures into modules only; we will not introduce a `FixtureSet` -(or equivalent installer) seam. - -`expose()` does two things: it **decides** which providers become fixtures (discovery, the -skip-non-Provider rule, cross-group collision detection) and it **installs** the resulting fixtures -onto a module. The decision half was extracted into the private, pure `_collect_fixtures`, which -captured the durable value — the rules became testable through a return value, and the test suite -collapsed accordingly. - -The recurring follow-up is to extract the *install* half too: wrap the `name -> provider` mapping in -a `FixtureSet` exposing `.install(into=...)`, turning the install target into a seam. - -The architectural test for introducing a seam is **one adapter = hypothetical seam, two = real -one**. The install targets that actually exist are the caller's module (default, located via -`inspect.stack()`) and an explicit module passed as `module=`. Both are `types.ModuleType` — the -*same* adapter type exercised with two instances, not two adapters. There is no concrete non-module -install target — a pytest class namespace, a programmatic consumer, an ecosystem integration — -now or clearly coming. The library is, and is expected to remain, a conftest-level adapter that -installs fixtures into modules. - -So a `FixtureSet` would fail the deletion test: delete it and no complexity reappears, because the -`setattr` loop simply inlines back into `expose()`. It would add an interface without adding -behaviour. The install step stays a plain `setattr` loop over the mapping `_collect_fixtures` -returns, and the public surface stays at two symbols. - -**Revisit trigger:** a real second install target appears — two genuinely different adapters at the -install point, such as installing onto a pytest test-class namespace, or handing the mapping to a -programmatic consumer. At that moment the seam becomes real and a `FixtureSet` earns its keep. +# `expose` installs into modules only + +`expose()` both decides which providers become fixtures, by collecting each group's named providers, +rejecting an empty call and raising on a name two groups both claim, and installs them onto a +module. The decision half already lives in the private, pure `_collect_fixtures`; the recurring +proposal is to extract the install half too, wrapping the `name -> provider` mapping in a +`FixtureSet` exposing `.install(into=...)`. We will not, because a seam needs two adapters and the +only install targets are the caller's module, located via `inspect.stack()`, and an explicit +`module=`, both `types.ModuleType` - one adapter exercised with two instances. Deleting a +`FixtureSet` would bring back no complexity, since its `setattr` loop simply inlines, so the install +step stays that loop and the public surface stays at `expose` and `modern_di_fixture`. A genuinely +different install target, such as a pytest class namespace, is what would make the seam real.