From 6c1d7358f0337ad193aa8dded9dd6d879e49d3a1 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Tue, 30 Jul 2024 13:11:05 -0700 Subject: [PATCH] unpin numpy (#33132) * unlock numpy * remove old cache * sheel * lock * remove temp * depends * export * put this back * use __version__ * move this --------- Co-authored-by: quebec old-commit-hash: 9536dd07c6b0f972db70b344ae2f676e031ea038 --- SConstruct | 5 +++-- pyproject.toml | 2 +- selfdrive/controls/lib/lateral_mpc_lib/SConscript | 3 ++- selfdrive/controls/lib/longitudinal_mpc_lib/SConscript | 3 ++- site_scons/site_tools/cython.py | 3 +++ uv.lock | 6 +++--- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/SConstruct b/SConstruct index fb5c43c9ad..47f2db9661 100644 --- a/SConstruct +++ b/SConstruct @@ -229,7 +229,7 @@ env = Environment( COMPILATIONDB_USE_ABSPATH=True, REDNOSE_ROOT="#", tools=["default", "cython", "compilation_db", "rednose_filter"], - toolpath=["#rednose_repo/site_scons/site_tools"], + toolpath=["#site_scons/site_tools", "#rednose_repo/site_scons/site_tools"], ) if arch == "Darwin": @@ -268,7 +268,8 @@ if arch == "Darwin": else: envCython["LINKFLAGS"] = ["-pthread", "-shared"] -Export('envCython') +np_version = SCons.Script.Value(np.__version__) +Export('envCython', 'np_version') # Qt build environment qt_env = env.Clone() diff --git a/pyproject.toml b/pyproject.toml index 4c1e134431..1473cf5707 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ dependencies = [ "pycapnp", "Cython", "setuptools", - "numpy < 2.0.0", # control does not support numpy 2 + "numpy", # body / webrtcd "aiohttp", diff --git a/selfdrive/controls/lib/lateral_mpc_lib/SConscript b/selfdrive/controls/lib/lateral_mpc_lib/SConscript index 73242cb8f9..2c03da06a6 100644 --- a/selfdrive/controls/lib/lateral_mpc_lib/SConscript +++ b/selfdrive/controls/lib/lateral_mpc_lib/SConscript @@ -1,4 +1,4 @@ -Import('env', 'envCython', 'arch', 'msgq_python', 'common_python', 'opendbc_python') +Import('env', 'envCython', 'arch', 'msgq_python', 'common_python', 'opendbc_python', 'np_version') gen = "c_generated_code" @@ -88,3 +88,4 @@ lenv2.Command(libacados_ocp_solver_c, f' {acados_ocp_solver_pyx.get_labspath()}') lib_cython = lenv2.Program(f'{gen}/acados_ocp_solver_pyx.so', [libacados_ocp_solver_c]) lenv2.Depends(lib_cython, lib_solver) +lenv2.Depends(libacados_ocp_solver_c, np_version) diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript b/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript index 592c1c2c2d..fc1e844d50 100644 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript +++ b/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript @@ -1,4 +1,4 @@ -Import('env', 'envCython', 'arch', 'msgq_python', 'common_python', 'opendbc_python') +Import('env', 'envCython', 'arch', 'msgq_python', 'common_python', 'opendbc_python', 'np_version') gen = "c_generated_code" @@ -94,3 +94,4 @@ lenv2.Command(libacados_ocp_solver_c, f' {acados_ocp_solver_pyx.get_labspath()}') lib_cython = lenv2.Program(f'{gen}/acados_ocp_solver_pyx.so', [libacados_ocp_solver_c]) lenv2.Depends(lib_cython, lib_solver) +lenv2.Depends(libacados_ocp_solver_c, np_version) diff --git a/site_scons/site_tools/cython.py b/site_scons/site_tools/cython.py index c291475533..f11db1d71b 100644 --- a/site_scons/site_tools/cython.py +++ b/site_scons/site_tools/cython.py @@ -2,14 +2,17 @@ import re import SCons from SCons.Action import Action from SCons.Scanner import Scanner +import numpy as np pyx_from_import_re = re.compile(r'^from\s+(\S+)\s+cimport', re.M) pyx_import_re = re.compile(r'^cimport\s+(\S+)', re.M) cdef_import_re = re.compile(r'^cdef extern from\s+.(\S+).:', re.M) +np_version = SCons.Script.Value(np.__version__) def pyx_scan(node, env, path, arg=None): contents = node.get_text_contents() + env.Depends(str(node).split('.')[0] + env['CYTHONCFILESUFFIX'], np_version) # from cimport ... matches = pyx_from_import_re.findall(contents) diff --git a/uv.lock b/uv.lock index 2913075f5b..ded3ddec7c 100644 --- a/uv.lock +++ b/uv.lock @@ -4977,11 +4977,11 @@ wheels = [ [[distribution]] name = "setuptools" -version = "71.1.0" +version = "72.1.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/32/c0/5b8013b5a812701c72e3b1e2b378edaa6514d06bee6704a5ab0d7fa52931/setuptools-71.1.0.tar.gz", hash = "sha256:032d42ee9fb536e33087fb66cac5f840eb9391ed05637b3f2a76a7c8fb477936", size = 2422233 } +sdist = { url = "https://files.pythonhosted.org/packages/5e/11/487b18cc768e2ae25a919f230417983c8d5afa1b6ee0abd8b6db0b89fa1d/setuptools-72.1.0.tar.gz", hash = "sha256:8d243eff56d095e5817f796ede6ae32941278f542e0f941867cc05ae52b162ec", size = 2419487 } wheels = [ - { url = "https://files.pythonhosted.org/packages/51/a0/ee460cc54e68afcf33190d198299c9579a5eafeadef0016ae8563237ccb6/setuptools-71.1.0-py3-none-any.whl", hash = "sha256:33874fdc59b3188304b2e7c80d9029097ea31627180896fb549c578ceb8a0855", size = 2341722 }, + { url = "https://files.pythonhosted.org/packages/e1/58/e0ef3b9974a04ce9cde2a7a33881ddcb2d68450803745804545cdd8d258f/setuptools-72.1.0-py3-none-any.whl", hash = "sha256:5a03e1860cf56bb6ef48ce186b0e557fdba433237481a9a625176c2831be15d1", size = 2337965 }, ] [[distribution]]