Infer a normalized generation model from OpenAPI and apply bundled or project-owned Jinja template packs.
python -m pip install codepotgOn this page
Performance, JSONL, and memory tracing
CodepotG has separate input paths for JSON and YAML.
JSON input
JSON is streamed into an indexed JSONL cache. Later stages can retrieve source records lazily rather than holding multiple complete decoded copies.
The cache is visible under .codepotg/cache so reuse and invalidation can be inspected.
YAML input
YAML must first be parsed. CodepotG writes a canonical JSON conversion incrementally and persists it as:
An unchanged YAML file reuses that conversion without parsing YAML again.
For very large contracts, JSON is the preferred source format.
Build or inspect JSONL
Use the JSONL command to compile a visible indexed cache and inspect source-index behavior independently from full generation.
Profile a pipeline
From packages/python/codepotg:
Profile stages
Metrics
rss_peak never decreases. Python and the system allocator may retain freed arenas, so current RSS does not always return to startup levels.
A likely retained-object issue is indicated when both traced Python memory and private memory remain near their peaks after released, or repeated runs continue growing instead of stabilizing.
Trace normal generation
1records process metrics with lower overhead.fullenablestracemallocand should be used for diagnosis.
Write JSONL snapshots:
Memory summaries are included in diagnostics while tracing is enabled.
Template performance
- Prefer graph selections over repeated global scans.
- Declare providers and dependencies explicitly.
- Avoid copying
api.rawinto derived contexts. - Use grouped emissions for intentional aggregation.
- Keep barrel planning based on emission facts, not filesystem scans.
- Avoid quadratic Jinja loops over large global collections.
Cache behavior
Use --refresh for project cleanup, not as a general source-cache invalidation flag. Source caches use content and metadata checks and should be reused when inputs are unchanged.
Fixture strategy
The package test suite separates production-scale streaming fixtures from small targeted unit fixtures. Custom pack tests should follow the same principle: one representative full contract plus focused edge cases.