Skip to content

Support load("uv.lock?as=toml", "value") syntax#1287

Open
cormacrelf wants to merge 1 commit intofacebook:mainfrom
cormacrelf:load-as-toml-json
Open

Support load("uv.lock?as=toml", "value") syntax#1287
cormacrelf wants to merge 1 commit intofacebook:mainfrom
cormacrelf:load-as-toml-json

Conversation

@cormacrelf
Copy link
Copy Markdown
Contributor

@cormacrelf cormacrelf commented Apr 9, 2026

Alternative to #1286.

The use case is reading files at bzl eval time that don't have a .toml suffix, as TOML, for https://github.com/cormacrelf/elk which I have updated to depend on this entire thing at the heart of its strategy only to realise it doesn't work very well at all. (I would be happy with a way to tell load() to load as TOML if we can't get symlinks to work.)

Here's that alternative. The example becomes

# BUCK
load(":blah.lock?as=toml", "value")

genrule(
    name = "test",
    out = "out.txt",
    cmd = "echo {} > $OUT".format(value),
)

# blah.lock
value = "original"

and basically this works. This code I do understand quite well, and it's simple and there are no X factors as to how to get it to work.

Because the only other way to import these files is to symlink them with a name ending with .toml.
And that doesn't work as BUCK does not propagate file invalidation to symlinks to changed files.
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 9, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync bot commented Apr 9, 2026

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D100180404. (Because this pull request was imported automatically, there will not be any future comments.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant