← Back to issue list

Optimize configure hook

View original Github issue

Metadata

Project
snapcraft
Number
#6422
Type
issue
State
closed
Author
mr-cal
Labels
—
Created
Updated
Closed

Current evaluation

Optimized configure hook by reducing imports in snap_config.py; resolved by merged PR #6427 which makes SnapConfig lightweight.

Resolution: closed resolved

Reason: Issue was fixed by merged PR #6427, which lightened snap_config.py by replacing CraftBaseModel with pydantic.BaseModel and inlining is_snapcraft_running_from_snap() to reduce configure hook runtime.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Check existing issues - [x] I've verified that this request isn't described by any existing issues. ### Request Snapcraft's [configure hook](https://github.com/canonical/snapcraft/blob/main/snap/hooks/configure) validates the value of `snap get snapcraft provider`. However, it imports some [code from Snapcraft itself](https://github.com/canonical/snapcraft/blob/main/snapcraft/snap_config.py) and ends up loading hundreds of modules across craft-application, craft-parts, craft-providers, and craft-cli. The hook is very simple and could be a standalone script. Reducing imports would likely drastically reduce the configure hook's runtime. ### The problem it solves In very slow environments, such as Launchpad's emulated riscv64 runners on 20.04, Snapcraft's configure hook occasionally exceeds snapd's 5 minute limit and times out.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b — closed resolved Optimized configure hook by reducing imports in snap_config.py; resolved by merged PR #6427 which makes SnapConfig lightweight.
~deepseek/deepseek-pro-latest
Impact: 45
Quick Win: 23
Complexity: 40
Confidence: 85
Actionability: 85
keep open Maintainer request to slim the configure hook by removing heavy snap_config imports that can exceed snapd's 5-minute timeout on slow riscv64 runners; active PR #6427 implements the lightweight approach and is under rework.
~deepseek/deepseek-pro-latest
Impact: 55
Quick Win: 26
Complexity: 40
Confidence: 80
Actionability: 80
keep open Maintainer request to slim the configure hook, which imports snap_config.py and loads hundreds of modules, causing snapd 5-minute timeouts on slow riscv64 runners. Active PR #6427 is in progress.
~deepseek/deepseek-pro-latest
Impact: 50
Quick Win: 21
Complexity: 40
Confidence: 75
Actionability: 70
keep open Maintainer request to slim down the configure hook, which imports snapcraft.snap_config and loads hundreds of modules, occasionally timing out on slow riscv64 runners. Active: contributor ready to take over after PR #6427 stalls.
~deepseek/deepseek-pro-latest
Impact: 55
Quick Win: 25
Complexity: 40
Confidence: 75
Actionability: 75
keep open Configure hook imports snapcraft.snap_config, loading hundreds of modules and occasionally exceeding snapd's 5-minute limit on slow riscv64 runners. Maintainer-authored; contributor volunteered; PR #6427 in progress but CI failing.
~deepseek/deepseek-pro-latest
Impact: 55
Quick Win: 25
Complexity: 40
Confidence: 75
Actionability: 75
keep open Configure hook imports snapcraft.snap_config, pulling in hundreds of modules and occasionally exceeding snapd's 5-minute limit on slow riscv64 runners. A contributor has volunteered to make SnapConfig lightweight; PR #6427 is an in-progress attempt.
stealth/space-bunny-alpha
Impact: 45
Quick Win: 24
Complexity: 30
Confidence: 82
Actionability: 75
needs triage Configure hook imports snapcraft.snap_config (pydantic, craft-application/craft-parts) only to validate 'provider', sometimes exceeding snapd's 5-min limit on emulated riscv64 Launchpad runners. Proposal: standalone hook script. Untriaged.
stealth/space-bunny-alpha
Impact: 42
Quick Win: 21
Complexity: 30
Confidence: 82
Actionability: 72
needs triage Configure hook imports snapcraft.snap_config (pydantic/craft-application/craft-cli) to validate the provider snap config, loading hundreds of modules and occasionally exceeding snapd's 5-minute hook limit on emulated riscv64 Launchpad runners. Author suggests a standalone script.
stealth/space-bunny-alpha
Impact: 60
Quick Win: 39
Complexity: 24
Confidence: 94
Actionability: 86
needs triage Standalone provider validation could eliminate heavy configure-hook imports and rare snapd timeouts on slow Launchpad riscv64 runners; the new request needs triage.
qwen/qwen3.6-35b-a3b
Impact: 65
Quick Win: 42
Staleness: 0
Complexity: 35
Confidence: 70
Support Request: 10
needs triage Optimization request to reduce imports in configure hook to prevent timeouts on slow hardware. Brand new issue, no maintainer response yet.

Update history

Date Change
closed
updated
updated
updated
updated
updated
created

Related work

  • Likely Fixed By: snapcraft#6427 (confidence 95%)

    PR #6427 directly addresses the issue by minimizing imports in snap_config.py and was merged.

Related issues

Issue Project State Summary Similarity
#6427 perf: avoid heavy imports in snap config model snapcraft merged Merged PR #6427 to make snap_config.py lightweight, avoiding heavy imports in the configure hook. Replaces CraftBaseModel with pydantic.BaseModel and inlines helper functions. Fixes #6422.
74%