diff --git a/invokeai/app/services/config/config_default.py b/invokeai/app/services/config/config_default.py
index fddc5e5fac..5a17898bcb 100644
--- a/invokeai/app/services/config/config_default.py
+++ b/invokeai/app/services/config/config_default.py
@@ -7,7 +7,7 @@ import os
import re
from functools import lru_cache
from pathlib import Path
-from typing import Any, Literal, Optional, get_args, get_type_hints
+from typing import Any, Literal, Optional
import yaml
from pydantic import BaseModel, Field, PrivateAttr, field_validator
@@ -321,38 +321,6 @@ class InvokeAIAppConfig(BaseSettings):
return root
-def generate_config_docstrings() -> str:
- """Helper function for mkdocs. Generates a docstring for the InvokeAIAppConfig class.
-
- You shouldn't run this manually. Instead, run `scripts/update-config-docstring.py` to update the docstring.
- A makefile target is also available: `make update-config-docstring`.
-
- See that script for more information about why this is necessary.
- """
- docstring = ' """Invoke\'s global app configuration.\n\n'
- docstring += " Typically, you won't need to interact with this class directly. Instead, use the `get_config` function from `invokeai.app.services.config` to get a singleton config object.\n\n"
- docstring += " Attributes:\n"
-
- field_descriptions: list[str] = []
- type_hints = get_type_hints(InvokeAIAppConfig)
-
- for k, v in InvokeAIAppConfig.model_fields.items():
- if v.exclude:
- continue
- field_type = type_hints.get(k)
- extra = ""
- if getattr(field_type, "__origin__", None) is Literal:
- # Get options for literals - the docs generator can't pull these out
- options = [f"`{str(x)}`" for x in get_args(field_type)]
- extra = f"
Valid values: {', '.join(options)}"
- field_descriptions.append(f" {k}: {v.description}{extra}")
-
- docstring += "\n".join(field_descriptions)
- docstring += '\n """'
-
- return docstring
-
-
def migrate_v3_config_dict(config_dict: dict[str, Any]) -> InvokeAIAppConfig:
"""Migrate a v3 config dictionary to a current config object.
diff --git a/scripts/update_config_docstring.py b/scripts/update_config_docstring.py
index bf806a61af..99bef5f67f 100644
--- a/scripts/update_config_docstring.py
+++ b/scripts/update_config_docstring.py
@@ -1,4 +1,39 @@
import os
+from typing import Literal, get_args, get_type_hints
+
+from invokeai.app.services.config.config_default import InvokeAIAppConfig
+
+
+def generate_config_docstrings() -> str:
+ """Helper function for mkdocs. Generates a docstring for the InvokeAIAppConfig class.
+
+ You shouldn't run this manually. Instead, run `scripts/update-config-docstring.py` to update the docstring.
+ A makefile target is also available: `make update-config-docstring`.
+
+ See that script for more information about why this is necessary.
+ """
+ docstring = ' """Invoke\'s global app configuration.\n\n'
+ docstring += " Typically, you won't need to interact with this class directly. Instead, use the `get_config` function from `invokeai.app.services.config` to get a singleton config object.\n\n"
+ docstring += " Attributes:\n"
+
+ field_descriptions: list[str] = []
+ type_hints = get_type_hints(InvokeAIAppConfig)
+
+ for k, v in InvokeAIAppConfig.model_fields.items():
+ if v.exclude:
+ continue
+ field_type = type_hints.get(k)
+ extra = ""
+ if getattr(field_type, "__origin__", None) is Literal:
+ # Get options for literals - the docs generator can't pull these out
+ options = [f"`{str(x)}`" for x in get_args(field_type)]
+ extra = f"
Valid values: {', '.join(options)}"
+ field_descriptions.append(f" {k}: {v.description}{extra}")
+
+ docstring += "\n".join(field_descriptions)
+ docstring += '\n """'
+
+ return docstring
# The pydantic app config can be documented automatically using mkdocs, but this requires that the docstring
# for the class is kept up to date. We use a pydantic model for the app config. Each config setting is a field
@@ -14,7 +49,6 @@ def main():
# Change working directory to the repo root
os.chdir(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
- from invokeai.app.services.config.config_default import generate_config_docstrings
docstring = generate_config_docstrings()
diff --git a/tests/test_docs.py b/tests/test_docs.py
index ca83c18f58..33240d526a 100644
--- a/tests/test_docs.py
+++ b/tests/test_docs.py
@@ -1,4 +1,5 @@
-from invokeai.app.services.config.config_default import InvokeAIAppConfig, generate_config_docstrings
+from invokeai.app.services.config.config_default import InvokeAIAppConfig
+from scripts.update_config_docstring import generate_config_docstrings
def test_app_config_docstrings_are_current():