@@ -803,7 +803,6 @@ def build_model(
803803
804804 # optional kwargs, don't pass them if none
805805 optional_kwargs = {
806- "attachments" : attachments ,
807806 "config" : config ,
808807 "git_repo" : git_repo ,
809808 "packaged_by" : packaged_by ,
@@ -814,13 +813,23 @@ def build_model(
814813 }
815814 kwargs = {k : v for k , v in optional_kwargs .items () if v is not None }
816815
816+ if attachments is not None :
817+ file_attachments = attachments .pop ("files" , None )
818+ # this is my attempt at creating the correct attachments, but this is still not working
819+ # (the attachments field is empty after serialization and the content of attachments:files is not copied)
820+ # I also tried this and it doesn't work either:
821+ # spec.model.schema.Attachments().load({"files": file_attachments})
822+ if file_attachments is None :
823+ kwargs ["attachments" ] = model_spec .raw_nodes .Attachments (** attachments )
824+ else :
825+ kwargs ["attachments" ] = model_spec .raw_nodes .Attachments (files = file_attachments , ** attachments )
817826 if dependencies is not None :
818827 kwargs ["dependencies" ] = _get_dependencies (dependencies , root )
828+ if maintainers is not None :
829+ kwargs ["maintainers" ] = [model_spec .raw_nodes .Maintainer (** m ) for m in maintainers ]
819830 if parent is not None :
820831 assert len (parent ) == 2
821832 kwargs ["parent" ] = {"uri" : parent [0 ], "sha256" : parent [1 ]}
822- if maintainers is not None :
823- kwargs ["maintainers" ] = [model_spec .raw_nodes .Maintainer (** m ) for m in maintainers ]
824833
825834 try :
826835 model = model_spec .raw_nodes .Model (
0 commit comments