Skip to content

strategy

dev_tool.services.execution.strategy

ExecutionStrategy

Bases: ABC

An abstract base class defining the interface for execution strategies.

This class allows swapping between containerized and local execution without scattering conditionals throughout the codebase.

cleanup abstractmethod

A method that performs any necessary cleanup.

Source code in dev_tool/services/execution/strategy.py
@abstractmethod
def cleanup(self) -> None:
    """A method that performs any necessary cleanup."""

ensure_database abstractmethod

A method that ensures the database is available.

Parameters:

  • recreate (bool, default: False ) –

    Whether to recreate the database container.

Source code in dev_tool/services/execution/strategy.py
@abstractmethod
def ensure_database(self, recreate: bool = False) -> None:
    """
    A method that ensures the database is available.

    :param recreate: Whether to recreate the database container.
    """

run_bun_command abstractmethod

A method that executes a Bun command.

Parameters:

  • args (list[str]) –

    The command arguments.

  • kwargs (Any, default: {} ) –

    Additional subprocess arguments.

Returns:

Source code in dev_tool/services/execution/strategy.py
@abstractmethod
def run_bun_command(self, args: list[str], **kwargs: Any) -> subprocess.CompletedProcess:
    """
    A method that executes a Bun command.

    :param args: The command arguments.
    :param kwargs: Additional subprocess arguments.
    :return: The completed process result.
    """

run_django_command abstractmethod

A method that executes a Django management command.

Parameters:

  • args (list[str]) –

    The command arguments.

  • kwargs (Any, default: {} ) –

    Additional subprocess arguments.

Returns:

Source code in dev_tool/services/execution/strategy.py
@abstractmethod
def run_django_command(self, args: list[str], **kwargs: Any) -> subprocess.CompletedProcess:
    """
    A method that executes a Django management command.

    :param args: The command arguments.
    :param kwargs: Additional subprocess arguments.
    :return: The completed process result.
    """

run_pip_command abstractmethod

A method that executes a pip command.

Parameters:

  • args (list[str]) –

    The command arguments.

  • kwargs (Any, default: {} ) –

    Additional subprocess arguments.

Returns:

Source code in dev_tool/services/execution/strategy.py
@abstractmethod
def run_pip_command(self, args: list[str], **kwargs: Any) -> subprocess.CompletedProcess:
    """
    A method that executes a pip command.

    :param args: The command arguments.
    :param kwargs: Additional subprocess arguments.
    :return: The completed process result.
    """

run_python_command abstractmethod

A method that executes a Python command.

Parameters:

  • args (list[str]) –

    The command arguments.

  • kwargs (Any, default: {} ) –

    Additional subprocess arguments.

Returns:

Source code in dev_tool/services/execution/strategy.py
@abstractmethod
def run_python_command(self, args: list[str], **kwargs: Any) -> subprocess.CompletedProcess:
    """
    A method that executes a Python command.

    :param args: The command arguments.
    :param kwargs: Additional subprocess arguments.
    :return: The completed process result.
    """

run_seed abstractmethod

A method that runs the database seeding script.

Parameters:

  • seed_script (Path) –

    The path to the seed script.

Source code in dev_tool/services/execution/strategy.py
@abstractmethod
def run_seed(self, seed_script: Path) -> None:
    """
    A method that runs the database seeding script.

    :param seed_script: The path to the seed script.
    """

run_server abstractmethod

A method that starts the Django development server.

Parameters:

  • ip_address (str) –

    The IP address to bind to.

  • port (int) –

    The port number to bind to.

Source code in dev_tool/services/execution/strategy.py
@abstractmethod
def run_server(self, ip_address: str, port: int) -> None:
    """
    A method that starts the Django development server.

    :param ip_address: The IP address to bind to.
    :param port: The port number to bind to.
    """

run_shell_script abstractmethod

A method that executes a Django shell script.

Parameters:

  • script (str) –

    The Python script to execute in Django shell.

  • kwargs (Any, default: {} ) –

    Additional subprocess arguments.

Returns:

Source code in dev_tool/services/execution/strategy.py
@abstractmethod
def run_shell_script(self, script: str, **kwargs: Any) -> subprocess.CompletedProcess:
    """
    A method that executes a Django shell script.

    :param script: The Python script to execute in Django shell.
    :param kwargs: Additional subprocess arguments.
    :return: The completed process result.
    """