On this page
Spellbook configuration basics๏
๐ก Intermediate ยท Lesson 19
SpellbookConfiguration - the book's policy object. with_defaults() is easy mode; set_property tunes the knobs; conjure VALIDATES AND FREEZES it (frozen config refuses mutation - fail fast, not drift).
Before you run๏
Use the Intermediate guide for prerequisite concepts. Run from a checkout with Melder installed and Python 3.14 free-threading selected. The collection download includes the level's local helper modules.
Run the saved script๏
python UX_and_AIX_experiences/02_intermediate/19_spellbook_configuration_basics.py
py -3.14t UX_and_AIX_experiences/02_intermediate/19_spellbook_configuration_basics.py
Public surface๏
md.SpellbookConfiguration, set_property, the freeze law
Code๏
1"""
2TIER: intermediate (19)
3GOAL: SpellbookConfiguration - the book's policy object. with_defaults()
4 is easy mode; set_property tunes the knobs; conjure VALIDATES AND
5 FREEZES it (frozen config refuses mutation - fail fast, not drift).
6SURFACE EXERCISED: md.SpellbookConfiguration, set_property, the freeze law
7"""
8import melder as md
9
10
11class Service:
12 pass
13
14
15def main() -> None:
16 configuration = md.SpellbookConfiguration()
17 configuration.with_defaults()
18 configuration.set_property("phase_scheduler_workers_per_spellbook", 1)
19
20 book = md.Spellbook(configuration=configuration)
21 book.bind(spell=Service, existence="unique")
22 conduit = book.conjure() # validates + freezes the configuration here
23 assert isinstance(conduit.meld(spell=Service), Service)
24 print("configured, conjured, melded")
25
26 try:
27 configuration.set_property("phase_scheduler_workers_per_spellbook", 8)
28 print("post-freeze mutation unexpectedly succeeded")
29 except Exception as err:
30 print("frozen configuration guards itself:", type(err).__name__)
31
32
33if __name__ == "__main__":
34 main()
Check the outcome๏
The script contains its own assertions or demonstrated refusal paths. Run it to evaluate those checks against your installed version. The code above is taken directly from the saved file; no run output is invented here.