Skip to main content

data-product-forge-custom-scaffold

The custom-scaffold engine for data-product-forge. Install it alongside the CLI, plug in any scaffold bundle, and generate a complete project from your contract.

pip install data-product-forge data-product-forge-custom-scaffold

This pulls data-product-forge-sdk transitively (import path: fluid_sdk). Requires Python >=3.10.

Then in any fluid contract:

extensions:
  customScaffold:
    libraries:
      - id: ci
        source: { kind: git, url: "https://github.com/example/my-bundle", ref: "v1.0" }
    patterns:
      - use: ci:basic
fluid custom-scaffold
# ✓ 3 files written, 0 failed
#   README.md
#   .gitlab-ci.yml
#   docs/runbook.md

Deterministic, idempotent, atomic.


What this engine does

This is the runtime for data-product-forge's custom-scaffold feature:

  1. Discovers itself with the CLI via Python entry-points (just pip install).
  2. Resolves bundles from path (local), git (clone into cache), or entrypoint (installed Python plugin).
  3. Validates the extensions.customScaffold block in your contract.
  4. Renders each pattern through Jinja2.
  5. Writes the generated files atomically with path-traversal protection.
  6. Copies the bundle's static/ directory verbatim alongside rendered templates (for binary fixtures, sample data, pre-rendered files).

What's in the contract

extensions:
  customScaffold:
    libraries:
      - id: ci                                          # local alias
        source:
          kind: git                                     # path | git
          url: "https://github.com/example/ci-bundle"
          ref: "v1.0"
          subdir: "scaffold"                            # optional
          auth: { secret_ref: FLUID_SCAFFOLD_GITHUB_TOKEN }   # optional
    patterns:
      - use: ci:gitlab-ci                               # <library-id>:<pattern-name>
        variables:
          parentCiTemplateRef: "my-org/ci-templates@main"

Source kinds

Kind What it does When to use
path Reads a local directory. Relative paths anchor to the contract's directory. Bundle development; private monorepos that vendor bundles.
git git clone into the cache. Shared bundles distributed via a git repo.
entrypoint Loads a Python CustomScaffold subclass registered via fluid_build.custom_scaffolds entry-point. Bundles that need full programmatic control (external API calls, complex conditionals).

Auth via auth.secret_ref: the name of an environment variable (starting with FLUID_SCAFFOLD_) that holds a token. The operator, not the contract, decides where a token may go: list the hosts (host, or host:port for a port other than 443) in FLUID_CUSTOM_SCAFFOLD_AUTH_HOSTS. The token is never on a command line, in the cache or in the lock. See from-git-bundle.md.

Note: explicit npm and pypi source kinds (auto-fetch from registry) are not in v0. For pip-installable Python plugins, use kind: entrypoint after pip install-ing the plugin package. Git covers most YAML/Jinja distribution today. File an issue if you need direct-from-registry npm/pypi fetch.

Bundle authoring

Two paths — pick whichever fits:

A. YAML + Jinja bundle (no Python)

Drop a directory like this:

my-bundle/
├── fluid-scaffold.yaml         ← manifest
├── templates/
│   ├── README.md.j2            ← Jinja templates
│   └── .gitlab-ci.yml.j2
└── static/                      ← optional — copied verbatim
    └── docs/
        └── runbook.md

The engine's built-in TemplatedCustomScaffold reads the manifest, renders the templates, and copies static/ verbatim.

→ See docs/walkthrough/build-a-yaml-bundle.md for the step-by-step.

B. Python plugin bundle

Subclass fluid_sdk.CustomScaffold directly. Full programmatic control.

→ See the SDK walkthrough.

CLI surface

fluid custom-scaffold [OPTIONS]

  -c, --contract PATH    Path to contract.fluid.yaml (default: ./contract.fluid.yaml)
  -o, --output PATH      Output root (default: cwd)
      --dry-run          Plan only — print the file list, write nothing.
      --pattern USE      Restrict to specific patterns (repeatable)
      --lib ID           Restrict to specific library ids (repeatable)
      --pin              Reproducible re-run: resolve git sources to the commit
                         recorded in fluid-scaffold.lock (not the floating ref).
      --update           Update an existing output to the evolved template —
                         3-way merge that preserves your edits (see below).
      --target REF       With --update: the git ref/commit to update to.
      --json             Emit JSON instead of human output

Exit codes:

Code Meaning
0 success
1 bad CLI args / contract not found
2 engine error (resolution, plan, or apply failed)
3 at least one apply() action failed
4 --update completed with merge conflicts (markers written; resolve them)

Use it as a library

from data_product_forge_custom_scaffold import generate

result = generate(contract, "build/scaffold", contract_dir="path/to/contract")
for f in result.files:
    print(f.path, f.sha256, f.size)

generate() runs what fluid custom-scaffold runs and returns every file it wrote to the output directory as (relative path, sha256, size), sorted by path — so a host can record the written files in a manifest without parsing --json. A dry run (dry_run=True) writes nothing and returns the same rows; a path that would leave the output directory is refused before its pattern is applied; engine failures are typed (EngineError and subclasses). The command is a thin wrapper over it.

def generate(contract, out_dir, *, contract_dir=None, dry_run=False,
             pattern_filter=None, library_filter=None, pin=False,
             dialect=DEFAULT_DIALECT) -> GenerationResult

Full reference: docs/reference/library-api.md.

Reproducibility & updates

Every successful generation writes a fluid-scaffold.lock at the output root (commit it alongside the generated files). It records, per resolved library, the exact commit it resolved to, plus the patterns and variables used — the same model as copier's .copier-answers.yml.

# Generate — writes the output + fluid-scaffold.lock
fluid custom-scaffold -c contract.fluid.yaml -o ./my-project

# Reproducible re-run — resolve git sources to the LOCKED commit, not the
# moving ref. (npm-ci / poetry --frozen semantics; non-git sources can't be
# reproducibly pinned and the engine says so.)
fluid custom-scaffold -c contract.fluid.yaml -o ./my-project --pin

# Update — the template evolved? Re-render at the new ref and 3-way-merge it
# onto your working tree, preserving your edits. Non-overlapping changes merge
# cleanly; overlaps get Git-style conflict markers (exit 4).
fluid custom-scaffold -c contract.fluid.yaml -o ./my-project --update

--update renders the template at the locked commit (the baseline you started from) and at the new ref, then merges with git merge-file (base = old render, ours = your file, theirs = new render). On success the lock advances. Full walkthrough: docs/walkthrough/reproducible-updates.md.

Documentation

Doc What's inside
docs/getting-started/ 5-min: install, run against a fixture bundle, see the output
docs/walkthrough/build-a-yaml-bundle.md 15-min: author your own YAML/Jinja bundle from scratch
docs/walkthrough/from-git-bundle.md 5-min: consume a public bundle straight from a git repo
docs/walkthrough/reproducible-updates.md The lockfile, --pin, and --update (3-way merge) — reproducibility & updates
docs/reference/manifest-format.md Full fluid-scaffold.yaml reference
docs/reference/library-api.md generate() — call the engine from Python and get every written file with its sha256

License

Apache-2.0.

Metadata

Release files for data-product-forge-custom-scaffold 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for data-product-forge-custom-scaffold 0.5.0
File Size Uploaded Provenance Actions
data_product_forge_custom_scaffold-0.5.0.tar.gz 64.1 kB With provenance Details for data_product_forge_custom_scaffold-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for data-product-forge-custom-scaffold 0.5.0
File Interpreter ABI Platform Actions
data_product_forge_custom_scaffold-0.5.0-py3-none-any.whl Python 3 none any Details for data_product_forge_custom_scaffold-0.5.0-py3-none-any.whl

Total release size: 136.6 kB

Release files / data_product_forge_custom_scaffold-0.5.0.tar.gz

Download URL data_product_forge_custom_scaffold-0.5.0.tar.gz
Size 64.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6839188b1a70321de764e0eb6ab1610869a4bf2aa243265eb853f64bd7bfd19d
BLAKE2b-256 checksum
How to use checksums
aa3fc1b63cd3c27869b64aa0ac8b008502a9d2a337feb116b3598c934f5a5bc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / data_product_forge_custom_scaffold-0.5.0-py3-none-any.whl

Download URL data_product_forge_custom_scaffold-0.5.0-py3-none-any.whl
Size 72.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67a8e8fd9fa704b2bfc334037e1fdda99986fb8f304869b58b4bc6f0b44814d8
BLAKE2b-256 checksum
How to use checksums
6c6f8db66f8d3b34969299803bd9f4edda6bec9086270729f39ad2ec00476ef2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for data-product-forge-custom-scaffold 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for data_product_forge_custom_scaffold-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page