Python


Glue supports python as a code generation target, allowing you to generate Python models and enums from Glue files.

Simply run:

shell

#Supported model libraries

Glue can generate Python models using:

  • pydantic (default)
  • dataclasses
  • attrs
  • msgspec

Configure this in .gluerc:

yaml

base_model is used only for pydantic.

#Example

For this Glue spec:

glue

...generating Python...

shell

...will produce code similar to:

python

#Notes

  • Nested Glue models are emitted as flattened class names (e.g. Parent_Child).
  • @field(alias="...") is applied in all supported Python model libraries.
  • Anonymous model type atoms are currently not supported in Python code generation.