aiida.cmdline.params.types package#

Provides all parameter types.

Submodules#

Module for the calculation parameter type

class aiida.cmdline.params.types.calculation.CalculationParamType(sub_classes: tuple[str, ...] | None = None)[source]#

Bases: IdentifierParamType

The ParamType for identifying Calculation entities or its subclasses

__abstractmethods__ = frozenset({})#
__annotations__ = {'_sub_classes': 'tuple | None', 'arity': 't.ClassVar[int]', 'envvar_list_splitter': 't.ClassVar[t.Optional[str]]', 'is_composite': 't.ClassVar[bool]', 'name': 'str'}#
__module__ = 'aiida.cmdline.params.types.calculation'#
_abc_impl = <_abc._abc_data object>#
name: str = 'Calculation'#

the descriptive name of this type

property orm_class_loader#

Return the orm entity loader class, which should be a subclass of OrmEntityLoader. This class is supposed to be used to load the entity for a given identifier

Returns:

the orm entity loader class for this ParamType

A custom click type that defines a lazy choice

class aiida.cmdline.params.types.choice.LazyChoice(get_choices)[source]#

Bases: ParamType

This is a delegate of click’s Choice ParamType that evaluates the set of choices lazily. This is useful if the choices set requires an import that is slow. Using the vanilla click.Choice will call this on import which will slow down verdi and its autocomplete. This type will generate the choices set lazily through the choices property

__annotations__ = {}#
__init__(get_choices)[source]#

Construct a new instance.

__module__ = 'aiida.cmdline.params.types.choice'#
__repr__()[source]#

Return repr(self).

property _click_choice#

Get the internal click Choice object that we delegate functionality to. Will construct it lazily if necessary.

Returns:

The click Choice

Return type:

click.Choice

property choices#
convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

get_metavar(param)[source]#

Returns the metavar default for this param if it provides one.

get_missing_message(param)[source]#

Optionally might return extra information about a missing parameter.

New in version 2.0.

name: str = 'choice'#

the descriptive name of this type

Module to define the custom click type for code.

class aiida.cmdline.params.types.code.CodeParamType(sub_classes=None, entry_point=None)[source]#

Bases: IdentifierParamType

The ParamType for identifying Code entities or its subclasses

__abstractmethods__ = frozenset({})#
__annotations__ = {'_sub_classes': 'tuple | None', 'arity': 't.ClassVar[int]', 'envvar_list_splitter': 't.ClassVar[t.Optional[str]]', 'is_composite': 't.ClassVar[bool]', 'name': 'str'}#
__init__(sub_classes=None, entry_point=None)[source]#

Construct the param type

Parameters:
  • sub_classes – specify a tuple of Code sub classes to narrow the query set

  • entry_point – specify an optional calculation entry point that the Code’s input plugin should match

__module__ = 'aiida.cmdline.params.types.code'#
_abc_impl = <_abc._abc_data object>#
convert(value, param, ctx)[source]#

Attempt to convert the given value to an instance of the orm class using the orm class loader.

Returns:

the loaded orm entity

Raises:
  • click.BadParameter – if the value is ambiguous and leads to multiple entities

  • click.BadParameter – if the value cannot be mapped onto any existing instance

  • RuntimeError – if the defined orm class loader is not a subclass of the OrmEntityLoader class

name: str = 'Code'#

the descriptive name of this type

property orm_class_loader#

Return the orm entity loader class, which should be a subclass of OrmEntityLoader. This class is supposed to be used to load the entity for a given identifier

Returns:

the orm entity loader class for this ParamType

shell_complete(ctx, param, incomplete)[source]#

Return possible completions based on an incomplete value.

Returns:

list of tuples of valid entry points (matching incomplete) and a description

Module for the custom click param type computer

class aiida.cmdline.params.types.computer.ComputerParamType(sub_classes: tuple[str, ...] | None = None)[source]#

Bases: IdentifierParamType

The ParamType for identifying Computer entities or its subclasses

__abstractmethods__ = frozenset({})#
__annotations__ = {'_sub_classes': 'tuple | None', 'arity': 't.ClassVar[int]', 'envvar_list_splitter': 't.ClassVar[t.Optional[str]]', 'is_composite': 't.ClassVar[bool]', 'name': 'str'}#
__module__ = 'aiida.cmdline.params.types.computer'#
__slotnames__ = []#
_abc_impl = <_abc._abc_data object>#
name: str = 'Computer'#

the descriptive name of this type

property orm_class_loader#

Return the orm entity loader class, which should be a subclass of OrmEntityLoader. This class is supposed to be used to load the entity for a given identifier

Returns:

the orm entity loader class for this ParamType

shell_complete(ctx, param, incomplete)[source]#

Return possible completions based on an incomplete value.

Returns:

list of tuples of valid entry points (matching incomplete) and a description

class aiida.cmdline.params.types.computer.MpirunCommandParamType[source]#

Bases: StringParamType

Custom click param type for mpirun-command

Note

requires also a scheduler to be provided, and the scheduler must be called first!

Validate that the provided ‘mpirun’ command only contains replacement fields (e.g. {tot_num_mpiprocs}) that are known.

Return a list of arguments (by using ‘value.strip().split(” “) on the input string)

__annotations__ = {}#
__module__ = 'aiida.cmdline.params.types.computer'#
__repr__()[source]#

Return repr(self).

convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'mpiruncommandstring'#

the descriptive name of this type

class aiida.cmdline.params.types.computer.ShebangParamType[source]#

Bases: StringParamType

Custom click param type for shebang line

__annotations__ = {}#
__module__ = 'aiida.cmdline.params.types.computer'#
__repr__()[source]#

Return repr(self).

convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'shebangline'#

the descriptive name of this type

Module to define the custom click type for code.

class aiida.cmdline.params.types.config.ConfigOptionParamType[source]#

Bases: StringParamType

ParamType for configuration options.

__annotations__ = {}#
__module__ = 'aiida.cmdline.params.types.config'#
convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'config option'#

the descriptive name of this type

shell_complete(ctx, param, incomplete)[source]#

Return possible completions based on an incomplete value

Returns:

list of tuples of valid entry points (matching incomplete) and a description

Module for the custom click param type for data

class aiida.cmdline.params.types.data.DataParamType(sub_classes: tuple[str, ...] | None = None)[source]#

Bases: IdentifierParamType

The ParamType for identifying Data entities or its subclasses

__abstractmethods__ = frozenset({})#
__annotations__ = {'_sub_classes': 'tuple | None', 'arity': 't.ClassVar[int]', 'envvar_list_splitter': 't.ClassVar[t.Optional[str]]', 'is_composite': 't.ClassVar[bool]', 'name': 'str'}#
__module__ = 'aiida.cmdline.params.types.data'#
_abc_impl = <_abc._abc_data object>#
name: str = 'Data'#

the descriptive name of this type

property orm_class_loader#

Return the orm entity loader class, which should be a subclass of OrmEntityLoader. This class is supposed to be used to load the entity for a given identifier

Returns:

the orm entity loader class for this ParamType

Module for custom click param type group.

class aiida.cmdline.params.types.group.GroupParamType(create_if_not_exist=False, sub_classes=('aiida.groups:core',))[source]#

Bases: IdentifierParamType

The ParamType for identifying Group entities or its subclasses.

__abstractmethods__ = frozenset({})#
__annotations__ = {'_sub_classes': 'tuple | None', 'arity': 't.ClassVar[int]', 'envvar_list_splitter': 't.ClassVar[t.Optional[str]]', 'is_composite': 't.ClassVar[bool]', 'name': 'str'}#
__init__(create_if_not_exist=False, sub_classes=('aiida.groups:core',))[source]#

Construct the parameter type.

The sub_classes argument can be used to narrow the set of subclasses of Group that should be matched. By default all subclasses of Group will be matched, otherwise it is restricted to the subclasses that correspond to the entry point names in the tuple of sub_classes.

To prevent having to load the database environment at import time, the actual loading of the entry points is deferred until the call to convert is made. This is to keep the command line autocompletion light and responsive. The entry point strings will be validated, however, to see if they correspond to known entry points.

Parameters:
  • create_if_not_exist – boolean, if True, will create the group if it does not yet exist. By default the group created will be of class Group, unless another subclass is specified through sub_classes. Note that in this case, only a single entry point name can be specified

  • sub_classes – a tuple of entry point strings from the aiida.groups entry point group.

__module__ = 'aiida.cmdline.params.types.group'#
_abc_impl = <_abc._abc_data object>#
convert(value, param, ctx)[source]#

Attempt to convert the given value to an instance of the orm class using the orm class loader.

Returns:

the loaded orm entity

Raises:
  • click.BadParameter – if the value is ambiguous and leads to multiple entities

  • click.BadParameter – if the value cannot be mapped onto any existing instance

  • RuntimeError – if the defined orm class loader is not a subclass of the OrmEntityLoader class

name: str = 'Group'#

the descriptive name of this type

property orm_class_loader#

Return the orm entity loader class, which should be a subclass of OrmEntityLoader.

This class is supposed to be used to load the entity for a given identifier.

Returns:

the orm entity loader class for this ParamType

shell_complete(ctx, param, incomplete)[source]#

Return possible completions based on an incomplete value.

Returns:

list of tuples of valid entry points (matching incomplete) and a description

Module for custom click param type identifier

class aiida.cmdline.params.types.identifier.IdentifierParamType(sub_classes: tuple[str, ...] | None = None)[source]#

Bases: ParamType, ABC

An extension of click.ParamType for a generic identifier parameter. In AiiDA, orm entities can often be identified by either their ID, UUID or optionally some LABEL identifier. This parameter type implements the convert method, which attempts to convert a value passed to the command for a parameter with this type, to an orm entity. The actual loading of the entity is delegated to the orm class loader. Subclasses of this parameter type should implement the orm_class_loader method to return the appropriate orm class loader, which should be a subclass of aiida.orm.utils.loaders.OrmEntityLoader for the corresponding orm class.

__abstractmethods__ = frozenset({'orm_class_loader'})#
__annotations__ = {'_sub_classes': 'tuple | None', 'arity': 't.ClassVar[int]', 'envvar_list_splitter': 't.ClassVar[t.Optional[str]]', 'is_composite': 't.ClassVar[bool]', 'name': 'str'}#
__init__(sub_classes: tuple[str, ...] | None = None)[source]#

Construct the parameter type, optionally specifying a tuple of entry points that reference classes that should be a sub class of the base orm class of the orm class loader. The classes pointed to by these entry points will be passed to the OrmEntityLoader when converting an identifier and they will restrict the query set by demanding that the class of the corresponding entity matches these sub classes.

To prevent having to load the database environment at import time, the actual loading of the entry points is deferred until the call to convert is made. This is to keep the command line autocompletion light and responsive. The validation of entry point strings is also postponed for the same reason.

Parameters:

sub_classes – a tuple of entry point strings that can narrow the set of orm classes that values will be mapped upon. These classes have to be strict sub classes of the base orm class defined by the orm class loader

__module__ = 'aiida.cmdline.params.types.identifier'#
_abc_impl = <_abc._abc_data object>#
property _entry_points: list[EntryPoint]#

Allowed entry points, loaded on demand

convert(value: Any, param: Parameter | None, ctx: Context) Any[source]#

Attempt to convert the given value to an instance of the orm class using the orm class loader.

Returns:

the loaded orm entity

Raises:
  • click.BadParameter – if the value is ambiguous and leads to multiple entities

  • click.BadParameter – if the value cannot be mapped onto any existing instance

  • RuntimeError – if the defined orm class loader is not a subclass of the OrmEntityLoader class

abstract property orm_class_loader: OrmEntityLoader#

Return the orm entity loader class, which should be a subclass of OrmEntityLoader. This class is supposed to be used to load the entity for a given identifier

Returns:

the orm entity loader class for this ParamType

Module to define custom click param type for multiple values

class aiida.cmdline.params.types.multiple.MultipleValueParamType(param_type)[source]#

Bases: ParamType

An extension of click.ParamType that can parse multiple values for a given ParamType

__annotations__ = {}#
__init__(param_type)[source]#

Construct a new instance.

__module__ = 'aiida.cmdline.params.types.multiple'#
convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

get_metavar(param)[source]#

Returns the metavar default for this param if it provides one.

Module to define the custom click param type for node

class aiida.cmdline.params.types.node.NodeParamType(sub_classes: tuple[str, ...] | None = None)[source]#

Bases: IdentifierParamType

The ParamType for identifying Node entities or its subclasses

__abstractmethods__ = frozenset({})#
__annotations__ = {'_sub_classes': 'tuple | None', 'arity': 't.ClassVar[int]', 'envvar_list_splitter': 't.ClassVar[t.Optional[str]]', 'is_composite': 't.ClassVar[bool]', 'name': 'str'}#
__module__ = 'aiida.cmdline.params.types.node'#
_abc_impl = <_abc._abc_data object>#
name: str = 'Node'#

the descriptive name of this type

property orm_class_loader#

Return the orm entity loader class, which should be a subclass of OrmEntityLoader. This class is supposed to be used to load the entity for a given identifier

Returns:

the orm entity loader class for this ParamType

Click parameter types for paths.

class aiida.cmdline.params.types.path.AbsolutePathOrEmptyParamType(exists: bool = False, file_okay: bool = True, dir_okay: bool = True, writable: bool = False, readable: bool = True, resolve_path: bool = False, allow_dash: bool = False, path_type: Type[Any] | None = None, executable: bool = False)[source]#

Bases: AbsolutePathParamType

The ParamType for identifying absolute Paths, accepting also empty paths.

__annotations__ = {}#
__module__ = 'aiida.cmdline.params.types.path'#
__repr__()[source]#

Return repr(self).

convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'AbsolutePathEmpty'#

the descriptive name of this type

class aiida.cmdline.params.types.path.AbsolutePathParamType(exists: bool = False, file_okay: bool = True, dir_okay: bool = True, writable: bool = False, readable: bool = True, resolve_path: bool = False, allow_dash: bool = False, path_type: Type[Any] | None = None, executable: bool = False)[source]#

Bases: Path

The ParamType for identifying absolute Paths (derived from click.Path).

__annotations__ = {}#
__module__ = 'aiida.cmdline.params.types.path'#
__repr__()[source]#

Return repr(self).

convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'AbsolutePath'#

the descriptive name of this type

class aiida.cmdline.params.types.path.FileOrUrl(timeout_seconds=10, **kwargs)[source]#

Bases: File

Extension of click’s File-type to include URLs.

Returns handle either to local file or to remote file fetched from URL.

Parameters:

timeout_seconds (int) – Maximum timeout accepted for URL response. Must be an integer in the range [0;60].

__annotations__ = {}#
__init__(timeout_seconds=10, **kwargs)[source]#
__module__ = 'aiida.cmdline.params.types.path'#
convert(value, param, ctx)[source]#

Return file handle.

get_url(url, param, ctx)[source]#

Retrieve file from URL.

name: str = 'FileOrUrl'#

the descriptive name of this type

class aiida.cmdline.params.types.path.PathOrUrl(timeout_seconds=10, **kwargs)[source]#

Bases: Path

Extension of click’s Path-type to include URLs.

A PathOrUrl can either be a click.Path-type or a URL.

Parameters:

timeout_seconds (int) – Maximum timeout accepted for URL response. Must be an integer in the range [0;60].

__annotations__ = {}#
__init__(timeout_seconds=10, **kwargs)[source]#
__module__ = 'aiida.cmdline.params.types.path'#
checks_url(url, param, ctx)[source]#

Check whether URL is reachable within timeout.

convert(value, param, ctx)[source]#

Overwrite convert Check first if click.Path-type, then check if URL.

name: str = 'PathOrUrl'#

the descriptive name of this type

aiida.cmdline.params.types.path.check_timeout_seconds(timeout_seconds)[source]#

Raise if timeout is not within range [0;60]

Click parameter type for AiiDA Plugins.

class aiida.cmdline.params.types.plugin.PluginParamType(group: str | tuple[str] | None = None, load: bool = False, *args, **kwargs)[source]#

Bases: EntryPointType

AiiDA Plugin name parameter type.

Parameters:
  • group – string or tuple of strings, where each is a valid entry point group. Adding the aiida. prefix is optional. If it is not detected it will be prepended internally.

  • load – when set to True, convert will not return the entry point, but the loaded entry point

Usage:

click.option(... type=PluginParamType(group='aiida.calculations')

or:

click.option(... type=PluginParamType(group=('calculations', 'data'))
__annotations__ = {}#
__init__(group: str | tuple[str] | None = None, load: bool = False, *args, **kwargs)[source]#

group should be either a string or a tuple of valid entry point groups. If it is not specified we use the tuple of all recognized entry point groups.

__module__ = 'aiida.cmdline.params.types.plugin'#
__slotnames__ = []#
property _entry_point_names: list[str]#
property _entry_points: list[tuple[str, EntryPoint]]#
_factory_mapping = {'aiida.calculations': <function CalculationFactory>, 'aiida.data': <function DataFactory>, 'aiida.groups': <function GroupFactory>, 'aiida.parsers': <function ParserFactory>, 'aiida.schedulers': <function SchedulerFactory>, 'aiida.tools.data.orbitals': <function OrbitalFactory>, 'aiida.tools.dbimporters': <function DbImporterFactory>, 'aiida.transports': <function TransportFactory>, 'aiida.workflows': <function WorkflowFactory>}#
convert(value: t.Any, param: click.Parameter | None, ctx: click.Context | None) t.Union[EntryPoint, t.Any][source]#

Convert the string value to an entry point instance, if the value can be successfully parsed into an actual entry point. Will raise click.BadParameter if validation fails.

get_entry_point_from_string(entry_point_string: str) EntryPoint[source]#

Validate a given entry point string, which means that it should have a valid entry point string format and that the entry point unambiguously corresponds to an entry point in the groups configured for this instance of PluginParameterType.

Returns:

the entry point if valid

Raises:

ValueError if the entry point string is invalid

get_missing_message(param: Parameter) str[source]#

Optionally might return extra information about a missing parameter.

New in version 2.0.

get_possibilities(incomplete: str = '') list[str][source]#

Return a list of plugins starting with incomplete

get_valid_arguments() list[str][source]#

Return a list of all available plugin names for the groups configured for this PluginParamType instance. If the entry point names are not unique, because there are multiple groups that contain an entry point that has an identical name, we need to prefix the names with the full group name

Returns:

list of valid entry point strings

property groups: tuple[str, ...]#

Returns a tuple of valid groups for this instance

property has_potential_ambiguity: bool#

Returns whether the set of supported entry point groups can lead to ambiguity when only an entry point name is specified. This will happen if one ore more groups share an entry point with a common name

name: str = 'plugin'#

the descriptive name of this type

shell_complete(ctx: Context | None, param: Parameter | None, incomplete: str) list[CompletionItem][source]#

Return possible completions based on an incomplete value

Returns:

list of tuples of valid entry points (matching incomplete) and a description

validate_entry_point_group(group: str) None[source]#

Module for the process node parameter type

class aiida.cmdline.params.types.process.ProcessParamType(sub_classes: tuple[str, ...] | None = None)[source]#

Bases: IdentifierParamType

The ParamType for identifying ProcessNode entities or its subclasses

__abstractmethods__ = frozenset({})#
__annotations__ = {'_sub_classes': 'tuple | None', 'arity': 't.ClassVar[int]', 'envvar_list_splitter': 't.ClassVar[t.Optional[str]]', 'is_composite': 't.ClassVar[bool]', 'name': 'str'}#
__module__ = 'aiida.cmdline.params.types.process'#
_abc_impl = <_abc._abc_data object>#
name: str = 'Process'#

the descriptive name of this type

property orm_class_loader#

Return the orm entity loader class, which should be a subclass of OrmEntityLoader. This class is supposed to be used to load the entity for a given identifier

Returns:

the orm entity loader class for this ParamType

Profile param type for click.

class aiida.cmdline.params.types.profile.ProfileParamType(*args, **kwargs)[source]#

Bases: LabelStringType

The profile parameter type for click.

This parameter type requires the command that uses it to define the context_class class attribute to be the aiida.cmdline.groups.verdi.VerdiContext class, as that is responsible for creating the user defined object obj on the context and loads the instance config.

__annotations__ = {}#
__init__(*args, **kwargs)[source]#
__module__ = 'aiida.cmdline.params.types.profile'#
convert(value, param, ctx)[source]#

Attempt to match the given value to a valid profile.

static deconvert_default(value)[source]#
name: str = 'profile'#

the descriptive name of this type

shell_complete(ctx, param, incomplete)[source]#

Return possible completions based on an incomplete value

Returns:

list of tuples of valid entry points (matching incomplete) and a description

Module for various text-based string validation.

class aiida.cmdline.params.types.strings.EmailType[source]#

Bases: StringParamType

Parameter whose values have to correspond to a valid email address format.

Note

For the moment, we do not require the domain suffix, i.e. ‘aiida@localhost’ is still valid.

__annotations__ = {}#
__module__ = 'aiida.cmdline.params.types.strings'#
__repr__()[source]#

Return repr(self).

__slotnames__ = []#
convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'email'#

the descriptive name of this type

class aiida.cmdline.params.types.strings.EntryPointType[source]#

Bases: NonEmptyStringParamType

Parameter whose values have to be valid Python entry point strings.

See https://packaging.python.org/en/latest/specifications/entry-points/

__annotations__ = {}#
__module__ = 'aiida.cmdline.params.types.strings'#
__repr__()[source]#

Return repr(self).

convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'entrypoint'#

the descriptive name of this type

class aiida.cmdline.params.types.strings.HostnameType[source]#

Bases: StringParamType

Parameter corresponding to a valid hostname (or empty) string.

Regex according to https://stackoverflow.com/a/3824105/1069467

__annotations__ = {}#
__module__ = 'aiida.cmdline.params.types.strings'#
__repr__()[source]#

Return repr(self).

__slotnames__ = []#
convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'hostname'#

the descriptive name of this type

class aiida.cmdline.params.types.strings.LabelStringType[source]#

Bases: NonEmptyStringParamType

Parameter accepting valid label strings.

Non-empty string, made up of word characters (includes underscores [1]), dashes, and dots.

[1] See https://docs.python.org/3/library/re.html

ALPHABET = '\\w\\.\\-'#
__annotations__ = {'arity': 't.ClassVar[int]', 'envvar_list_splitter': 't.ClassVar[t.Optional[str]]', 'is_composite': 't.ClassVar[bool]', 'name': 'str'}#
__module__ = 'aiida.cmdline.params.types.strings'#
__repr__()[source]#

Return repr(self).

convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'labelstring'#

the descriptive name of this type

class aiida.cmdline.params.types.strings.NonEmptyStringParamType[source]#

Bases: StringParamType

Parameter whose values have to be string and non-empty.

__annotations__ = {}#
__module__ = 'aiida.cmdline.params.types.strings'#
__repr__()[source]#

Return repr(self).

__slotnames__ = []#
convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'nonemptystring'#

the descriptive name of this type

User param type for click.

class aiida.cmdline.params.types.user.UserParamType(create=False)[source]#

Bases: ParamType

The user parameter type for click. Can get or create a user.

__annotations__ = {}#
__init__(create=False)[source]#
Parameters:

create – If the user does not exist, create a new instance (unstored).

__module__ = 'aiida.cmdline.params.types.user'#
convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

name: str = 'user'#

the descriptive name of this type

shell_complete(ctx, param, incomplete)[source]#

Return possible completions based on an incomplete value

Returns:

list of tuples of valid entry points (matching incomplete) and a description

Module for the workflow parameter type

class aiida.cmdline.params.types.workflow.WorkflowParamType(sub_classes: tuple[str, ...] | None = None)[source]#

Bases: IdentifierParamType

The ParamType for identifying WorkflowNode entities or its subclasses

__abstractmethods__ = frozenset({})#
__annotations__ = {'_sub_classes': 'tuple | None', 'arity': 't.ClassVar[int]', 'envvar_list_splitter': 't.ClassVar[t.Optional[str]]', 'is_composite': 't.ClassVar[bool]', 'name': 'str'}#
__module__ = 'aiida.cmdline.params.types.workflow'#
_abc_impl = <_abc._abc_data object>#
name: str = 'WorkflowNode'#

the descriptive name of this type

property orm_class_loader#

Return the orm entity loader class, which should be a subclass of OrmEntityLoader. This class is supposed to be used to load the entity for a given identifier

Returns:

the orm entity loader class for this ParamType