Skip to content

nf.core

nf.core (canonical package netherframe.core) is the Python authoring and execution facade for Netherframe. nf.* and netherframe.* resolve to the exact same module objects at runtime and ship matching typing information.

For symbol-level signatures generated directly from source docstrings, see Generated API Docstrings.


Installation

uv add netherframe.cli
uv add netherframe.core

netherframe.core is provider-neutral. AWS state normalization is installed automatically with netherframe.providers.hashicorp.aws, or explicitly via netherframe.core[aws]. Test harnesses and the FakeCloud pytest plugin ship separately in netherframe.testing (nf.testing).


Public exports (nf.core.__all__)

Construct model

Symbol Role
App Root container owning stacks, settings, checks, and hybrid execution
Stack Named grouping of providers, resources, data sources, ephemeral resources, and outputs
Construct Base class (BaseConstruct) for custom Python construct trees
Resource Generic managed resource (nf_type=...) and base class of generated resource bindings
DataSource Read-only provider data source
Provider Generic provider configuration and base class of generated provider classes
ProviderSettings Structured provider configuration settings helper
GeneratedValue Built-in random/secret value generated once and stored in state without hashicorp/random
Output Stack output value (supports sensitive=True)
Variable Synthesized Terraform input variable (for legacy compatibility)

Lifecycle and meta-arguments

Symbol Role
LifecycleRules Resource lifecycle rules: prevent_destroy, ignore_changes, replace_triggered_by, retain, adopt
DataLifecycleRules Lifecycle rules for data sources
Condition Precondition/postcondition descriptor (legacy synthesis)

Typed app inputs

Symbol Role
Secret[T] Marks a factory parameter as sensitive (never accepted on CLI argv; pass via ++@file or nf.sdk)
Teardown[T] Marks a factory parameter as teardown-only (verified to alter only lifecycle policy, never recorded in state)

App-wide checks and finalizers

Symbol Role
AppCheckContext Context passed to @app.check(phase=...) callbacks (phase, operation, app, inputs, changes, state, run)
AppChange Planned change record (address, stack, type, name, action, before, after, reasons)
RunOutcome Post-run summary passed to phase="finalize" checks (run_id, attempt, resumed, resources, prior, retained)
ResourceOutcome Per-resource execution status within RunOutcome
Finalized Return value of a finalizer carrying problems and evidence
Evidence Hash-addressed audit artifact reference (kind, uri, sha256)

Runtime values, expressions, and authoring helpers

Symbol Role
RuntimeValue Deferred attribute reference / expression token
Fn Legacy Terraform/OpenTofu function namespace (loaded lazily from installed function catalogue)
autoscope Class decorator binding self as the active scope inside __init__
Bind Type-annotation marker (x: Bind[Vpc] = Vpc(...)) for nf_autoid nf_id injection
BindContext Context manager marker (with Stack() as net, BindContext:) for nf_autoid

Backends

Symbol Role
LocalBackend Local filesystem backend construct
BackendSettings Structured backend configuration settings
BackendChain, ConditionalBackend Ordered / conditional backend selection for bootstrap and migration
BackendSelection, BackendDecision, BackendBootstrapAction, BackendBootstrapResult Backend resolution and bootstrap result types

Companion submodules

Module Contents
nf.core.runtime @runtime_check, @retained_check, RuntimeCheckContext, RuntimeCheckResult, hybrid_runtime (nf.core.runtime.runtime)
nf.core.values RuntimeValue, ConstantValue, runtime_len, runtime_contains, address.instance_name
nf.core.config.flags Context-scoped flag overrides (flags(...), set_flags(...)) for embedding code
nf.core.logging Structured logging (structlog + stdlib logging: configure_logging, disable_logging, logging_disabled, logging_level, get_logger)
nf.core.linting Offline policy runner (Linter, Rule, PolicyRule, RulePack, ResourceConfig, Report)
nf.core.backends.state_protocols Protocol contracts (StateStore, DocumentStateOps, FencedGraphOps, CheckpointStore)
nf.core.plugins Plugin contract (PLUGIN_API_VERSION = 1, ENTRY_POINT_GROUPS, plugin Protocols)
nf.core.serialization json_nf_dumps for preserving runtime tokens inside JSON documents
nf.testing (netherframe.testing) InMemoryGraphBackend, StateBackendContract, FakeCloud pytest fixtures

Minimal example

from nf.core import App, Output, Stack
from nf.providers.hashicorp.aws import AwsProvider, S3Bucket

app = App(nf_id="platform")
stack = Stack(nf_scope=app, nf_id="storage")

AwsProvider(nf_scope=stack, nf_id="aws", region="us-east-1")

bucket = S3Bucket(
    nf_scope=stack,
    nf_id="assets",
    bucket="replace-with-a-globally-unique-name",
)

Output(nf_scope=stack, nf_id="bucket_id", value=bucket.output.id)