# rye:signed:2026-04-01T04:10:51Z:cc209aced3f2c7ae243cbd020c7c4142c734dbfe04393dcfc02fa6079ab281e4:DrV8W2xUPehsHGNJgiE9tpdBNhguDhLAVxikUHx6brDhMAYx_Z95x3Y0FuNqydkSOu2k5NfPsFXbmAo7feFpBQ:6ea18199041a1ea8
version: "1.0.0"
tool_type: runtime
executor_id: rye/core/primitives/subprocess
category: rye/core/runtimes/python
description: "Python function runtime - calls execute(params, project_path) and serializes result to stdout"

env_config:
  interpreter:
    type: local_binary
    binary: python
    candidates: [python3]
    search_paths: [".venv/bin", ".venv/Scripts"]
    var: RYE_PYTHON
    fallback: python3
  env:
    PYTHONUNBUFFERED: "1"
    PROJECT_VENV_PYTHON: "${RYE_PYTHON}"

anchor:
  enabled: true
  mode: auto
  markers_any: ["__init__.py", "pyproject.toml"]
  root: tool_dir
  lib: lib
  env_paths:
    PYTHONPATH:
      prepend: ["{anchor_path}", "{runtime_lib}"]

verify_deps:
  enabled: true
  scope: anchor
  recursive: true
  extensions: [".py", ".yaml", ".yml", ".json"]
  exclude_dirs: ["__pycache__", ".venv", "node_modules", ".git", "config"]

config:
  command: "${RYE_PYTHON}"
  args:
    - "-c"
    - |
      import sys,json,importlib.util,inspect,asyncio
      spec=importlib.util.spec_from_file_location("tool",sys.argv[1])
      mod=importlib.util.module_from_spec(spec)
      spec.loader.exec_module(mod)
      fn=getattr(mod,"execute",None)
      if not fn:sys.exit("No execute() in "+sys.argv[1])
      p=json.loads(sys.stdin.read())
      if inspect.iscoroutinefunction(fn):r=asyncio.run(fn(p,sys.argv[2]))
      else:r=fn(p,sys.argv[2])
      print(json.dumps(r,default=str)if r is not None else'{}')
    - "{tool_path}"
    - "{project_path}"
  input_data: "{params_json}"
  timeout: 300

config_schema:
  type: object
  properties:
    script:
      type: string
      description: Python module with execute(params, project_path) function
