Copy over Python headers during staged build #2607
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
/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
Reviewing Maintainer
breaking
if this is a large fundamental changeautomation
,bug
,documentation
,enhancement
,infrastructure
, orperformance