starlark

package
v0.1.0-dev.20260222090703 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillSlot

func FillSlot(node *execution.Node, graph *execution.Graph, slotName string, value starlark.Value) error

FillSlot fills a slot in a node from a Starlark value.

Any slot accepts:

  • A promise (Output): creates an edge, value flows at runtime
  • A gather (Gather): creates edges from all members (parallel execution)
  • An immediate value: stored directly, known at analysis time

func MakeAttr

func MakeAttr(name string, fn BuiltinFunc) starlark.Value

MakeAttr creates a starlark.Builtin from a receiver method.

func NoSuchAttrError

func NoSuchAttrError(receiver, attr string) error

NoSuchAttrError returns an error for an unknown attribute.

func PlanNames

func PlanNames() []string

PlanNames returns sorted namespace names from the registry.

Types

type ArchivePlan

type ArchivePlan struct {
	Receiver
	// contains filtered or unexported fields
}

func NewArchivePlan

func NewArchivePlan(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *ArchivePlan

func (*ArchivePlan) Attr

func (p *ArchivePlan) Attr(name string) (starlark.Value, error)

func (*ArchivePlan) AttrNames

func (p *ArchivePlan) AttrNames() []string

type BuiltinFunc

type BuiltinFunc func(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

BuiltinFunc is the signature for builtin function implementations.

type EncryptionPlan

type EncryptionPlan struct {
	Receiver
	// contains filtered or unexported fields
}

func NewEncryptionPlan

func NewEncryptionPlan(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *EncryptionPlan

func (*EncryptionPlan) Attr

func (p *EncryptionPlan) Attr(name string) (starlark.Value, error)

func (*EncryptionPlan) AttrNames

func (p *EncryptionPlan) AttrNames() []string

type FilePlan

type FilePlan struct {
	Receiver
	// contains filtered or unexported fields
}

func NewFilePlan

func NewFilePlan(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *FilePlan

func (*FilePlan) Attr

func (p *FilePlan) Attr(name string) (starlark.Value, error)

func (*FilePlan) AttrNames

func (p *FilePlan) AttrNames() []string

type Gather

type Gather struct {
	// contains filtered or unexported fields
}

Gather represents a collection of outputs that can run in parallel. When used as a slot input, it creates edges from ALL members to the consumer, enabling parallel execution of the gathered nodes.

Usage in Starlark:

a = plan.file.copy(src1, dst1)
b = plan.file.copy(src2, dst2)
c = plan.file.copy(src3, dst3)
group = plan.gather(a, b, c)
d = plan.whatever(group)  # d waits for a, b, c (which run in parallel)

func NewGather

func NewGather(graph *execution.Graph, outputs ...*Output) *Gather

NewGather creates a new Gather from multiple outputs.

func (*Gather) FillSlot

func (g *Gather) FillSlot(consumer *execution.Node, slotName string)

FillSlot fills a slot in the consumer node with all gathered promises, creating edges from each member. This enables parallel execution.

func (*Gather) Freeze

func (g *Gather) Freeze()

func (*Gather) Hash

func (g *Gather) Hash() (uint32, error)

func (*Gather) Outputs

func (g *Gather) Outputs() []*Output

Outputs returns the gathered outputs.

func (*Gather) String

func (g *Gather) String() string

Starlark Value interface

func (*Gather) Truth

func (g *Gather) Truth() starlark.Bool

func (*Gather) Type

func (g *Gather) Type() string

type GitPlan

type GitPlan struct {
	Receiver
	// contains filtered or unexported fields
}

func NewGitPlan

func NewGitPlan(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *GitPlan

func (*GitPlan) Attr

func (p *GitPlan) Attr(name string) (starlark.Value, error)

func (*GitPlan) AttrNames

func (p *GitPlan) AttrNames() []string

type NetPlan

type NetPlan struct {
	Receiver
	// contains filtered or unexported fields
}

func NewNetPlan

func NewNetPlan(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *NetPlan

func (*NetPlan) Attr

func (p *NetPlan) Attr(name string) (starlark.Value, error)

func (*NetPlan) AttrNames

func (p *NetPlan) AttrNames() []string

type Output

type Output struct {
	// contains filtered or unexported fields
}

Output represents a promise - a handle to a node's output that can flow through the graph to fill slots in other nodes.

When passed to a plan function's slot, it creates an edge in the graph. The same promise can flow to multiple slots (fan-out).

func NewOutput

func NewOutput(node *execution.Node, graph *execution.Graph, slot string) *Output

NewOutput creates a new Output (promise) representing a node's output.

func ResolveInput

func ResolveInput(value starlark.Value) (*Output, error)

ResolveInput extracts an *Output from a Starlark value. Returns an error if the value is not an Output.

func (*Output) Attr

func (o *Output) Attr(name string) (starlark.Value, error)

Starlark HasAttrs interface

func (*Output) AttrNames

func (o *Output) AttrNames() []string

func (*Output) DependOn

func (o *Output) DependOn(consumer *execution.Node)

DependOn creates an edge making the given node depend on this output's node.

func (*Output) FillSlot

func (o *Output) FillSlot(consumer *execution.Node, slotName string)

FillSlot fills a slot in the consumer node with this promise, creating an edge. This is called when a promise is passed to a plan function.

func (*Output) Freeze

func (o *Output) Freeze()

func (*Output) Graph

func (o *Output) Graph() *execution.Graph

Graph returns the execution graph.

func (*Output) Hash

func (o *Output) Hash() (uint32, error)

func (*Output) Node

func (o *Output) Node() *execution.Node

Node returns the execution node that produces this output.

func (*Output) Path

func (o *Output) Path() string

Path returns a path from the node's slots.

func (*Output) Slot

func (o *Output) Slot() string

Slot returns which output slot this represents.

func (*Output) String

func (o *Output) String() string

Starlark Value interface

func (*Output) Truth

func (o *Output) Truth() starlark.Bool

func (*Output) Type

func (o *Output) Type() string

type PackageContext

type PackageContext struct {
	// Name is the package name being deployed.
	Name string

	// Version is the version being deployed.
	Version string

	// Features are the enabled feature flags for this deployment.
	Features []string

	// Settings are key-value configuration settings.
	Settings map[string]string

	// DryRun indicates this is a preview (no actual changes).
	DryRun bool

	// SourceRoot is the package source directory in the registry cache.
	SourceRoot string

	// TargetRoot is the deployment target directory (usually $HOME).
	TargetRoot string
}

PackageContext provides information about the package being deployed. Passed to phase scripts as the first argument.

func (*PackageContext) HasFeature

func (p *PackageContext) HasFeature(name string) bool

HasFeature checks if a feature is enabled.

func (*PackageContext) Setting

func (p *PackageContext) Setting(key string) string

Setting returns a setting value, or empty string if not set.

func (*PackageContext) ToStarlark

func (p *PackageContext) ToStarlark() starlark.Value

ToStarlark converts the PackageContext to a Starlark receiver.

type PhaseContext

type PhaseContext struct {
	// PhaseName is the lifecycle phase (e.g., "install", "provision").
	PhaseName string

	// Action is the lifecycle action (e.g., "deploy", "remove").
	Action string

	// Retry holds the retry policy configured by the script.
	Retry *execution.RetryPolicy
}

PhaseContext provides phase metadata to lifecycle scripts. Passed as the second call argument: def install(package, phase):

Starlark API:

phase.name         # Phase name (e.g., "install", "provision")
phase.action       # Lifecycle action (e.g., "deploy", "remove")
phase.retry(max_attempts=3, backoff="exponential")

func (*PhaseContext) ToStarlark

func (c *PhaseContext) ToStarlark() starlark.Value

ToStarlark returns a Starlark value exposing phase.name, phase.action, phase.retry().

type PkgPlan

type PkgPlan struct {
	Receiver
	// contains filtered or unexported fields
}

func NewPkgPlan

func NewPkgPlan(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *PkgPlan

func (*PkgPlan) Attr

func (p *PkgPlan) Attr(name string) (starlark.Value, error)

func (*PkgPlan) AttrNames

func (p *PkgPlan) AttrNames() []string

type Plan

type Plan struct {
	Receiver
	// contains filtered or unexported fields
}

func NewPlan

func NewPlan(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *Plan

func (*Plan) Attr

func (p *Plan) Attr(name string) (starlark.Value, error)

func (*Plan) AttrNames

func (p *Plan) AttrNames() []string

type PlanFactory

type PlanFactory func(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) starlark.Value

PlanFactory creates a plan sub-namespace for the given graph context.

type PlanRoot

type PlanRoot struct {
	// contains filtered or unexported fields
}

PlanRoot implements the top-level plan namespace using the slot-based model. Sub-namespaces are dynamically populated from the plan registry (each plan_*_gen.go registers via init()).

func NewPlanRoot

func NewPlanRoot(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *PlanRoot

NewPlanRoot creates a new PlanRoot for the given graph and host. Sub-namespaces are built dynamically from the plan registry.

func (*PlanRoot) Attr

func (p *PlanRoot) Attr(name string) (starlark.Value, error)

Starlark HasAttrs interface

func (*PlanRoot) AttrNames

func (p *PlanRoot) AttrNames() []string

func (*PlanRoot) Freeze

func (p *PlanRoot) Freeze()

func (*PlanRoot) Hash

func (p *PlanRoot) Hash() (uint32, error)

func (*PlanRoot) String

func (p *PlanRoot) String() string

Starlark Value interface

func (*PlanRoot) Truth

func (p *PlanRoot) Truth() starlark.Bool

func (*PlanRoot) Type

func (p *PlanRoot) Type() string

type Receiver

type Receiver struct {
	// contains filtered or unexported fields
}

Receiver provides common implementations for Starlark binding namespaces. Embed this in concrete types to satisfy starlark.Value. Concrete types must implement starlark.HasAttrs (Attr and AttrNames) themselves.

func NewReceiver

func NewReceiver(name string) Receiver

NewReceiver creates a new Receiver with the given namespace name.

func (Receiver) Freeze

func (r Receiver) Freeze()

Freeze implements starlark.Value.

func (Receiver) Hash

func (r Receiver) Hash() (uint32, error)

Hash implements starlark.Value.

func (Receiver) String

func (r Receiver) String() string

String implements starlark.Value.

func (Receiver) Truth

func (r Receiver) Truth() starlark.Bool

Truth implements starlark.Value.

func (Receiver) Type

func (r Receiver) Type() string

Type implements starlark.Value.

type ServicePlan

type ServicePlan struct {
	Receiver
	// contains filtered or unexported fields
}

func NewServicePlan

func NewServicePlan(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *ServicePlan

func (*ServicePlan) Attr

func (p *ServicePlan) Attr(name string) (starlark.Value, error)

func (*ServicePlan) AttrNames

func (p *ServicePlan) AttrNames() []string

type ShellPlan

type ShellPlan struct {
	Receiver
	// contains filtered or unexported fields
}

func NewShellPlan

func NewShellPlan(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *ShellPlan

func (*ShellPlan) Attr

func (p *ShellPlan) Attr(name string) (starlark.Value, error)

func (*ShellPlan) AttrNames

func (p *ShellPlan) AttrNames() []string

type TemplatePlan

type TemplatePlan struct {
	Receiver
	// contains filtered or unexported fields
}

func NewTemplatePlan

func NewTemplatePlan(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) *TemplatePlan

func (*TemplatePlan) Attr

func (p *TemplatePlan) Attr(name string) (starlark.Value, error)

func (*TemplatePlan) AttrNames

func (p *TemplatePlan) AttrNames() []string

type UiReceiver

type UiReceiver struct {
	Receiver
	// contains filtered or unexported fields
}

func NewUiReceiver

func NewUiReceiver(provider *ui.Provider) *UiReceiver

func (*UiReceiver) Attr

func (r *UiReceiver) Attr(name string) (starlark.Value, error)

func (*UiReceiver) AttrNames

func (r *UiReceiver) AttrNames() []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL