Processors#
- class project_composer.processors.ComposerProcessor(composer)[source]#
Bases:
object
The base processor class to implement.
This processor does not do anything nor have any real methods to call from composer.
- Parameters:
composer (Composer) – The composer instance where this processor will be executed.
- composer#
The composer instance used by processor to get manifest object and some internal composer methods to work with application repository.
- Type:
- get_module_path(name)[source]#
Return a Python path for a specific module name base on base application path from composer.
This default implementation just use the base application module (
__init__
). Other processors may override it to use a specific module.- Parameters:
name (string) – Module name.
- Returns:
Module name prefixed with repository path if it is not empty else returns just the module name.
- Return type:
string
- class project_composer.processors.ClassProcessor(composer)[source]#
Bases:
ComposerProcessor
Class composer find all existing classes for enabled application modules and that match criterias from
Composer._is_elligible_class
.- export(**kwargs)[source]#
Export enabled applications classes.
- Returns:
A list of Python classes found as elligible for criterias. The list is firstly ordered by the order of enabled application from manifest and secondly by their definition order in their module (if there is two classes defined with the same name, the first is retained and the second one is ignored).
- Return type:
list
- check(printer=<built-in function print>)[source]#
Debugging check what this processor should find or match.
- Keyword Arguments:
printer (callable) – A callable to use to output debugging informations. Default to builtin function
print
but it won’t be very pretty, we recommend to useutils.tree_printer.TreePrinter
to benefit from the tree alike display. Note than composer already giveTreePrinter
to this argument when calling this method.
- class project_composer.processors.PurgeProcessor(composer)[source]#
Bases:
ComposerProcessor
Processor to purge application repository from not enabled application.
This processor requires the repository to be set and valid.
- class project_composer.processors.TextContentProcessor(composer)[source]#
Bases:
ComposerProcessor
Text content composer assemble all text content files from enabled Applications.
Although it has been done as a generic solution for any content files, this is currently tied to specific
requirements
plugin from manifest.- get_template(template=None)[source]#
Get the base content text used to build final content.
- Keyword Arguments:
template (string or pathlib.Path) – Path to file of base content to start output. By default there is none.
- Returns:
Base content. If no template has been given, an empty string is returned instead.
- Return type:
string
- export()[source]#
Combinate all application content files into a single content string.
- Returns:
Combinated content files.
- Return type:
string