Manifest#
- class project_composer.manifest.base.BaseConfig(*args, **kwargs)[source]#
Bases:
object
Configuration class abstract.
- _FIELDS#
Required list of enabled configuration fields.
- Type:
list
- classmethod validate_attributes(**kwargs)[source]#
Validate given data against field descriptions.
Although it’s a classmethod, it is safe to call it as an instance method.
- Parameters:
**kwargs – Fields datas.
- install_attributes(**kwargs)[source]#
Install defined field as object attributes with given possible values from kwargs.
BaseConfig.validate_attributes()
must be runned before to ensure field values are valid.- Parameters:
**kwargs – Keyword arguments for field values to set as object attribute value.
- classmethod get_fields()[source]#
Return model field definitions.
- Parameters:
cls (class or object) – Config class or object.
- Returns:
Lists every defined field object.
- Return type:
list
- classmethod get_fieldnames()[source]#
Return model field names.
- Parameters:
cls (class or object) – Config class or object.
- Returns:
Lists every defined field name.
- Return type:
list
- class project_composer.manifest.base.BasePluginConfig(*args, **kwargs)[source]#
Bases:
BaseConfig
Plugin configuration abstract.
- class project_composer.manifest.fields.BaseField(name, default=None, required=False, plugin=None)[source]#
Bases:
object
Field class abstract.
- Parameters:
name (string) – The field name.
- Keyword Arguments:
default (object) – Default value when field is empty.
required (boolean) – True if the field is required to be set.
plugin (BasePluginConfig) – The plugin object where to store plugin fields.
- _DEFAULT_VALUE#
Default value to use when no one is explicitely given from arguments. It must fit to the field type. By default this is
None
.- Type:
object
- TYPE#
alias of
object
- class project_composer.manifest.fields.CharField(name, default=None, required=False, plugin=None)[source]#
Bases:
BaseField
For simple string value.
- TYPE#
alias of
str
- class project_composer.manifest.fields.ListField(name, default=None, required=False, plugin=None)[source]#
Bases:
BaseField
For a list value.
- TYPE#
alias of
list
- class project_composer.manifest.fields.BooleanField(name, default=None, required=False, plugin=None)[source]#
Bases:
BaseField
For a boolean value.
- TYPE#
alias of
bool
- class project_composer.manifest.fields.PluginField(*args, plugin, **kwargs)[source]#
Bases:
BaseField
For a plugin value.
A plugin is a special field that include sub configuration object.
- TYPE#
alias of
dict
- class project_composer.manifest.plugins.RequirementsConfig(*args, **kwargs)[source]#
Bases:
BasePluginConfig
Requirements file plugin.
- class project_composer.manifest.manifesto.Manifest(*args, **kwargs)[source]#
Bases:
BaseConfig
The manifest model.
Manifest fields are given as keyword arguments.
Fields are:
- name (string)
The manifest title name.
- collection (list)
A list of application module names for enabled application.
- repository (string)
A Python path where to search for enabled application modules.
- syspaths (list)
A list of Path object to load in sys.path by Composer.
- requirements (dict)
A dictionnary of items to load in
RequirementsConfig
for specific requirements composer. In fact this is used byTextContentComposer
but requirements is actually its unique implementation.
- name#
The manifest title name.
- Type:
string
- collection#
A list of application module names for enabled application.
- Type:
list
- requirements#
Requirements specific options. Either as RequirementsConfig object or a dict of values respecting the RequirementsConfig attributes.
- Type:
dict or RequirementsConfig
- classmethod load(source)[source]#
Loading a manifest source.
- Parameters:
cls (class) – Manifest class.
source (string or pathlib.Path or dict or Manifest) –
The Manifest source to load. It can be either:
A Manifest object, it will just be returned as it without any validation, you are responsible of its correctness;
A string for the file path to load in JSON or TOML format;
A Path object to the file to load in JSON or TOML format;
A Dictionnary which respect the manifest structure;
Source file format are guessed from their file extension such as JSON for
.json
or TOML for.toml
.
- Returns:
A Manifest model instance.
- Return type: