Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions hugr-core/src/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ use crate::import::ImportError;
use crate::{Extension, import::import_package};

/// Key used to store the name of the generator that produced the envelope.
pub const GENERATOR_KEY: &str = "__generator";
pub const GENERATOR_KEY: &str = "core.generator";
/// Key used to store the list of used extensions in the metadata of a HUGR.
pub const USED_EXTENSIONS_KEY: &str = "core.used_extensions";

/// Get the name of the generator from the metadata of the HUGR modules.
/// If multiple modules have different generators, a comma-separated list is returned in
Expand Down Expand Up @@ -459,9 +461,6 @@ fn encode_model<'h>(
Ok(())
}

/// Key used to store the list of used extensions in the metadata of a HUGR.
pub const USED_EXTENSIONS_KEY: &str = "__used_extensions";

#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)]
struct UsedExtension {
name: String,
Expand Down
11 changes: 7 additions & 4 deletions specification/hugr.md
Original file line number Diff line number Diff line change
Expand Up @@ -770,23 +770,26 @@ existing metadata, given the node ID.
`Ports` (for port metadata) or `History` (for use by the rewrite
engine)?

Reserved metadata keys used by the HUGR tooling are prefixed with `core.`.
Use of this prefix by external tooling may cause issues.

#### Generator Metadata
Tooling generating HUGR can specify some reserved metadata keys to be used for debugging
purposes.

The key `__generator` when used on the module root node is
The key `core.generator` when used on the module root node is
used to specify the tooling used to generate the module.
The associated value must be an object/dictionary containing the fields `name`
and `version`, each with string values. Extra fields may be used to include
additional data about generating tooling that may be useful for debugging. Example:

```json
{
"__generator": { "name": "my_compiler", "version": "1.0.0" }
"core.generator": { "name": "my_compiler", "version": "1.0.0" }
}
```

The key `__used_extensions` when used on the module root node is
The key `core.used_extensions` when used on the module root node is
used to specify the names and versions of all the extensions used in the module.
Some of these may correspond to extensions packaged with the module, but they
may also be extensions the consuming tooling has pre-loaded. They can be used by the
Expand All @@ -795,7 +798,7 @@ must be an array of objects/dictionaries containing the keys `name` and `version
with string values. Example:
```json
{
"__used_extensions": [{ "name": "my_ext", "version": "2.2.3" }]
"core.used_extensions": [{ "name": "my_ext", "version": "2.2.3" }]
}
```

Expand Down
Loading