Functions
get_max_workers
Resolve max_workers with auto-detection.
get_max_workers
def get_max_workers(config_value: int | None = None) -> int
Resolve max_workers with auto-detection.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
config_value |
int | None |
None |
User-configured value from site.config.get("max_workers") - None or 0 = auto-detect based on CPU count - Positive int = use that value |
Returns
Resolved worker count (always >= 1)int
—
get_default
Get default value for a config key.
get_default
def get_default(key: str, nested_key: str | None = None) -> Any
Get default value for a config key.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
key |
str |
— | Top-level config key (e.g., "max_workers", "theme") |
nested_key |
str | None |
None |
Optional nested key using dot notation (e.g., "lunr.prebuilt") |
Returns
Default value, or None if key not foundAny
—
get_pagination_per_page
Resolve pagination per_page with default.
get_pagination_per_page
def get_pagination_per_page(config_value: int | None = None) -> int
Resolve pagination per_page with default.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
config_value |
int | None |
None |
User-configured value |
Returns
Items per page (default: 10, minimum: 1)int
—
normalize_bool_or_dict
Normalize config values that can be bool or dict.
This standardizes handling of config keys like `…
normalize_bool_or_dict
def normalize_bool_or_dict(value: bool | dict[str, Any] | None, key: str, default_enabled: bool = True) -> dict[str, Any]
Normalize config values that can be bool or dict.
This standardizes handling of config keys likehealth_check,search,
graph, etc. that accept both:
key: false(bool to disable)key: { enabled: true, ... }(dict with options)
Parameters 3
| Name | Type | Default | Description |
|---|---|---|---|
value |
bool | dict[str, Any] | None |
— | The config value (bool, dict, or None) |
key |
str |
— | The config key name (for defaults lookup) |
default_enabled |
bool |
True |
Whether the feature is enabled by default |
Returns
Normalized dict with 'enabled' key and any other optionsdict[str, Any]
—
is_feature_enabled
Check if a bool/dict config feature is enabled.
Convenience function for quick enable/disable chec…
is_feature_enabled
def is_feature_enabled(config: dict[str, Any], key: str, default: bool = True) -> bool
Check if a bool/dict config feature is enabled.
Convenience function for quick enable/disable checks without needing the full normalized dict.
Parameters 3
| Name | Type | Default | Description |
|---|---|---|---|
config |
dict[str, Any] |
— | The site config dictionary |
key |
str |
— | The config key to check (e.g., "health_check", "search") |
default |
bool |
True |
Default value if key not present |
Returns
True if feature is enabled, False otherwisebool
—
get_feature_config
Get normalized config for a bool/dict feature.
This is the main entry point for accessing features…
get_feature_config
def get_feature_config(config: dict[str, Any], key: str, default_enabled: bool = True) -> dict[str, Any]
Get normalized config for a bool/dict feature.
This is the main entry point for accessing features that can be configured as either bool or dict.
Parameters 3
| Name | Type | Default | Description |
|---|---|---|---|
config |
dict[str, Any] |
— | The site config dictionary |
key |
str |
— | The config key (e.g., "health_check", "search", "graph") |
default_enabled |
bool |
True |
Whether the feature is enabled by default |
Returns
Normalized dict with 'enabled' key and feature optionsdict[str, Any]
—