Skip to content

Commit 8532473

Browse files
authored
Document SwiftPM trait resolution workaround in README (#136)
1 parent 7e1d0e0 commit 8532473

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,29 @@ dependencies: [
132132
]
133133
```
134134

135+
> [!IMPORTANT]
136+
> Due to a [Swift Package Manager bug](https://github.com/swiftlang/swift-package-manager/issues/9286),
137+
> dependency resolution may fail when you enable traits,
138+
> producing the error "exhausted attempts to resolve the dependencies graph."
139+
> To work around this issue,
140+
> add the underlying dependencies for each trait directly to your package:
141+
>
142+
> ```swift
143+
> dependencies: [
144+
> .package(
145+
> url: "https://github.com/mattt/AnyLanguageModel.git",
146+
> from: "0.7.0",
147+
> traits: ["CoreML", "MLX", "Llama"]
148+
> ),
149+
> .package(url: "https://github.com/huggingface/swift-transformers", from: "1.0.0"), // CoreML
150+
> .package(url: "https://github.com/ml-explore/mlx-swift-lm", from: "2.25.5"), // MLX
151+
> .package(url: "https://github.com/mattt/llama.swift", from: "2.0.0"), // Llama
152+
> ]
153+
> ```
154+
>
155+
> Include only the dependencies that correspond to the traits you enable.
156+
> For more information, see [issue #135](https://github.com/mattt/AnyLanguageModel/issues/135).
157+
135158
### Using Traits in Xcode Projects
136159
137160
Xcode doesn't yet provide a built-in way to declare package dependencies with traits.

0 commit comments

Comments
 (0)