Initializing help system before first use

Configuration with Annotations

Python type annotations (also referred to as type hints) provide a way of including metadata information about the type of the model entities. This metadata is used to configure the way in which the model entities are handled by the system.

Type annotations are simply metadata expressed in the model source file. That metadata is extracted during the compilation step and stored in a binary model file after compilation.

Declaring Entities with the Help of Type Annotations

In the Python source file, the type of the entities must be declared by using a type annotation:
TotalReturn: xi.Scalar(dtype=xi.real, alias="Total expected return on investment", manage=xi.Manage.RESULT)
Among other things, Insight type annotations give you the potential to define aliases for model entities, so that they are presented in the user interface using their alias names, rather than their original entity names. For example, placing the following annotation prior to the MaxPerShare declaration in the example:
MaxPerShare: xi.Scalar(default=0.25, alias="Maximum investment per share")

sets an alias name that will be used in place of the entity name throughout the user interface.

Entity Role Annotation

Annotations can also inform the system if an entity is an input or a result. Xpress Insight defaults to assuming that declared entities are input entities. Result entities need to be marked explicitly as results.

The following snippet annotates the SummaryIds entity as a result using the xi.Manage annotation parameter:
SummaryIds: xi.Index(dtype=xi.string, alias="Summary", manage=xi.Manage.RESULT)

Annotation Reference

See the Xpress Insight Python Interface Reference Manual for further detailed information about the many available Insight type annotations.