Bootstrap Plugin API Reference¶
Application bootstrap and validation plugin for Structum Lab.
Structum Bootstrap (structum-bootstrap)¶
Structum Bootstrap provides “Fail Fast” mechanisms to validate the execution environment (filesystem, network, environment variables) at application startup.
🚀 Installation¶
pip install structum-bootstrap
📚 Full Documentation¶
Documentation, API Reference, and Guides: 👉 https://structum.pages.dev/plugins/bootstrap
✨ Key Features¶
Fail Fast: Halts startup if critical requirements are not met.
Modular Validators: Checks for Files, Directories, Network Ports, URLs, and Env Vars.
Extensible: Simple API to create custom validators.
Bootstrap Plugin Package¶
Structum Bootstrap Plugin. Provides enterprise-grade validation and system checks.
- class structum_lab.plugins.bootstrap.SystemBootstrapper[source]¶
Bases:
objectOrchestrates the system validation process.
- add_validator(validator: Validator) SystemBootstrapper[source]¶
Add a validator to the bootstrap sequence.
- run() BootstrapContextImpl[source]¶
Run all validators and return the context.
- structum_lab.plugins.bootstrap.BootstrapContext¶
alias of
BootstrapContextImpl
-
class structum_lab.plugins.bootstrap.PythonVersionValidator(min_version: tuple[Any, ...] =
(3, 9))[source]¶ Bases:
objectValidates Python version.
-
__init__(min_version: tuple[Any, ...] =
(3, 9))[source]¶ Initialize the validator.
- validate(context: ValidationContext) None[source]¶
Validate Python version meets minimum requirement.
-
__init__(min_version: tuple[Any, ...] =
- class structum_lab.plugins.bootstrap.EnvVarValidator(required: list[str])[source]¶
Bases:
objectValidates presence of environment variables.
- validate(context: ValidationContext) None[source]¶
Validate that all required environment variables are set.
- class structum_lab.plugins.bootstrap.DirectoryValidator(paths: list[str])[source]¶
Bases:
objectValidates critical directories exist and are writable.
- validate(context: ValidationContext) None[source]¶
Validate that directories exist and are writable.
- class structum_lab.plugins.bootstrap.ConfigValidator[source]¶
Bases:
objectValidates that Structum configuration loads correctly.
- validate(context: ValidationContext) None[source]¶
Validate that Structum configuration loads correctly.
- Parameters:¶
- context: ValidationContext¶
Validation context for recording results.
Core Bootstrap¶
Core implementation of the bootstrap validation context.
This module provides the concrete implementation of the ValidationContext protocol, used to collect and report validation results during bootstrap.
- class structum_lab.plugins.bootstrap.core.BootstrapContextImpl[source]¶
Bases:
objectImplementation of ValidationContext.
Bootstrap Manager¶
System bootstrapper orchestration.
This module provides the SystemBootstrapper class, which orchestrates the execution of multiple validators during application startup.
- class structum_lab.plugins.bootstrap.manager.SystemBootstrapper[source]¶
Bases:
objectOrchestrates the system validation process.
- add_validator(validator: Validator) SystemBootstrapper[source]¶
Add a validator to the bootstrap sequence.
- run() BootstrapContextImpl[source]¶
Run all validators and return the context.
Validators¶
Built-in validators for system bootstrap.
This module provides common validation checks that can be used during application startup to ensure the runtime environment is correctly configured.
Example
>>> from structum_lab.plugins.bootstrap import SystemBootstrapper
>>> from structum_lab.plugins.bootstrap.validators import PythonVersionValidator
>>>
>>> boot = SystemBootstrapper()
>>> boot.add_validator(PythonVersionValidator(min_version=(3, 11)))
>>> boot.run_or_exit()
-
class structum_lab.plugins.bootstrap.validators.PythonVersionValidator(min_version: tuple[Any, ...] =
(3, 9))[source]¶ Bases:
objectValidates Python version.
-
__init__(min_version: tuple[Any, ...] =
(3, 9))[source]¶ Initialize the validator.
- validate(context: ValidationContext) None[source]¶
Validate Python version meets minimum requirement.
-
__init__(min_version: tuple[Any, ...] =
- class structum_lab.plugins.bootstrap.validators.EnvVarValidator(required: list[str])[source]¶
Bases:
objectValidates presence of environment variables.
- validate(context: ValidationContext) None[source]¶
Validate that all required environment variables are set.
- class structum_lab.plugins.bootstrap.validators.DirectoryValidator(paths: list[str])[source]¶
Bases:
objectValidates critical directories exist and are writable.
- validate(context: ValidationContext) None[source]¶
Validate that directories exist and are writable.
- class structum_lab.plugins.bootstrap.validators.ConfigValidator[source]¶
Bases:
objectValidates that Structum configuration loads correctly.
- validate(context: ValidationContext) None[source]¶
Validate that Structum configuration loads correctly.
- Parameters:¶
- context: ValidationContext¶
Validation context for recording results.