Andreas Stenius
Andreas Stenius
I haven't looked how these macros are loaded, but can't we populate the env when loading these macros, with say a `macro` decorator that could be used to hook up...
~Yeah, for constants though, I don't think we should use the same decorator though, as that is not technically a macro at all (as I see it, at least).~ Perhaps...
Good point. Trying out how `register` feels.. ```python @register(doc="help text describing the constant") CONSTANT = "value" # but then again, that could work for methods as well... @register(doc="Help text") def...
And, come to think of it. That decorator could be a window into the macro world for plugin authors as well! Potential idea: ```python @register(doc="Example using env var support", expand_vars=["FOO",...
I think it would make a lot of sense, defining macros in BUILD files, and that they are accessible for the current subtree. I like the decorator syntax, as it...
> I don't think that you can directly apply decorators to constants. Right, my mistake :P Perhaps more concisely alternative then (and I think we would need to capture the...
Another option is to "abuse" annotations in some way: ```python CONSTANT: "help text describing the constant" = "value" ```
> > Another option is to "abuse" annotations in some way: > > That would mess up MyPy users Well, the fact you can't use annotations at all in the...
>> Another option is to "abuse" annotations in some way: >> >> ```python >> CONSTANT: "help text describing the constant" = "value" >> ``` > [@Eric-Arellano] That would mess up...
Went ahead and made a PR trying out the `Annotated` route to registering help text for constant values. Looks pretty neat to me 😁