← Back to issue list

providers: move `get_instance_name()` to providers.py

View original Github issue

Metadata

Project
snapcraft
Number
#3926
Type
pull request
State
merged
Author
mr-cal
Labels
—
Created
Updated
Closed

Current evaluation

Merged as commit c1246cbe3 (+82/-45, 6 files): moved the snapcraft-specific get_instance_name() out of craft-providers into snapcraft/providers/providers.py (CRAFT-1305 prep for the new craft-providers API).

Resolution: closed resolved

Reason: PR #3926 was approved and merged into main as commit c1246cbe3, relocating get_instance_name() from the provider backend modules into snapcraft/providers/providers.py so _lxd.py, _multipass.py and _provider.py hold no snapcraft-specific code, mirroring canonical/rockcraft#74.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [X] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [X] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [X] Have you successfully run `make lint`? - [X] Have you successfully run `pytest tests/unit`? ----- `get_instance_name()` is a snapcraft-specific call, so it is moved out of the craft-providers interface. See [this PR](https://github.com/canonical/rockcraft/pull/74) in rockcraft for reference. This is the first out of a series of PRs to prepare for the new `craft-providers` API. The goals are simple: 1. `_provider.py`, `_lxd.py`, and `_multipass.py` contain no snapcraft-specific code 2. All snapcraft-specific code related to `craft-providers` is moved into `snapcraft/providers/providers.py` This preparation is complete in `rockcraft`. The new interface will be migrated from `rockcraft` to `craft-providers` in the coming week. (CRAFT-1305)

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged as commit c1246cbe3 (+82/-45, 6 files): moved the snapcraft-specific get_instance_name() out of craft-providers into snapcraft/providers/providers.py (CRAFT-1305 prep for the new craft-providers API).
stealth/space-bunny-alpha — closed resolved Merged in #3926 (c1246cbe3): moved get_instance_name() into snapcraft/providers/providers.py, removing Snapcraft-specific logic from provider modules in preparation for the craft-providers API.
stealth/space-bunny-alpha — closed resolved Merged #3926 in c1246cbe3, moving Snapcraft-specific get_instance_name() to providers.py and removing it from provider backends ahead of the new craft-providers API.
stealth/space-bunny-alpha — closed resolved Merged PR #3926 moved get_instance_name() into snapcraft/providers/providers.py, isolating Snapcraft-specific logic ahead of the new craft-providers API.
qwen/qwen3.6-35b-a3b — — Merged. Moved get_instance_name() to snapcraft/providers/providers.py, removing snapcraft-specific logic from provider modules. This refactoring prepares the codebase for the new craft-providers API. Approved by reviewers and passed all CI checks.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Relocated get_instance_name() to snapcraft/providers/providers.py, removing snapcraft-specific logic from provider modules. This refactoring prepares the codebase for the new craft-providers API and aligns with rockcraft changes.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/rockcraft#74 (confidence 92%)

    Referenced in the PR body as the rockcraft counterpart that already completed the same refactor.

  • Related To: snapcraft#3943 (confidence 85%)

    Follow-up 'providers: use new craft-providers interface' (merged, 2980d145c) that deleted the in-tree provider classes and moved providers/providers.py, superseding the interim structure created here.

  • Related To: snapcraft#3929 (confidence 70%)

    Sibling step in the same series: refactor clean_project_environments (commit 19343788b), same prep goal.

  • Related To: snapcraft#3935 (confidence 65%)

    Sibling step in the series: refactor capture_logs_from_instance() (commit d0da7f83f).

Related issues

Issue Project State Summary Similarity
#74 providers: move get_instance_name() to providers.py rockcraft merged Merged in canonical/rockcraft#74 (c5423c5a), moving Rockcraft-specific get_instance_name() into providers.py for CRAFT-1350.
81%
#3940 providers: move `get_provider()` to providers.py snapcraft merged Merged PR #3940 by mr-cal moved get_provider() into snapcraft/providers.py (squash commit 2acdd89b6), a CRAFT-1409 refactor mirroring canonical/rockcraft#92, part of a series of provider/lifecycle function moves.
81%
#885 (internal) Moved get_instance_name functionality to providers helper (CRAFT-1304). charmcraft merged Merged the CRAFT-1304 refactor in #885, moving get_instance_name functionality to the providers helper.
77%
#92 providers: refactor get_provider() rockcraft merged Merged PR #92 as commit 5bcc1c80, refactoring get_provider() and moving it from _get_provider.py to providers.py for CRAFT-1375.
74%
#80 providers: move `get_instance_name()` call to lifecycle.py rockcraft merged Merged canonical/rockcraft#80 as ca679971, moving Rockcraft-specific get_instance_name() from Provider classes to lifecycle.py (CRAFT-1379).
74%
#898 providers: move `get_provider()` to providers.py charmcraft merged Merged charmcraft#898, moving get_provider() into providers.py for CRAFT-1410 after prerequisite charmcraft#896 landed.
73%
#3943 providers: use new craft-providers interface snapcraft merged Merged into snapcraft main as commit 2980d145c: removed in-tree Provider/LXDProvider/MultipassProvider classes in favour of craft-providers, and moved snapcraft/providers/providers.py to snapcraft/providers.py (+65/-1173).
72%
#407 providers: add get_instance_name() for naming instances (CRAFT-310) charmcraft merged Merged PR #407 added providers.get_instance_name() for launch instance naming in CRAFT-310 (commit 0cb02bf4; merge d9179bdf).
71%