gyoza.deployment#
Gyoza deployment module — build and deploy gyoza operations.
- gyoza.deployment.build(project_path)[source]#
Run
docker compose buildfor a gyoza project.Reads
gyoza.ymlfrom project_path, writes a temporarydocker-compose.ymlcarrying thebuildsection verbatim, and invokesdocker compose build.- Parameters:
project_path (
Path | str) – Directory containinggyoza.ymland the build context.- Returns:
Result of the
docker compose buildinvocation.- Return type:
subprocess.CompletedProcess[str]- Raises:
FileNotFoundError – If
gyoza.ymlis missing.ValueError – If the config is invalid.
subprocess.CalledProcessError – If
docker compose buildexits with a non-zero code.
- gyoza.deployment.deploy(project_path, *, on_step=None)[source]#
Execute the full deployment pipeline for a gyoza operation.
Steps executed in order:
Build the Docker image via
docker compose build.Push the image to the container registry.
Load the OpDefinition from the YAML config and Python IO file.
Upsert the OpDefinition on the gyoza server.
- Parameters:
project_path (
Path | str) – Directory containinggyoza.ymland 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:
FileNotFoundError – If required files are missing.
ValueError – If configuration is invalid or env vars are unset.
subprocess.CalledProcessError – If Docker build or push fails.
httpx.HTTPStatusError – If the server upsert call fails.
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.ymlnorgyoza.yamlexists.
- 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 buildfor a gyoza project.Reads
gyoza.ymlfrom project_path, writes a temporarydocker-compose.ymlcarrying thebuildsection verbatim, and invokesdocker compose build.- Parameters:
project_path (
Path | str) – Directory containinggyoza.ymland the build context.- Returns:
Result of the
docker compose buildinvocation.- Return type:
subprocess.CompletedProcess[str]- Raises:
FileNotFoundError – If
gyoza.ymlis missing.ValueError – If the config is invalid.
subprocess.CalledProcessError – If
docker compose buildexits with a non-zero code.
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:
Build the Docker image via
docker compose build.Push the image to the container registry.
Load the OpDefinition from the YAML config and Python IO file.
Upsert the OpDefinition on the gyoza server.
- Parameters:
project_path (
Path | str) – Directory containinggyoza.ymland 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:
FileNotFoundError – If required files are missing.
ValueError – If configuration is invalid or env vars are unset.
subprocess.CalledProcessError – If Docker build or push fails.
httpx.HTTPStatusError – If the server upsert call fails.
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:
A function decorated with
@gyoza_op(...)to discover theinput_modelandoutput_modelclass names.Class definitions that inherit from
BaseModelwhose 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.pyfile containing the decorated function and model definitions.- Returns:
Extracted input and output specifications.
- Return type:
tuple[InputSpecs,OutputSpecs]- Raises:
FileNotFoundError – If the file does not exist.
ValueError – If the file cannot be parsed or required elements are missing.