penguin.penguin_config.gen_docs module¶
- class penguin.penguin_config.gen_docs.DocsField(type_, merge_behavior, title, description, default, examples)[source]¶
Bases:
objectInformation about a field of the config, for generating docs
- Parameters:
type_ (type)
merge_behavior (str | None)
title (str | None)
description (str | None)
default (PydanticUndefinedType | Any)
examples (tuple[Any])
- default: PydanticUndefinedType | Any¶
- description: str | None¶
- examples: tuple[Any]¶
- from_type()[source]¶
Create a DocsField from a Python type, which should probably inherit BaseModel or RootModel
- Parameters:
type_ (type)
- Return type:
- merge(other)[source]¶
Create a DocsField by combining two DocsFields, using the second to fill in gaps in the first.
- merge_behavior: str | None¶
- title: str | None¶
- type_: type¶
- penguin.penguin_config.gen_docs.gen_docs(path=[], docs_field=DocsField(type_=<class 'penguin.penguin_config.structure.Main'>, merge_behavior=None, title='Penguin Configuration', description='Configuration file for config-file-based rehosting with IGLOO', default=PydanticUndefined, examples=[]))[source]¶
Generate docs for config format starting from the field at the given path
- penguin.penguin_config.gen_docs.gen_docs_compact_field_table(fields)[source]¶
For fields that do not have any nested structure and only simple types, generate a compact table to make the docs easier to read.
- penguin.penguin_config.gen_docs.gen_docs_field(path, docs_field, include_type=True)[source]¶
Generate docs for a single field of the config
- penguin.penguin_config.gen_docs.gen_docs_type_name(t)[source]¶
Convert the Python type t to a string for use in generated docs.