Skip to main content

Bolt Anchors

Name resource locations and build nested paths in bolt.

Bolt anchors let you bind a resource declaration to an identifier with the as clause. The anchor can then be used as a value or extended with / to build nested resource locations.

Installation

pip install bolt-anchors

Configuration

Add the plugin to your beet.yml/beet.json after bolt.

pipeline:
  - mecha

require:
  - bolt
  - bolt_anchors

Usage

Bind an anchor when declaring any resource. The anchor holds the fully resolved resource location of the declaration.

append function ~/foo as foo:
    print(foo)
    function foo / "bar":
        say foo bar

foo holds the fully resolved resource location of the declaration (relative to the current file and the enclosing declarations). It can be extended into a nested resource location, used as a value, and reused to declare or call other resources. Anchors work for any resource type and any path depth.

loot_table ./technical/loot as LOOT {}
print(LOOT)

Interpolated paths

Any location value can be interpolated with {...} and extended with / segments. This also works for plain bolt variables that hold a location.

FOO = ~/foo

function FOO:          # demo:foo
    say plain

function {FOO}/bar:    # demo:foo/bar
    say interpolated

Anchors support the same syntax, as well as the foo / "bar" shorthand.

append function ~/anchor as a:
    function {a}/"quoted"/child as c:
        print(c)
        say child

Anchors can be used as values, interpolated into strings, and reused when declaring or calling other resources.

function ~/utils as utils:
    function utils / "math" / "add":
        scoreboard players add @s points 1

advancement ./tech/root as ROOT {}
predicate ROOT / "check" {}
say f"prefix is {utils}"
function utils / "math" / "add"

Moving the path scope

The anchor command changes the current path scope without creating a resource. Nested locations and anchors inside its block resolve against the new location.

anchor demo:foo as foo:
    function ~/bar as bar:
        print(bar) # demo:foo/bar
    function foo / "baz" as baz:
        print(baz) # demo:foo/baz

The block itself emits no file. Commands and statements inside an anchor block are treated like regular top-level code and are inlined into the current file, while any resource declarations create files relative to the new scope.

Development

uv sync --dev
uv run pytest
uv run ruff check

Release files for bolt-anchors 0.2.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 bolt-anchors 0.2.0
File Size Uploaded
bolt_anchors-0.2.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bolt-anchors 0.2.0
File Interpreter ABI Platform
bolt_anchors-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 kB

Release files / bolt_anchors-0.2.0.tar.gz

Download URL bolt_anchors-0.2.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
833bdaa7614f27ce654eb96bab49003873e258f266a7a6eed1b9459420f598d2
BLAKE2b-256 checksum
How to use checksums
ae510e5f87fd741df1b6b9d75a859f4d9894e855237eec1ab2114718b62783f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / bolt_anchors-0.2.0-py3-none-any.whl

Download URL bolt_anchors-0.2.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a29d5356d1ba756a3426636d27d772344e1067872a8b10257121ec5e2f615bf
BLAKE2b-256 checksum
How to use checksums
6608592957d7b5ad57a7a5a67370050a231a0beb8096df390f4ef833df60edc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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