capella2polarion.documents package¶
A package containing document generation related modules.
Submodules¶
capella2polarion.documents.document_config module¶
Module with classes and a loader for document rendering configs.
- class capella2polarion.documents.document_config.BaseDocumentRenderingConfig(*, template_directory: str | ~pathlib.Path, project_id: str | None = None, text_work_item_type: str = 'text', text_work_item_id_field: str = '__C2P__id', status_allow_list: list[str] | None = None, heading_numbering: bool = False, work_item_layouts: dict[str, ~capella2polarion.documents.document_config.WorkItemLayout] = <factory>, instances: ~collections.abc.Sequence[~capella2polarion.documents.document_config.DocumentRenderingInstance])¶
Bases:
BaseModelA template config, which can result in multiple Polarion documents.
- instances: Sequence[DocumentRenderingInstance]¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- work_item_layouts: dict[str, WorkItemLayout]¶
- class capella2polarion.documents.document_config.DocumentConfigs(*, full_authority: list[FullAuthorityDocumentRenderingConfig] = <factory>, mixed_authority: list[MixedAuthorityDocumentRenderingConfig] = <factory>)¶
Bases:
BaseModelThe overall document configuration repository.
- full_authority: list[FullAuthorityDocumentRenderingConfig]¶
- iterate_documents() Iterator[DocumentInfo]¶
Yield all document paths of the config as tuples.
- mixed_authority: list[MixedAuthorityDocumentRenderingConfig]¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class capella2polarion.documents.document_config.DocumentRenderingInstance(*, polarion_type: str | None = None, polarion_space: str, polarion_name: str, polarion_title: str | None = None, params: dict[str, ~typing.Any]=<factory>)¶
Bases:
BaseModelAn instance of a document that should be created in Polarion.
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class capella2polarion.documents.document_config.FullAuthorityDocumentRenderingConfig(*, template_directory: str | ~pathlib.Path, project_id: str | None = None, text_work_item_type: str = 'text', text_work_item_id_field: str = '__C2P__id', status_allow_list: list[str] | None = None, heading_numbering: bool = False, work_item_layouts: dict[str, ~capella2polarion.documents.document_config.WorkItemLayout] = <factory>, instances: ~collections.abc.Sequence[~capella2polarion.documents.document_config.DocumentRenderingInstance], template: str)¶
Bases:
BaseDocumentRenderingConfigFull authority document config with one template per document.
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class capella2polarion.documents.document_config.MixedAuthorityDocumentRenderingConfig(*, template_directory: str | ~pathlib.Path, project_id: str | None = None, text_work_item_type: str = 'text', text_work_item_id_field: str = '__C2P__id', status_allow_list: list[str] | None = None, heading_numbering: bool = False, work_item_layouts: dict[str, ~capella2polarion.documents.document_config.WorkItemLayout] = <factory>, instances: ~collections.abc.Sequence[~capella2polarion.documents.document_config.SectionBasedDocumentRenderingInstance], sections: dict[str, str])¶
Bases:
BaseDocumentRenderingConfigMixed authority document with multiple auto generated sections.
- instances: Sequence[SectionBasedDocumentRenderingInstance]¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class capella2polarion.documents.document_config.SectionBasedDocumentRenderingInstance(*, polarion_type: str | None = None, polarion_space: str, polarion_name: str, polarion_title: str | None = None, params: dict[str, ~typing.Any]=<factory>, section_params: dict[str, dict[str, ~typing.Any]]=<factory>)¶
Bases:
DocumentRenderingInstanceAn instance of a mixed authority doc with section specific params.
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class capella2polarion.documents.document_config.WorkItemLayout(*, show_description: bool = True, show_title: bool = True, show_fields_as_table: bool = True, fields_at_start: list[str] = <factory>, fields_at_end: list[str] = <factory>)¶
Bases:
BaseModelConfiguration for rendering layouts of work items.
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- capella2polarion.documents.document_config.generate_work_item_layouts(configs: dict[str, WorkItemLayout]) list[RenderingLayout]¶
Create polarion_api.RenderingLayouts for a given configuration.
- capella2polarion.documents.document_config.read_config_file(config: TextIO, model: MelodyModel | None = None) DocumentConfigs¶
Read a yaml containing a list of DocumentRenderingConfigs.
capella2polarion.documents.document_renderer module¶
A capella2polarion-specific adapter over Polarion’s generic renderer.
- capella2polarion.documents.document_renderer.AREA_END_CLS = 'c2pAreaEnd'¶
This class is expected for a div in a wiki macro to end a rendering area in mixed authority documents.
- capella2polarion.documents.document_renderer.AREA_START_CLS = 'c2pAreaStart'¶
This class is expected for a div in a wiki macro to start a rendering area in mixed authority documents.
- class capella2polarion.documents.document_renderer.DocumentRenderer(polarion_repository: PolarionDataRepository, model: MelodyModel, model_work_item_project_id: str)¶
Bases:
DocumentRendererRender documents using the shared Polarion API client renderer.
capella2polarion.documents.mass_document_renderer module¶
Provides functionalities to render multiple documents config based.
- class capella2polarion.documents.mass_document_renderer.MassDocumentRenderer(polarion_repository: PolarionDataRepository, model: MelodyModel, model_work_item_project_id: str, overwrite_heading_numbering: bool = False, overwrite_layouts: bool = False)¶
Bases:
objectA class to render multiple documents based on configs.
- render_documents(configs: DocumentConfigs, existing_documents: dict[tuple[str | None, str, str], tuple[Document | None, list[WorkItem]]]) dict[str | None, ProjectData]¶
Render all documents defined in the given config.
- Returns:
A dict mapping project ID to new and updated documents.
- Return type:
documents