Skip to content

Write correct producers metadata to generated components#86

Merged
posborne merged 3 commits into
mainfrom
posborne/python-component-metadata
Apr 16, 2026
Merged

Write correct producers metadata to generated components#86
posborne merged 3 commits into
mainfrom
posborne/python-component-metadata

Conversation

@posborne
Copy link
Copy Markdown
Member

These changes updates fastly-compute-py to inject appropriate producer metadata to our generated component at the top-level. Here's what we get with this change:

$ wasm-tools metadata show build/bottle-app.composed.wasm --json | jq '.component.metadata.producers[]'
[
  "language",
  {
    "Python": "3.14"
  }
]
[
  "processed-by",
  {
    "componentize-py": "0.22.1",
    "fastly-compute-py": "0.1.0"
  }
]
[
  "sdk",
  {
    "fastly-compute-py": "0.1.0"
  }
]

Copy link
Copy Markdown
Member

@erikrose erikrose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

kind = next(iter(node))
data = node[kind]
if kind == "module":
m = re.match(r"libpython(\d+\.\d+)\.so", data.get("name") or "")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would .get("name", "") serve?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's right, in the JSON this key is sometimes present with a value that is null (None in Python). I just made this path a bit more explicit in the updates.

return m.group(1)
else:
nodes.extend(data.get("children", []))
return None
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noop

These changes updates fastly-compute-py to inject appropriate
producer metadata to our generated component at the top-level.
Here's what we get with this change:

    $ wasm-tools metadata show build/bottle-app.composed.wasm --json | jq '.component.metadata.producers[]'
    [
      "language",
      {
        "Python": "3.14"
      }
    ]
    [
      "processed-by",
      {
        "componentize-py": "0.22.1",
        "fastly-compute-py": "0.1.0"
      }
    ]
    [
      "sdk",
      {
        "fastly-compute-py": "0.1.0"
      }
    ]
@posborne posborne force-pushed the posborne/python-component-metadata branch from 4dce92b to 4fd8544 Compare April 15, 2026 19:29
@posborne posborne merged commit fcefb69 into main Apr 16, 2026
1 check passed
@posborne posborne deleted the posborne/python-component-metadata branch April 16, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants