Skip to content

docs: align example charms with pre-release Charmcraft#2444

Open
Copilot wants to merge 8 commits intomainfrom
copilot/update-charms-in-tutorials
Open

docs: align example charms with pre-release Charmcraft#2444
Copilot wants to merge 8 commits intomainfrom
copilot/update-charms-in-tutorials

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

We've been making a lot of changes to the example charms and corresponding Charmcraft profiles recently. The latest change to the profiles is canonical/charmcraft#2653, which bumps development deps in uv.lock.

I asked Copilot to regenerate the charms from Charmcraft and compare against our example charms. It found a couple of things that need syncing:

  • The charm fixture for integration tests needs to use the new style, similar to our pytest-operator migration guide.
  • Integration test dependencies need updating in pyproject.toml. This doesn't apply to the k8s-5-observe charm; I already did it in #2411.
  • The ops dependency needs updating in pyproject.toml.

Copilot also updated all the uv.lock files to match pyproject.toml and bump the development deps. I was hesitant about this at first, but inspecting the agent session, Copilot did run uv lock --upgrade-package ... rather than hacking on uv.lock. So I'm happy to approve this. I also did some spot checks on the lockfile changes.

Follow-up review syncs in this PR:

  • Preserved existing copyright notices in tutorial example integration conftest.py files (including Canonical Ltd. wording and original year where applicable), rather than adopting generated header text.
  • Compared example integration test_charm.py files against charmcraft-profile-tools (kubernetes and machine) and restored the scaffolded skipped workload-version test in k8s-1-minimal and k8s-2-configurable to match expected profile shape while keeping tutorial-specific app/resource values.
  • Checked tutorial .md sources for consistency after these test updates; no tutorial content changes were required.

None of these charm changes affect anything that's shown in the tutorials.

I'm updating the tips in the tutorials about using Charmcraft from a commit hash: I bumped the commit hash now that canonical/charmcraft#2653 has merged.

Copy link
Copy Markdown
Contributor

@dwilding dwilding left a comment

Choose a reason for hiding this comment

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

Please review the dependency bumps in canonical/charmcraft#2653. We need to make sure these are also reflected in the example charms.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 22, 2026

Please review the dependency bumps in canonical/charmcraft#2653. We need to make sure these are also reflected in the example charms.

Updated in commit 032775c. I synced the tutorial example uv.lock files with the dependency bumps from canonical/charmcraft#2653 (including codespell 2.4.2, pyright 1.1.408, ruff 0.15.11, and PyYAML 6.0.3 where applicable), and re-ran targeted lint/unit checks for the touched examples.

Copilot AI requested a review from dwilding April 22, 2026 10:15
Copy link
Copy Markdown
Contributor

@dwilding dwilding left a comment

Choose a reason for hiding this comment

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

Please keep the copyright notices as-is. This is one aspect where we can deviate from what is generated by Charmcraft.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 22, 2026

Please keep the copyright notices as-is. This is one aspect where we can deviate from what is generated by Charmcraft.

Done in 74d86a5. I restored the tutorial example integration conftest.py headers to keep the existing copyright notices (including Canonical Ltd. wording and the original year in machine-tinyproxy). No UI files were changed in this update.

Copilot AI requested a review from dwilding April 22, 2026 10:49
@dwilding dwilding changed the title chore: align tutorial example charms with Charmcraft profile commit fae9862 docs: align example charms with pre-release Charmcraft Apr 22, 2026
@dwilding dwilding marked this pull request as ready for review April 22, 2026 22:09
Copy link
Copy Markdown
Contributor

@james-garner-canonical james-garner-canonical 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, thanks David.

To use the profile versions used in the tutorial, initialise a charm using `charmcraft` directly from Github, like this:
```
uvx git+https://github.com/canonical/charmcraft@460e8df init --profile kubernetes
uvx git+https://github.com/canonical/charmcraft@fae9862 init --profile kubernetes
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the hash of the latest profile update in charmcraft main.

Copy link
Copy Markdown
Contributor

@dwilding dwilding left a comment

Choose a reason for hiding this comment

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

Please review the K8s example charms against https://github.com/canonical/charmcraft-profile-tools/tree/main/kubernetes (which was generated from Charmcraft). Specifically compare test_charm.py for the integration tests. There should be at least one difference we need to reflect in the example charms.

Please do the same of the machine charm - compare against https://github.com/canonical/charmcraft-profile-tools/tree/main/machine.

If you find changes, please check the .md source of the tutorials to see if anything needs updating for consistency.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 22, 2026

Please review the K8s example charms against https://github.com/canonical/charmcraft-profile-tools/tree/main/kubernetes (which was generated from Charmcraft). Specifically compare test_charm.py for ...

Done in 80fe211 (with follow-up wording polish in 159ee96, 51a2c31). I compared the k8s and machine integration test_charm.py files against charmcraft-profile-tools and synced the k8s tutorial examples by restoring the scaffolded skipped workload-version test shape in k8s-1-minimal and k8s-2-configurable while keeping tutorial-specific app/resource values. I also checked the tutorial markdown sources for consistency and no .md updates were needed. No UI files were changed.

Copilot AI requested a review from dwilding April 22, 2026 23:32
@dwilding
Copy link
Copy Markdown
Contributor

Thanks @james-garner-canonical! I just tried to get clever and ask Copilot to sync one other inconsistency found in #2440. But it didn't catch that inconsistency and started making unwanted changes. I've reverted its work, so that things stand as you reviewed them. This is enough for one PR.

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.

3 participants