From d94b8d8d14d8226aa96f8c0cca0be21ff1b81d42 Mon Sep 17 00:00:00 2001 From: Mattt Zmuda Date: Thu, 19 Feb 2026 14:01:38 -0800 Subject: [PATCH] Document SwiftPM trait resolution workaround in README --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index d8de89d..2abda96 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,29 @@ dependencies: [ ] ``` +> [!IMPORTANT] +> Due to a [Swift Package Manager bug](https://github.com/swiftlang/swift-package-manager/issues/9286), +> dependency resolution may fail when you enable traits, +> producing the error "exhausted attempts to resolve the dependencies graph." +> To work around this issue, +> add the underlying dependencies for each trait directly to your package: +> +> ```swift +> dependencies: [ +> .package( +> url: "https://github.com/mattt/AnyLanguageModel.git", +> from: "0.7.0", +> traits: ["CoreML", "MLX", "Llama"] +> ), +> .package(url: "https://github.com/huggingface/swift-transformers", from: "1.0.0"), // CoreML +> .package(url: "https://github.com/ml-explore/mlx-swift-lm", from: "2.25.5"), // MLX +> .package(url: "https://github.com/mattt/llama.swift", from: "2.0.0"), // Llama +> ] +> ``` +> +> Include only the dependencies that correspond to the traits you enable. +> For more information, see [issue #135](https://github.com/mattt/AnyLanguageModel/issues/135). + ### Using Traits in Xcode Projects Xcode doesn't yet provide a built-in way to declare package dependencies with traits.