Tagging/Metadata Umbrella #630
elijahbenizzy
started this conversation in
General
Replies: 1 comment
-
The The grey zone is how tags relate to the lifecycle hooks. The benefit of hooks is that they don't alter a function; you can import and use them outside Hamilton. A similar logic is relevant for visualizations: # functions.py
@tag(env="dev")
def feature_a():
...
@tag(env="prod", owner="zilto")
def feature_b():
... # runner.py
import functions
# schemas are a special type of hook
env_schemas = dict(
dev=DEV_SCHEMA,
prod=PROD_SCHEMA,
)
owner_hooks = dict(
zilto=ZILTO_HOOKS,
)
dr = (
driver.Builder()
.with_modules(functions)
.with_hooks(env_schemas, owner_hooks) # <- execution logic based on tags
.build()
)
# would need to specify on what key the hooks are related
# it's simpler to have "flat" stylesheet instead of "nested" ones because
# of graphviz limitations
env_stylesheet = dict(
prod=PROD_STYLESHEET,
dev=ENV_STYLESHEET
)
dr.display_all_functions(stylesheet=env_stylesheet) # <- viz logic based on tags |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A few things we're thinking about and we'd like the community's input:
If we allow the first, how do we store/query tags?
Should we allow non-string types for keys (E.G. booleans?). Currently we allow lists, which just means multiple values. But booleans might be nice. Note this is similar to (1) in that these often express "existence" with no value.
Which use-cases make the most sense for tags? Which should we support? So far:
Comment here with:
(1) Your use-cases
(2) Thoughts on any of the above/more questions!
We can break out into further discussions if multiple of these are interesting.
Beta Was this translation helpful? Give feedback.
All reactions