From 17ac7d9b77c42c0d773030fa2702199275bb5dd8 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 24 Feb 2024 08:52:37 +0000 Subject: [PATCH] [docs] Add type annotations for the environment variables in docs (backport #5492) (#5497) [docs] Add type annotations for the environment variables in docs (#5492) * [docs] Add type annotations for the environment variables in docs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> (cherry picked from commit 742d3891a01d054856fd4ff80377e4323a7c9bfe) Co-authored-by: Hailin Wang --- docs/source/envvars.md | 52 +++++++++++++++++++ .../user/python/use-scripts/interact.md | 3 +- src/abqpy/config.py | 2 + 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/docs/source/envvars.md b/docs/source/envvars.md index 9c82b31add..aa16679acf 100644 --- a/docs/source/envvars.md +++ b/docs/source/envvars.md @@ -3,12 +3,18 @@ The following environment variables can be used to configure the package. ```{envvar} ABAQUS_BAT_PATH + +**Type: string** + The file path of the `abaqus` command line batch file (`.bat`). Only set this environment variable if `abaqus` is not the default Abaqus command line executable. This variable is used by `abqpy` to run the Abaqus command line procedure inside the Python interpreter environment where it is installed. ``` ````{envvar} ABAQUS_COMMAND_OPTIONS + +**Type: string of a Python dictionary** + The default execution procedure invoked by `abqpy` inside the Python interpreter environment where it is installed is to run one of the two following command lines: @@ -72,54 +78,100 @@ boolean option to `True` and any other values to set it to `False`. ```` ```{envvar} ABAQUS_CAE_DATABASE + +**Type: string** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `database` option but has higher priority. ``` ```{envvar} ABAQUS_CAE_REPLAY + +**Type: string** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `replay` option but has higher priority. ``` ```{envvar} ABAQUS_CAE_RECOVER + +**Type: string** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `recover` option but has higher priority. ``` +```{envvar} ABAQUS_CAE_STARTUP + +**Type: string** + +A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `startup` option but has higher priority. +``` + ```{envvar} ABAQUS_CAE_GUI + +**Type: bool {true, false, on, off, yes, no, 1, 0}** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `gui` option but has higher priority. ``` ```{envvar} ABAQUS_CAE_ENVSTARTUP + +**Type: bool {true, false, on, off, yes, no, 1, 0}** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `envstartup` option but has higher priority. ``` ```{envvar} ABAQUS_CAE_SAVED_OPTIONS + +**Type: bool {true, false, on, off, yes, no, 1, 0}** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `savedOptions` option but has higher priority. ``` ```{envvar} ABAQUS_CAE_SAVED_GUI_PREFS + +**Type: bool {true, false, on, off, yes, no, 1, 0}** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `savedGuiPrefs` option but has higher priority. ``` ```{envvar} ABAQUS_CAE_STARTUP_DIALOG + +**Type: bool {true, false, on, off, yes, no, 1, 0}** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `startupDialog` option but has higher priority. ``` ```{envvar} ABAQUS_CAE_CUSTOM + +**Type: string** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `custom` option but has higher priority. ``` ```{envvar} ABAQUS_CAE_GUI_TESTER + +**Type: string** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `guiTester` option but has higher priority. ``` ```{envvar} ABAQUS_CAE_GUI_RECORD + +**Type: bool {true, false, on, off, yes, no, 1, 0}** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `guiRecord` option but has higher priority. ``` ```{envvar} ABAQUS_PYTHON_SIM + +**Type: string** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `sim` option but has higher priority. ``` ```{envvar} ABAQUS_PYTHON_LOG + +**Type: string** + A shortcut to the {envvar}`ABAQUS_COMMAND_OPTIONS` environment variable to set the `log` option but has higher priority. ``` diff --git a/docs/source/user/python/use-scripts/interact.md b/docs/source/user/python/use-scripts/interact.md index 8aa3d16c6c..3ab7d91704 100644 --- a/docs/source/user/python/use-scripts/interact.md +++ b/docs/source/user/python/use-scripts/interact.md @@ -18,8 +18,7 @@ These arguments allow you to associate the callback function with both a particu The interface definition of the callback function is ```python -def functionName(jobName, messageType, data, userData): - ... +def functionName(jobName, messageType, data, userData): ... ``` The arguments to the callback function are: diff --git a/src/abqpy/config.py b/src/abqpy/config.py index dddaff398d..004ff30ff9 100644 --- a/src/abqpy/config.py +++ b/src/abqpy/config.py @@ -19,6 +19,7 @@ class AbaqusCAEConfig(CompatibleBaseModel): database: Optional[str] = None replay: Optional[str] = None recover: Optional[str] = None + startup: Optional[str] = None gui: bool = False envstartup: bool = True savedOptions: bool = True @@ -59,6 +60,7 @@ class AbaqusCommandOptions(AbaqusCAEConfig, AbaqusPythonConfig): database=os.environ["ABAQUS_CAE_DATABASE"] if "ABAQUS_CAE_DATABASE" in os.environ else options.database, replay=os.environ["ABAQUS_CAE_REPLAY"] if "ABAQUS_CAE_REPLAY" in os.environ else options.replay, recover=os.environ["ABAQUS_CAE_RECOVER"] if "ABAQUS_CAE_RECOVER" in os.environ else options.recover, + startup=os.environ["ABAQUS_CAE_STARTUP"] if "ABAQUS_CAE_STARTUP" in os.environ else options.startup, gui=os.environ["ABAQUS_CAE_GUI"].lower() in trues if "ABAQUS_CAE_GUI" in os.environ else options.gui, envstartup=( os.environ["ABAQUS_CAE_ENVSTARTUP"].lower() in trues