From bac1708248e9d261ce096e1861bb4282f3c61b51 Mon Sep 17 00:00:00 2001 From: Mattt Zmuda Date: Tue, 27 Oct 2026 08:08:04 -0700 Subject: [PATCH] Allow swift-jinja 3.0 --- Package.swift | 2 +- Package@swift-6.1.swift | 2 +- Tests/HubTests/ConfigTests.swift | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index 1e09d29c..9a9a8115 100644 --- a/Package.swift +++ b/Package.swift @@ -17,7 +17,7 @@ let package = Package( .library(name: "Transformers", targets: ["Tokenizers", "Generation", "Models"]), ], dependencies: [ - .package(url: "https://github.com/huggingface/swift-jinja.git", from: "2.4.2"), + .package(url: "https://github.com/huggingface/swift-jinja.git", "2.4.2"..<"4.0.0"), .package(url: "https://github.com/huggingface/swift-huggingface.git", "0.8.1"..<"2.0.0"), .package(url: "https://github.com/apple/swift-collections.git", from: "1.0.0"), .package(url: "https://github.com/apple/swift-crypto.git", "3.0.0"..<"5.0.0"), diff --git a/Package@swift-6.1.swift b/Package@swift-6.1.swift index c1d584a5..b2d4f3fc 100644 --- a/Package@swift-6.1.swift +++ b/Package@swift-6.1.swift @@ -23,7 +23,7 @@ let package = Package( ) ], dependencies: [ - .package(url: "https://github.com/huggingface/swift-jinja.git", from: "2.4.2"), + .package(url: "https://github.com/huggingface/swift-jinja.git", "2.4.2"..<"4.0.0"), // Work around SwiftPM trait resolution issue for transitive Xet dependency. .package(url: "https://github.com/huggingface/swift-xet.git", "0.2.0"..<"2.0.0"), .package( diff --git a/Tests/HubTests/ConfigTests.swift b/Tests/HubTests/ConfigTests.swift index 509602e4..2182a814 100644 --- a/Tests/HubTests/ConfigTests.swift +++ b/Tests/HubTests/ConfigTests.swift @@ -437,6 +437,9 @@ struct ConfigTests { "config": cfg.jinjaValue() ]) - #expect(got == exp) + // swift-jinja 3 prints booleans as Python does. + let expPython = exp.replacingOccurrences(of: "true", with: "True") + .replacingOccurrences(of: "false", with: "False") + #expect(got == exp || got == expPython) } }