structurizr-python
structurizr-python copied to clipboard
Allow name and description arguments to elements to be positional
Checklist
- [X] There are no similar issues or pull requests for this yet.
Is your feature related to a problem? Please describe it.
When constructing a model from Python (rather than manipulating an existing one), it would be natural and more compact to be able to specify both the name and description of an element positionally rather than having to explicitly name them:
c1 = Container("Mobile app", "Application running on mobile devices")
See also Midnighter/structurizr-python#13
Describe the solution you would like.
class Container(StaticStructureElement):
def __init__(
self,
name: str = "",
desctription: str = "",
*,
parent: "SoftwareSystem" = None,
technology: str = "",
components: Iterable[Component] = (),
**kwargs
)
I guess it's a matter of style. I definitely prefer named keyword arguments for instantiation (makes it safer in my opinion). @ilaif prefers keyword arguments everywhere :smiley:
However, I don't need to force my style on others. So I'm not opposed to this change.