Skip to content

feat: make package param optional, use canister name as default (Rust recipe)#27

Open
marc0olo wants to merge 5 commits into
mainfrom
feat/rust-canister-name-builtin
Open

feat: make package param optional, use canister name as default (Rust recipe)#27
marc0olo wants to merge 5 commits into
mainfrom
feat/rust-canister-name-builtin

Conversation

@marc0olo

@marc0olo marc0olo commented Jun 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Makes package an optional parameter — when omitted, the canister name from icp.yaml is used automatically via {{_.canister.name}}
  • Non-breaking: existing configs with package: continue to work unchanged
  • package is useful when the Cargo package name differs from the canister name (e.g. in a workspace)

Convention

By default, name the canister in icp.yaml to match [package].name in Cargo.toml — no configuration needed:

canisters:
  - name: backend       # must match [package].name in Cargo.toml
    recipe:
      type: "@dfinity/rust@<version>"

Use package only when the names genuinely differ (e.g. workspace):

canisters:
  - name: backend
    recipe:
      type: "@dfinity/rust@<version>"
      configuration:
        package: my-project-backend

Blocked on

dfinity/icp-cli#567 — provides {{_.canister.name}} built-in variable

🤖 Generated with Claude Code

marc0olo and others added 3 commits June 1, 2026 15:58
Drop the `package` configuration parameter — the canister name is now
injected automatically via {{_.canister.name}} (requires icp-cli#567).
The Cargo package name in Cargo.toml must match the canister name in
icp.yaml, which was already the implicit convention.

BREAKING CHANGE: `package` param removed. Ensure the canister name in
icp.yaml matches [package].name in Cargo.toml.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Keep package as an optional override for cases where the Cargo package
name differs from the canister name (e.g. workspaces). When omitted,
_.canister.name is used — making this a non-breaking change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo marc0olo changed the title feat!: use _.canister.name built-in instead of explicit package param (Rust recipe) feat: make package param optional, use canister name as default (Rust recipe) Jun 11, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo marc0olo marked this pull request as ready for review June 11, 2026 07:25
@marc0olo marc0olo requested a review from a team as a code owner June 11, 2026 07:25
@marc0olo marc0olo enabled auto-merge (squash) June 11, 2026 10:47
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