← Back to issue list

fix(templates): use more explicit __init__ param types in charm templates

View original Github issue

Metadata

Project
charmcraft
Number
#1477
Type
pull request
State
merged
Author
benhoyt
Labels
Created
Updated
Closed

Current evaluation

Merged following two approvals and passing CI. Updated charm templates to use explicit __init__ parameter types, enhancing type safety and allowing direct framework usage in observe calls. Modified 3 files (+10/-10 lines).

Suggested action:

No scores available.

Issue body

This is the style we've been advocating recently, so update the charm templates to this. It's more explicit and type-safe (and we can't change the signature of `CharmBase.__init__` without breaking things anyway, so `*args` is no safer), and allows the use of `framework` directly in the observe calls.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged following two approvals and passing CI. Updated charm templates to use explicit __init__ parameter types, enhancing type safety and allowing direct framework usage in observe calls. Modified 3 files (+10/-10 lines).
qwen3.6-35b-a3b-mtp-q6 Merged an update to charm templates replacing *args with explicit __init__ parameter types. This improves type safety, aligns with project style guidelines, and enables direct framework usage in observe calls.
qwen3.6-35b-a3b-mtp-q6 Merged update to charm templates replacing *args with explicit __init__ parameter types. This improves type safety, aligns with project style guidelines, and enables direct framework usage in observe calls.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#283 Smoother and safer template project from init command. charmcraft merged Merged updates to charmcraft init that prevent publishing charms with leftover TEMPLATE-TODO markers. Validation was moved from build to upload per reviewer feedback. Fixes #237, #238, #243, and #247.
72%
#1622 fix: reorganise charmcraft.yaml preprocessing charmcraft merged Merged following two approvals and passing CI. Reorganized charmcraft.yaml preprocessing to apply extensions on raw data, assign default parts to charms with bases, and enforce dictionary type for parts. Modified 5 files (+27/-14 lines).
71%
#2695 feat(templates): add juju_setup to integration tests, improve comments, fix resolve() charmcraft merged Merged after three approvals. Adds the juju_setup marker to integration tests, improves documentation comments, and removes a redundant resolve() call in the charm deployment test. All CI checks passed prior to merge.
70%