Environment¶
A build environment to manage and execute builders.
- class disseminate.builders.environment.Environment(src_filepath, target_root=None, parent_context=None)¶
A project environment for rendering documents using builders.
- The build project environment has the following tasks:
Setup the project_root and target_root
Setup the default decider for builders
Setup the default scanner for builders
Setup the root document.
- Parameters
- src_filepathUnion[str,
pathlib.Path
] The path for the disseminate source file of the root document.
- target_rootOptional[Union[str,
pathlib.Path
]] The (optional) path for the output root directory.
- parent_contextOptional[
context.BaseContext
] The document context to use as the parent_context for the root document. Typically, the default_context from the settings is used as the parent context.
- src_filepathUnion[str,
- build(complete=True)¶
Run the build.
- Parameters
- completeOptional[bool]
If True, run the build until it has completed If False, start the build in the background.
- Returns
- statusstr
The current status of the build.
- property cache_path¶
The path to the directory for storing cached files.
- collect_target_builders(document=None)¶
Return all target builders for the root_document and all sub-documents.
- Parameters
- documentOptional[
document.Document
] The document to create a root builder for.
- documentOptional[
- Returns
- target_buildersList[
builders.Builder
The list of target builders
- target_buildersList[
- static create_environments(root_path='', target_root=None, document_extension='.dm')¶
Create environments from root documents found in the given root_path.
- Parameters
- root_pathOptional[Union[str,
pathlib.Path
]] The path to search for root documents. By default, it is the current directory.
- target_rootOptional[Union[str,
pathlib.Path
]] The (optional) path for the output root directory.
- document_extensionOptional[str]
The file extension for disseminate documents. ex: ‘.dm’
- root_pathOptional[Union[str,
- Returns
- environmentsList[
builders.Environment
]
- environmentsList[
- create_root_builder(document=None)¶
Create a root parallel builder for the target builders of the given document or the root document.
- Parameters
- documentOptional[
document.Document
] The document to create a root builder for.
- documentOptional[
- Returns
- root_builder
composite_builders.ParallelBuilder
The root (parallel) builder.
- root_builder
- static get_target_root(project_root)¶
Determine the target_root directory from the project_root.
- property media_path¶
The path for to prepend to subpaths for media files.
- property name¶
The name of the environment