Initializing help system before first use

xpressinsight.create_app

Purpose
Prepare the environment for the test mode and return a new Insight app instance.
Synopsis
xpressinsight.create_app(app_type: Type[~AppBaseChild], base_dir: str = None, companion_file: str = None, app_work_dir: str = None, insight_work_dir: str = None) -> ~AppBaseChild
Arguments
app_type 
A subclass of xpressinsight.AppBase.
base_dir 
Path to application base directory (absolute or relative to current working directory). By default, it will be set to the parent directory of the source file that defines the app_type class.
companion_file 
Path to application companion XML file (absolute or relative to base_dir). By default, it will be set to the unique XML file that is located in the application base directory.
app_work_dir 
Absolute path to temporary application working directory. By default, it will be set to the subfolder "work_dir" in the application base directory.
insight_work_dir 
Absolute path to temporary Insight working directory. By default, it will be set to the subfolder "work_dir/xpressinsight" in the application base directory.
Return value
An instance of the Insight app, i.e., an instance of app_type.
Example
A typical use case for this function is the __main__ section of the application source file. At first we initialize the test mode environment for the app, then we call the load and run modes.
>>> import xpressinsight as xi
...
... @xi.AppConfig(name="Insight Python App")
... class MyApp(xi.AppBase):
...     @xi.ExecModeLoad()
...     def load(self):
...         print(self.insight.exec_mode, "mode ...")
...
...     @xi.ExecModeRun()
...     def run(self):
...         print(self.insight.exec_mode, "mode ...")
...
... if __name__ == "__main__":
...     app = xi.create_app(MyApp)
...     sys.exit(app.call_exec_modes(["LOAD", "RUN"]))			
Further information
1. WARNING: The function first deletes the temporary application working directory app_work_dir, if it exists, and then initializes a new one, by copying the model resources to the new directory. Then it deletes the temporary Insight working directory insight_work_dir, if it exists, and initializes a new one, by copying the attachments to the newly created folder structure.
2. The function also sets the working directory of the Python process to app_work_dir.
3. Throws an exception on failure: OSError or shutil.SameFileError if a file operation fails; ValueError or TypeError if input values are invalid.
Related topics

© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.