From de7466d55ef9f150d4bace382b99cca0442cbfa4 Mon Sep 17 00:00:00 2001 From: Mike Fortman Date: Mon, 6 Oct 2025 13:58:45 -0500 Subject: [PATCH] Fix: improve linux support (#10137) * improve linux support * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Edwin Jose --- src/lfx/src/lfx/utils/util.py | 13 +++++---- uv.lock | 55 +++++++++++++++++------------------ 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/lfx/src/lfx/utils/util.py b/src/lfx/src/lfx/utils/util.py index 84e574da29..224dddb94a 100644 --- a/src/lfx/src/lfx/utils/util.py +++ b/src/lfx/src/lfx/utils/util.py @@ -4,6 +4,8 @@ import inspect import json import os import re +import socket +import struct from functools import wraps from pathlib import Path from typing import Any @@ -55,8 +57,6 @@ def get_container_host() -> str | None: Returns: The hostname or IP to use, or None if not in a container. """ - import socket - # Check if we're in a container first container_type = detect_container_environment() if not container_type: @@ -99,16 +99,17 @@ def get_container_host() -> str | None: # Fallback: try to get gateway IP from routing table (Linux containers) try: with Path("/proc/net/route").open() as f: + # Skip header + next(f) for line in f: fields = line.strip().split() min_field_count = 3 # Minimum fields needed: interface, destination, gateway if len(fields) >= min_field_count and fields[1] == "00000000": # Default route # Gateway is in hex format (little-endian) gateway_hex = fields[2] - # Convert hex to IP address - # The hex is in little-endian format, so we read it backwards in pairs - octets = [gateway_hex[i : i + 2] for i in range(0, 8, 2)] - return ".".join(str(int(octet, 16)) for octet in reversed(octets)) + # Convert little-endian hex to dotted IPv4 + gw_int = int(gateway_hex, 16) + return socket.inet_ntoa(struct.pack("= '3.13' and platform_machine == 'arm64' and sys_platform == 'darwin'", @@ -4990,8 +4990,8 @@ dependencies = [ { name = "mem0ai" }, { name = "metal-sdk" }, { name = "metaphor-python" }, - { name = "mlx", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "mlx-vlm", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, + { name = "mlx", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "mlx-vlm", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, { name = "needle-python" }, { name = "networkx" }, { name = "nltk" }, @@ -5198,8 +5198,8 @@ requires-dist = [ { name = "mem0ai", specifier = "==0.1.34" }, { name = "metal-sdk", specifier = "==2.5.1" }, { name = "metaphor-python", specifier = "==0.1.23" }, - { name = "mlx", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'", specifier = ">=0.29.0" }, - { name = "mlx-vlm", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'", specifier = "==0.3.3" }, + { name = "mlx", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'", specifier = ">=0.29.0" }, + { name = "mlx-vlm", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'", specifier = "==0.3.3" }, { name = "needle-python", specifier = ">=0.4.0,<1.0.0" }, { name = "networkx", specifier = "==3.4.2" }, { name = "nltk", specifier = "==3.9.1" }, @@ -6440,7 +6440,7 @@ name = "mlx" version = "0.29.2" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "mlx-metal", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, + { name = "mlx-metal", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, ] wheels = [ { url = "https://files.pythonhosted.org/packages/3f/f0/2c2f99a91ed9dfcc78d31d9e5d3bb2f5305a8d65953cbc41f34f8056c49a/mlx-0.29.2-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:b46c1a24b9b8f7145e4d84410552ddfa03f40f9afdbe8f819f6b4b52b4db5d30", size = 547369, upload-time = "2025-09-26T22:21:33.668Z" }, @@ -6462,12 +6462,12 @@ name = "mlx-lm" version = "0.28.2" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "jinja2", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "mlx", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "protobuf", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "pyyaml", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "transformers", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, + { name = "jinja2", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "mlx", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "protobuf", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "pyyaml", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "transformers", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/1c/d7/fdde445c7bd443a2ed23badda6064f1477c4051543922106f365e94082cd/mlx_lm-0.28.2.tar.gz", hash = "sha256:d28752635ed5c89ff2b41361916c928e6b16f765c07b2908044e1dcaf921ed9b", size = 209374, upload-time = "2025-10-02T14:23:57.497Z" } wheels = [ @@ -6489,19 +6489,19 @@ name = "mlx-vlm" version = "0.3.3" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "datasets", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "fastapi", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "mlx", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "mlx-lm", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "opencv-python", version = "4.12.0.88", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "pillow", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "requests", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "scipy", version = "1.16.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "soundfile", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "tqdm", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "transformers", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "uvicorn", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, + { name = "datasets", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "fastapi", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "mlx", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "mlx-lm", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "opencv-python", version = "4.12.0.88", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "pillow", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "requests", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "scipy", version = "1.16.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "soundfile", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "tqdm", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "transformers", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "uvicorn", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/ff/9f/de419334820da334203de28eaf861b57ae0d06b0882770e5e5d0671dc5dd/mlx_vlm-0.3.3.tar.gz", hash = "sha256:5a08c802d1bf32cc47bd6aebe348d3554ce21bfce417a585bba83f9d213a6e66", size = 231935, upload-time = "2025-08-20T14:52:51.323Z" } wheels = [ @@ -11497,13 +11497,12 @@ name = "soundfile" version = "0.13.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "cffi", marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, - { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and sys_platform == 'darwin'" }, + { name = "cffi", marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and platform_machine == 'arm64' and sys_platform == 'darwin'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/e1/41/9b873a8c055582859b239be17902a85339bec6a30ad162f98c9b0288a2cc/soundfile-0.13.1.tar.gz", hash = "sha256:b2c68dab1e30297317080a5b43df57e302584c49e2942defdde0acccc53f0e5b", size = 46156, upload-time = "2025-01-25T09:17:04.831Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/64/28/e2a36573ccbcf3d57c00626a21fe51989380636e821b341d36ccca0c1c3a/soundfile-0.13.1-py2.py3-none-any.whl", hash = "sha256:a23c717560da2cf4c7b5ae1142514e0fd82d6bbd9dfc93a50423447142f2c445", size = 25751, upload-time = "2025-01-25T09:16:44.235Z" }, - { url = "https://files.pythonhosted.org/packages/ea/ab/73e97a5b3cc46bba7ff8650a1504348fa1863a6f9d57d7001c6b67c5f20e/soundfile-0.13.1-py2.py3-none-macosx_10_9_x86_64.whl", hash = "sha256:82dc664d19831933fe59adad199bf3945ad06d84bc111a5b4c0d3089a5b9ec33", size = 1142250, upload-time = "2025-01-25T09:16:47.583Z" }, { url = "https://files.pythonhosted.org/packages/a0/e5/58fd1a8d7b26fc113af244f966ee3aecf03cb9293cb935daaddc1e455e18/soundfile-0.13.1-py2.py3-none-macosx_11_0_arm64.whl", hash = "sha256:743f12c12c4054921e15736c6be09ac26b3b3d603aef6fd69f9dde68748f2593", size = 1101406, upload-time = "2025-01-25T09:16:49.662Z" }, ]