Kelp
kelp
¶
Top-level kelp package exports.
Expose a small ergonomic surface so callers can do:
import kelp
kelp.init(...)
We re-export a thin public API from :mod:kelp.api which delegates to
internal runtime implementations.
get_context
¶
Get kelp runtime context with auto-init by default.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init
|
bool
|
If True (default), auto-initialize from current directory when context doesn't exist yet. |
True
|
Returns:
| Type | Description |
|---|---|
|
MetaRuntimeContext for kelp. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If context doesn't exist and init=False. |
Source code in src/kelp/config/config.py
init
¶
init(
project_file_path=None,
target=None,
init_vars=None,
manifest_file_path=None,
refresh=False,
store_in_global=True,
run_policy_checks=False,
log_level=None,
)
Initialize kelp runtime context from current directory.
When manifest_file_path is provided (or resolved from KELP_MANIFEST_FILE
environment variable), the context is loaded directly from a pre-built
manifest JSON file, skipping all project discovery, Jinja rendering, and
metadata loading.
When policy_config.enabled is True in the project settings, metadata
governance policies are evaluated immediately after loading. Warn-severity
violations are logged; error-severity violations raise a RuntimeError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_file_path
|
str | None
|
Path to project file or directory. |
None
|
target
|
str | None
|
Target environment name. |
None
|
init_vars
|
dict[str, Any] | None
|
Runtime variable overrides. |
None
|
manifest_file_path
|
str | None
|
Path to a manifest JSON file. When provided, skips source file loading. Also resolved from KELP_MANIFEST_FILE env var. |
None
|
refresh
|
bool
|
If True, recreate context even if one already exists. |
False
|
store_in_global
|
bool
|
Whether to store context globally. |
True
|
run_policy_checks
|
bool
|
Whether to run policy checks. |
False
|
log_level
|
str | None
|
Optional log level to configure. |
None
|
Returns:
| Type | Description |
|---|---|
MetaRuntimeContext
|
The initialized MetaRuntimeContext. |