Skip to content

LocalExecutionEnvironmentConfig

Base classes

Name Children Inherits
BaseExecutionEnvironmentConfig
exxec_config.configs
Base execution environment configuration.

⋔ Inheritance diagram

graph TD
  2805129396["configs.LocalExecutionEnvironmentConfig"]
  2844377061["configs.BaseExecutionEnvironmentConfig"]
  330168112["schema.Schema"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  2844377061 --> 2805129396
  330168112 --> 2844377061
  3879467795 --> 330168112
  2751680898 --> 3879467795

🛈 DocStrings

Bases: BaseExecutionEnvironmentConfig

Local execution environment configuration.

Executes code in the same process. Fastest option but offers no isolation.

Source code in src/exxec_config/configs.py
class LocalExecutionEnvironmentConfig(BaseExecutionEnvironmentConfig):
    """Local execution environment configuration.

    Executes code in the same process. Fastest option but offers no isolation.
    """

    model_config = ConfigDict(json_schema_extra={"x-doc-title": "Local Execution Environment"})

    type: Literal["local"] = Field("local", init=False)

    executable: str | None = Field(
        default=None,
        title="Python Executable",
        examples=["/usr/bin/python3", "python3.13", "/opt/conda/bin/python"],
    )
    """Python executable to use (if None, auto-detect based on language)."""

    language: Language = Field(
        default="python",
        title="Programming Language",
        examples=["python", "javascript", "typescript"],
    )
    """Programming language to use."""

    isolated: bool = Field(default=False, title="Isolated Execution")
    """Whether to run code in a subprocess."""

    root_path: str | None = Field(
        default=None,
        title="Root path",
        examples=["/app", "/home/user"],
    )
    """Path to become the root of the filesystem."""

    def get_provider(
        self, lifespan_handler: AbstractAsyncContextManager[ServerInfo] | None = None
    ) -> LocalExecutionEnvironment:
        """Create local execution environment instance."""
        from exxec.local_provider import LocalExecutionEnvironment

        return LocalExecutionEnvironment(
            lifespan_handler=lifespan_handler,
            dependencies=self.dependencies,
            default_command_timeout=self.default_command_timeout,
            isolated=self.isolated,
            executable=self.executable,
            language=self.language,
            root_path=self.root_path,
            cwd=self.cwd,
            env_vars=self.env_vars,
            inherit_env=self.inherit_env,
        )

executable class-attribute instance-attribute

executable: str | None = Field(
    default=None,
    title="Python Executable",
    examples=["/usr/bin/python3", "python3.13", "/opt/conda/bin/python"],
)

Python executable to use (if None, auto-detect based on language).

isolated class-attribute instance-attribute

isolated: bool = Field(default=False, title='Isolated Execution')

Whether to run code in a subprocess.

language class-attribute instance-attribute

language: Language = Field(
    default="python", title="Programming Language", examples=["python", "javascript", "typescript"]
)

Programming language to use.

root_path class-attribute instance-attribute

root_path: str | None = Field(default=None, title='Root path', examples=['/app', '/home/user'])

Path to become the root of the filesystem.

get_provider

get_provider(
    lifespan_handler: AbstractAsyncContextManager[ServerInfo] | None = None,
) -> LocalExecutionEnvironment

Create local execution environment instance.

Source code in src/exxec_config/configs.py
def get_provider(
    self, lifespan_handler: AbstractAsyncContextManager[ServerInfo] | None = None
) -> LocalExecutionEnvironment:
    """Create local execution environment instance."""
    from exxec.local_provider import LocalExecutionEnvironment

    return LocalExecutionEnvironment(
        lifespan_handler=lifespan_handler,
        dependencies=self.dependencies,
        default_command_timeout=self.default_command_timeout,
        isolated=self.isolated,
        executable=self.executable,
        language=self.language,
        root_path=self.root_path,
        cwd=self.cwd,
        env_vars=self.env_vars,
        inherit_env=self.inherit_env,
    )

:fa-brands-github: Show source on GitHub