Miscellaneous#

Class marker#

class project_composer.marker.EnabledApplicationMarker[source]#

Bases: object

Application elligibility marker.

An application part class must inherit from this to be marked as enabled to load for composition.

This class implements an attribute _ENABLED_COMPOSABLE_APPLICATION used to validate elligibility and nothing else.

Only purpose of attribute _ENABLED_COMPOSABLE_APPLICATION is to mark it as elligible for composer inspection, don’t change it.

You may however, reproduce elligibility yourself in your class with including this attribute, its value is not important except it must not be None.

Helpers#

project_composer.helpers.check_project(manifest, processors=[], lazy=True)[source]#

Launch composer debugging on a project.

Composer and processor check method do not return anything and just print out every debugging output.

Parameters:

manifest (pathlib.Path) – Manifest Path object.

Keyword Arguments:
  • processors (list) – List of processor to enable in composer.

  • lazy (boolean) – The composer lazy argument value to use.

Logging#

project_composer.logger.init_logger(name, level, printout=True)[source]#

Initialize app logger to configure its level/handler/formatter/etc..

Parameters:
  • name (str) – Logger name used to instanciate and retrieve it.

  • level (str) – Level name (debug, info, etc..) to enable.

Keyword Arguments:

printout (bool) – If False, logs will never be outputed.

Returns:

Application logger.

Return type:

logging.Logger

class project_composer.logger.LoggerBase(*args, **kwargs)[source]#

Bases: object

A basic class just to ship the required logger object.

This class should be at the last position in inheritance definition, since it must be called first because next classes may require its self.log attribute.

Import#

Convenient way to programmatically import a module from a Python path.

project_composer.importer.import_module(name, package=None)[source]#

An approximate implementation of import taken from Python importlib documentation.

This will import a module from given python path in name argument. package argument can be given to search in. If module is not in current directory, you will have to add its parent path in sys.path. Also relative module path will work only for inside a package.

Parameters:

name (string) – A valid Python path to the module.

Keyword Arguments:

package (string) – A package name to exclusively search in package tree.

Returns

object: Found module object.

Exceptions#

Specific application exceptions.

exception project_composer.exceptions.ProjectComposerException[source]#

Bases: Exception

Exception base.

You should never use it directly except for test purpose. Instead make or use a dedicated exception related to the error context.

exception project_composer.exceptions.ComposerError[source]#

Bases: ProjectComposerException

Error occuring from a Composer class or inheriter.

exception project_composer.exceptions.ComposerConfigError[source]#

Bases: ProjectComposerException

Error occuring from a BaseConfig class or inheriter.

exception project_composer.exceptions.ComposerManifestError[source]#

Bases: ProjectComposerException

Error occuring from a manifest.

exception project_composer.exceptions.ComposerAppStoreError[source]#

Bases: ProjectComposerException

Error occuring from Application store.

exception project_composer.exceptions.ComposerProcessorError[source]#

Bases: ProjectComposerException

Error occuring from a processor.

exception project_composer.exceptions.ComposerPurgeError[source]#

Bases: ComposerProcessorError

Error occuring when trying to purge an application repository.