typespecs.api module#

typespecs.api.from_annotated(obj: HasAnnotations, /, data: str | None = 'data', merge: bool = True, separator: str = '/', type: str | None = 'type') DataFrame[source]#

Create a specification DataFrame from given object with annotations.

Parameters:
  • obj – The object to convert.

  • data – Name of the column for the actual data of the annotations.

  • merge – Whether to merge all subtypes into a single row.

  • separator – Separator for concatenating root and sub-indices.

  • type – Name of the column for the metadata-stripped annotations.

Returns:

Created specification DataFrame.

typespecs.api.from_annotation(obj: Any, /, *, index: str = 'root', merge: bool = True, separator: str = '/', type: str | None = 'type') DataFrame[source]#

Create a specification DataFrame from given annotation.

Parameters:
  • obj – The annotation to convert.

  • index – Root index of the created specification DataFrame.

  • merge – Whether to merge all subtypes into a single row.

  • separator – Separator for concatenating root and sub-indices.

  • type – Name of the column for the metadata-stripped annotations.

Returns:

Created specification DataFrame.