CONVERSION REFERENCE

Calls, modules, and bundles

Calls and imports resolve only against explicit, authenticated source documents in the conversion request.

Source bundles

The source universe is an explicit in-memory SourceBundle of 1–64 documents. One document is primary and companions are ordered. PyCForge does not scan a directory, inspect the host import path, discover packages, or read an import target from the host.

Blank modules. A deliberately added module that remains empty is invalid because it contributes no C translation unit. The workspace itself may contain zero documents. Its first opened or newly created module becomes primary automatically, without a synthetic or permanent main.py tab.

Direct function calls

Eligible source functions may call other eligible functions by an exactly resolved direct name. Supported binding forms are:

def combine(left: int, *, right: int) -> int:
    return left + right

def use(value: int) -> int:
    return combine(value, right=2)

Arguments are evaluated once in source order, then arranged in formal parameter order for C. Names, arity, annotations, static categories, positional-only rules, and duplicate or collision rules are checked exactly.

Defaults, defaulted keyword-only parameters, *args, **kwargs, argument unpacking, unknown or duplicate keywords, positional/keyword collisions, methods, callable values, dynamic targets, and direct or mutual recursion reject.

Explicit cross-module imports

Only absolute, top-level from module_id import function declarations resolve, and only against documents already present in the bundle. Unambiguous aliases are supported.

# math_tools.py  (module id: math_tools)
def double(value: int) -> int:
    return value * 2

# main.py  (module id: main)
from math_tools import double

def run(value: int) -> int:
    return double(value)

Imports precede every function. The target module and function must exist, imports must not collide or rebind, and the dependency graph must admit deterministic dependency-first ordering.

Plain import, relative, star, local, or conditional imports; host discovery; dynamic import APIs; imported record construction; module state; ambiguous names; missing bundle targets; and cyclic dependencies reject.

Generated output

A successful bundle produces one deterministic C artifact governed by the same result and fingerprint contract as a single document. Module ordering and resolved dependencies are recorded in structured artifacts for review.