Add numpy to system import tests (#2380)

Installing and importing numpy tests for two cases:

* The python architecture and the package architecture don't match
(https://github.com/astral-sh/uv/issues/2326)
* The libc of python and that of the package don't match on linux
(musllinux vs manylinux, picking a compatible manylinux version)

All pylint deps are py3-none-any, so they don't catch those cases.
This commit is contained in:
konsti 2024-03-18 14:09:32 +01:00 committed by GitHub
parent 4c59aefdb7
commit 15f1d65751
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 1 deletions

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python3
"""Install `pylint` into the system Python."""
"""Install `pylint` and `numpy` into the system Python.
To run locally, create a venv with seed packages.
"""
import argparse
import logging
@ -9,6 +12,25 @@ import subprocess
import sys
import tempfile
def numpy():
"""sys.version_info"""
logging.info("Installing the package `numpy`.")
subprocess.run(
[uv, "pip", "install", "numpy", "--system"] + allow_externally_managed,
cwd=temp_dir,
check=True,
)
# Check that the native libraries of numpy work.
logging.info("Checking that `numpy` can be imported.")
code = subprocess.run(
[sys.executable, "-c", "import numpy"],
cwd=temp_dir,
)
if code.returncode != 0:
raise Exception("Could not import numpy.")
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
@ -135,3 +157,7 @@ if __name__ == "__main__":
raise Exception(
"The package `pylint` isn't installed in the virtual environment."
)
# Numpy doesn't have wheels for python 3.13 (at the time of writing)
if sys.version_info < (3, 13):
numpy()