POP 15 ReleaseΒΆ
This release adds recursive contracts to pop. Recursive contracts work almost
identically to normal contracts with an important distinction - recursive
contracts will be applied to every sub that is loaded under another sub. Note
that for call
contracts, local contracts will take precedence over recursive
contracts.
Given the following structure:
If your recursive_contracts/init.py
contains
def pre(hub, ctx):
print("This happens before eeeeverything")
And some.py
:
def thing(hub):
print("This is something happening")
And finally, run.py
:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pop.hub
def start():
hub = pop.hub.Hub()
hub.pop.sub.add(dyne_name="fnord")
hub.pop.sub.load_subdirs(sub=hub.fnord, recurse=True)
hub.fnord.do.some.thing()
start()
Running this will produce:
$ python run.py
This happens before eeeeverything
This is something happening