Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy over Python headers during staged build #2607

Merged
merged 1 commit into from Mar 14, 2022

Conversation

HippocampusGirl
Copy link
Contributor

  • I am using the Mypy type checker as part of the super linter. Mypy requires type information for packages imported by my code. For some packages it can get these by installing type stubs, which super linter supports nicely (https://github.com/github/super-linter/pull/1937), but for other packages such as Numpy and Scipy, the package itself needs to be installed.

  • I would like to be able to run pip install numpy inside the container, but sadly this fails, because the Python headers are missing from the container.

  • One commenter https://github.com/github/super-linter/issues/157#issuecomment-648850330 suggests some ideas for how to bind external packages into the super linter, but unfortunately that will not work for Mypy, which does not check PYTHONPATH or other environment variables for external directories containing packages. Instead, everything needs to be installed directly into the virtual environment from which Mypy is run. Proposals to change this have not yet been merged, see for example sitecustomize/full sys.path support python/mypy#5701.

Proposed Changes

  1. Copy over the Python headers in /usr/local/include from the base image during the container build. This will add approximately one megabyte to the container size.

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request

Reviewing Maintainer

  • Label as breaking if this is a large fundamental change
  • Label as either automation, bug, documentation, enhancement, infrastructure, or performance

@ferrarimarco
Copy link
Collaborator

Hi @HippocampusGirl. Thanks for the PR. Let's see how the CI jobs go :)

- Allow the installation of Python packages that require compilation
  inside the container
@HippocampusGirl
Copy link
Contributor Author

Let's hope that rebasing on the main branch will fix the vulnerability scan failure :-)

@admiralAwkbar admiralAwkbar merged commit 40963a5 into super-linter:main Mar 14, 2022
@HippocampusGirl HippocampusGirl deleted the fix/python-headers branch March 14, 2022 14:36
sarahc23 pushed a commit to 23andMe/super-linter that referenced this pull request May 6, 2022
- Allow the installation of Python packages that require compilation
  inside the container
sarahc23 pushed a commit to 23andMe/super-linter that referenced this pull request May 6, 2022
- Allow the installation of Python packages that require compilation
  inside the container
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.

None yet

3 participants