Skip to content

Support per-project Python versions in Docker with safe compile wrapper#110

Open
Sonzakir wants to merge 2 commits into
soarsmu:masterfrom
Sonzakir:fix/docker-project-python-versions
Open

Support per-project Python versions in Docker with safe compile wrapper#110
Sonzakir wants to merge 2 commits into
soarsmu:masterfrom
Sonzakir:fix/docker-project-python-versions

Conversation

@Sonzakir
Copy link
Copy Markdown

@Sonzakir Sonzakir commented May 9, 2026

Summary

  • This PR updates the BugsInPy Docker workflow so checked-out projects are compiled with the Python version declared by their own BugsInPy metadata instead of always using the Docker image’s default Python.

  • Previously, the Docker image was based on Python 3.12. That caused many BugsInPy projects to fail during compilation because their dependencies were pinned for older Python versions, usually in the 3.6-3.8 range. For example, some old dependencies try to build C extensions that are no longer compatible with Python 3.12, so compilation fails before the actual buggy project can even be tested.

What changed:

  • Replaced the fixed python:3.12-slim-trixie base image
  • Added pyenv to the Docker image so multiple Python versions can be installed and selected inside one container.
  • Removed pre-installation of project Python versions during Docker build.
  • Python versions are now installed lazily, only when a checked-out project is compiled.
  • Added a new wrapper script: bugsinpy-safe-compile.
    • The wrapper reads the required Python version from the current checkout’s bugsinpy_bug.info.
    • It sets the checkout-local Python version using .python-version.
    • It then runs the existing bugsinpy-compile command.
  • This helps projects like old black versions generate/import package metadata correctly.

Why this is useful:

  • One container can compile projects requiring different Python versions.
    • Projects with the same Python version but conflicting dependencies are still isolated because bugsinpy-compile creates a separate env virtual environment inside each checked-out project.
  • The existing BugsInPy scripts remain mostly untouched; this PR adds a safer wrapper around the existing compile behavior.
  • The Docker image builds faster because it no longer compiles Python version during image build.

Example usage

bugsinpy-checkout -p black -i 1 -v 0 -w /home/workspace/black-bug1
cd /home/workspace/black-bug1/black
bugsinpy-safe-compile
bugsinpy-test

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.

1 participant