← Back to issue list

Improvements to the PythonPlugin for core24

View original Github issue

Metadata

Project
snapcraft
Number
#4587
Type
issue
State
open
Author
tigarmo
Labels
Created
Updated
Closed

Current evaluation

Braindump of four proposed improvements to the Python plugin for core24 (linter for bad interpreter symlinks, shebang linter, post-prime shebang rewriting, gnome extension interplay). Open, unlabelled, no maintainer response beyond a Jira sync bot; related core24 Python plugin work has since landed.

Suggested action: needs triage

Reason: The issue has no labels, no assignee, and the only comment is the autogenerated Jira sync (CRAFT-2499), so it has never been triaged by a maintainer. It is a multi-part feature/braindump (linter + post-prime shebang rewrite + gnome extension interplay) that overlaps with already-merged core24 Python plugin work (PR #4666, #4946) but none of the four items are implemented, so it should be triaged and likely split into separate issues rather than closed.

Impact: 50 Quick Win: 17.5 Staleness: 70 Complexity: 65 Confidence: 70 Support Request: 10

Issue body

### What needs to get done The story for Python snaps improved in `core24` but it's still a bit far from optimal. This issue is a bit of a braindump/discussion place for further improvements that we can do when targetting `core24` snaps: These two suggestions can be applied even if the Snapcraft project doesn't use the `python` plugin: ### 1) Add a linter that warns when a Python symlink points to a "probably invalid" interpreter (like pointing to `/usr/bin/python3` in classic snaps). Rationale: for the easy case of classic snaps, `/usr/bin/python3` comes from the user's machine and thus who knows which interpreter that is! There are also cases where the symlink can point to gnome-sdk's Python (when using the gnome extension). ### 2) Add a linter that warns when a Python script has the default shebang `#! /bin/env python3`. Rationale: similarly, because `/bin/env` will use the `PATH` it will very likely not pick up the correct `python3` (the one in `$SNAP/bin/python3`) because by default that directory comes very late in the search order. These suggestions are for when using the Python plugin specifically, in which case we have more control over the build: ### 3) Add a 'post-prime' step that fixes the shebangs in Python scripts to `#! /snap/<snapname>/current/bin/python3`. This would also alleviate suggestion 2; when we're getting ready to pack the final snap we know that the "correct" interpreter to use will live in `#! /snap/<snapname>/current/bin/python3`, so we might as well "hardcode" that. We should do that after `prime`, and not during `build`, so that the scripts still work during the build step. ### 4) Improve the interaction between the `python` plugin and the `gnome` extension. This one is a bit of a stretch-goal; snaps using the `gnome` extension have access to the sdk (during build) and the content snap (during runtime). So a Python project should use the sdk's Python interpreter during build (I assume it has special packages for building), but the content snap's interpreter during runtime. With this it should be straightforward to create a snap that has Python code that uses Gnome packages somehow (maybe Cairo?) ### Why it needs to get done To improve the UX of Python-based snaps

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 17.5
Staleness: 70
Complexity: 65
Confidence: 70
Support Request: 10
needs triage Braindump of four proposed improvements to the Python plugin for core24 (linter for bad interpreter symlinks, shebang linter, post-prime shebang rewriting, gnome extension interplay). Open, unlabelled, no maintainer response beyond a Jira sync bot; related core24 Python plugin work has since landed.
qwen/qwen3.6-35b-a3b
Staleness: 88
Complexity: 60
Confidence: 85
Support Request: 10
close stale Brainstorm discussion from 2023 outlining four UX improvements for Python snaps on core24. No maintainer engagement or concrete tasks identified in over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 88
Complexity: 45
Confidence: 75
Support Request: 15
close stale Outdated discussion post proposing Python plugin improvements for core24. No maintainer engagement in over a year, likely superseded by current implementations or practices.
qwen3.6-35b-a3b-mtp-q6
Staleness: 88
Complexity: 60
Confidence: 80
Support Request: 5
needs triage Proposes linters for invalid Python symlinks and default shebangs, a post-prime step to fix shebangs, and improved python plugin and gnome extension integration for core24. Open discussion synced to Jira CRAFT-2499, awaiting implementation.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#4666 (confidence 80%)

    PR that added core24 support to the Python plugin (detecting /usr/bin/python3.12, confinement logic); this issue builds on that work.

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

    Core24 Python plugin venv breakage, fixed in #4946; same plugin area this braindump targets.

Related issues

Issue Project State Summary Similarity
#4666 feat(plugins): support core24 in the Python plugin snapcraft merged Merged after approval and CI. Added core24 Python plugin support by detecting the confined /usr/bin/python3.12 interpreter and refining confinement logic. A flaky out-of-tree test was removed.
76%
#5207 Python plugin with core24 and gnome extension broken snapcraft closed The core24 Python plugin with the gnome extension failed due to missing Python encodings. The bug was resolved, and the disabled test was re-enabled in pull request #5977.
71%