How to automate structure creation with IDAPython?

Manually creating structures in IDA Pro can be time-consuming, but some of you were wondering how to automate this process with updated IDA 9.0 endpoints for Types and how to port removed functions when ida_struct and ida_enum modules do not exist anymore.

We prepared a few samples that demonstrate how you can create structures in different ways:

Basic samples:

Complex scripts: