plugins: extract sitecustomize logic from python
Metadata
Current evaluation
Merged a refactoring change extracting sitecustomize.py logic from the Python plugin into a shared module. Approved and passing CI, this prepares the codebase for the subsequent pip extraction without altering current functionality.
Suggested action: —
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] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
This PR is the next in a series that extracts pip from the python plugin, thus making progress on LP: [#1683036](https://bugs.launchpad.net/snapcraft/+bug/1683036) and #1444. It makes no changes to the Python plugin just yet, just copies functionality out into a more accessible place. The functionality that was copied here is the `sitecustomize.py` generation.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged a refactoring change extracting sitecustomize.py logic from the Python plugin into a shared module. Approved and passing CI, this prepares the codebase for the subsequent pip extraction without altering current functionality. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged extraction of sitecustomize.py generation logic from the Python plugin into a shared module. This refactoring prepares for subsequent pip extraction without altering the Python plugin itself. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Extracted sitecustomize.py generation logic from the Python plugin into a shared module. This refactoring prepares for subsequent pip decoupling without altering existing plugin behavior. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #248 plugins: add sitecustomize.py in PythonPlugin's build | rockcraft | merged | Merged. Adds sitecustomize.py to PythonPlugin to ensure pip-installed packages are found by the global Python interpreter. Fixed spread test failures and package path ordering before final merge. Resolves CRAFT-1721. | |
| #1549 plugins: extract pip from python plugin | snapcraft | merged | Merged a refactor extracting the pip wrapper from the Python plugin. Introduces a public API to improve reusability and testability. Approved by two reviewers with passing CI checks, advancing a larger plugin extraction effort. | |
| #389 plugins: refactor python plugin for subclassing | craft-parts | merged | Merged a refactor of the Python plugin to enable subclassing and method overriding for custom interpreter location logic. Approved by one reviewer, passed CI checks, and modified three files. | |
| #1540 plugins: extract python finder functions | snapcraft | merged | Merged after approvals and CI. Extracts Python finder functions into a shared module as the first step in a series to refactor the python plugin and address bug LP: #1683036. Introduces no functional changes. | |
| #384 plugins: refactor python plugin for subclassing | craft-parts | merged | Merged after review and CI approval. Refactored the Python plugin to enable subclassing and method overriding, allowing custom logic for determining the interpreter location. Rebased on main prior to merge. |