OASIS Topology and Orchestration Specification for Cloud Applications (TOSCA) TC

TOSCA maps with complex keys in Python

  • 1.  TOSCA maps with complex keys in Python

    Posted 04-30-2021 21:30
    In the last ad-hoc meeting we again raised the fact that map keys in YAML can be complex and that we have not disallowed them in TOSCA. As we pointed out again, this feature can be tricky to work with in many programming languages. For Python users, I've started porting my Agnostic Raw Data (ARD) library from Go to Python. It provides a Map type that can do the trick for this use case and should function as a drop-in replacement for the standard dict. I'm still working on getting the ruamel.yaml library using it for maximum transparency. (Right now ruamel.yaml will choke on complex keys.) The ARD library also supports the "compatible JSON" format, which allows for the richer type set of YAML to be round-tripped via JSON. Apache Licensed, contributions welcome! https://github.com/tliron/python-ard