gyoza.deployment#

Gyoza deployment module — build and deploy gyoza operations.

gyoza.deployment.build(project_path)[source]#

Run docker compose build for a gyoza project.

Reads gyoza.yml from project_path, writes a temporary docker-compose.yml carrying the build section verbatim, and invokes docker compose build.

Parameters:

project_path (Path | str) – Directory containing gyoza.yml and the build context.

Returns:

Result of the docker compose build invocation.

Return type:

subprocess.CompletedProcess[str]

Raises:
gyoza.deployment.deploy(project_path, *, on_step=None)[source]#

Execute the full deployment pipeline for a gyoza operation.

Steps executed in order:

  1. Build the Docker image via docker compose build.

  2. Push the image to the container registry.

  3. Load the OpDefinition from the YAML config and Python IO file.

  4. Upsert the OpDefinition on the gyoza server.

Parameters:
  • project_path (Path | str) – Directory containing gyoza.yml and the operation source files.

  • on_step (StepCallback | None) – Optional callback invoked with a human-readable message at each pipeline step.

Returns:

Server response from the upsert operation.

Return type:

dict[str, Any]

Raises:

Gyoza project config loading utilities.

gyoza.deployment.config.find_config(project_path)[source]#

Locate the gyoza config file in a project directory.

Parameters:

project_path (Path) – Root directory to search.

Returns:

Resolved path to the config file.

Return type:

Path

Raises:

FileNotFoundError – If neither gyoza.yml nor gyoza.yaml exists.

gyoza.deployment.config.load_config(project_path)[source]#

Read and parse the gyoza config from a project directory.

Parameters:

project_path (Path) – Root directory containing the gyoza config.

Returns:

Parsed YAML configuration.

Return type:

dict[str, Any]

Raises:

FileNotFoundError – If the config file is not found.

Docker build logic driven by a gyoza.yml configuration.

Generates a temporary docker-compose.yml from the gyoza config and delegates to docker compose build.

gyoza.deployment.builder.build(project_path)[source]#

Run docker compose build for a gyoza project.

Reads gyoza.yml from project_path, writes a temporary docker-compose.yml carrying the build section verbatim, and invokes docker compose build.

Parameters:

project_path (Path | str) – Directory containing gyoza.yml and the build context.

Returns:

Result of the docker compose build invocation.

Return type:

subprocess.CompletedProcess[str]

Raises:

Full deployment pipeline for gyoza operations.

Orchestrates: build image → push image → load OpDefinition → upsert on server.

gyoza.deployment.deployer.deploy(project_path, *, on_step=None)[source]#

Execute the full deployment pipeline for a gyoza operation.

Steps executed in order:

  1. Build the Docker image via docker compose build.

  2. Push the image to the container registry.

  3. Load the OpDefinition from the YAML config and Python IO file.

  4. Upsert the OpDefinition on the gyoza server.

Parameters:
  • project_path (Path | str) – Directory containing gyoza.yml and the operation source files.

  • on_step (StepCallback | None) – Optional callback invoked with a human-readable message at each pipeline step.

Returns:

Server response from the upsert operation.

Return type:

dict[str, Any]

Raises:

AST-based extractor for input/output specs from Python source files.

Parses a .py file using only the standard-library ast module so that it works without any third-party dependencies installed (e.g. in CI environments that lack pydantic, torch, etc.).

The extractor looks for:

  1. A function decorated with @gyoza_op(...) to discover the input_model and output_model class names.

  2. Class definitions that inherit from BaseModel whose names match the discovered model names, extracting their annotated fields.

gyoza.deployment.io_extractor.extract_io_specs(io_file_path)[source]#

Extract input and output specs from a Python file via AST analysis.

Reads the file as text, parses it with ast.parse, then locates the @gyoza_op(input_model=..., output_model=...) decorator and the corresponding Pydantic model classes to build the specs.

This function requires no third-party imports at parse time.

Parameters:

io_file_path (Path | str) – Path to the .py file containing the decorated function and model definitions.

Returns:

Extracted input and output specifications.

Return type:

tuple[InputSpecs, OutputSpecs]

Raises: