Repository navigation
Expand file tree
/
Copy pathPackage.swift
More file actions
67 lines (66 loc) · 3.84 KB
/
Copy pathPackage.swift
File metadata and controls
67 lines (66 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// swift-tools-version: 6.0
import PackageDescription
// notebookMLX, as a library first.
//
// The app is an Xcode target and cannot run its tests from the command line;
// everything that can be decided without a window lives here instead, so it is
// testable with `swift test` and reviewable without opening Xcode. The same
// split the agent uses, for the same reason.
let package = Package(
name: "NotebookKit",
platforms: [.macOS(.v14)],
products: [
.library(name: "NotebookKit", targets: ["NotebookKit"]),
.executable(name: "notebook-demo", targets: ["notebook-demo"]),
.executable(name: "NotebookApp", targets: ["NotebookApp"]),
.executable(name: "notebook-import", targets: ["notebook-import"]),
.executable(name: "notebook-verify", targets: ["notebook-verify"]),
.executable(name: "notebook-reembed", targets: ["notebook-reembed"]),
.executable(name: "notebook-ingest", targets: ["notebook-ingest"]),
],
dependencies: [
// xlsx is a zip of XML, so reading one means unzipping and parsing
// rather than a format decision. CoreXLSX is MIT, has no dependencies
// of its own beyond XMLCoder, and is far less code than the two we
// would otherwise write and own. The alternative was ZIPFoundation
// plus XMLParser, which is the same work with our name on it.
.package(url: "https://github.com/CoreOffice/CoreXLSX.git", from: "0.14.2"),
// The same fork the agent builds against, pinned to the same exact
// revision. Two copies of MLXEmbedders at different revisions could
// pool or normalise differently, and an index built by one would be
// silently incomparable with a query from the other.
//
// This used to be a path into the agent's checkout, which made
// agreement structural - there was only ever one copy. Now they are two
// pins that have to match, and nothing about a mismatch is loud, so a
// test asserts the two Package.resolved files name the same revision.
.package(url: "https://github.com/djsincla/mlx-swift-examples.git",
revision: "6090aa0791f8994d0488ec9248f33b7534ce9e5b"),
],
targets: [
.target(name: "NotebookKit", dependencies: [
.product(name: "CoreXLSX", package: "CoreXLSX"),
.product(name: "MLXEmbedders", package: "mlx-swift-examples"),
]),
// Writes a notebook so the format can be checked against rag_ask.py.
.executableTarget(name: "notebook-demo", dependencies: ["NotebookKit"]),
// The app. Built as an executable and wrapped into a bundle by
// packaging/make-app.sh, so it runs from the command line during
// development and becomes a document app in Xcode later.
.executableTarget(name: "NotebookApp", dependencies: ["NotebookKit"]),
// Adopts an index that already exists, so work already done is not
// done again. See Sources/notebook-import/main.swift.
.executableTarget(name: "notebook-import", dependencies: ["NotebookKit"]),
// Checks this embedder against the agent's fixture. See its main.swift
// for why it is a command and not a test.
.executableTarget(name: "notebook-verify", dependencies: ["NotebookKit"]),
// Re-embeds an existing notebook with a different model, keeping its
// chunks and citations. See its main.swift.
.executableTarget(name: "notebook-reembed", dependencies: ["NotebookKit"]),
// Ingests one document and reports memory as it goes, so a fix to the
// memory an import costs can be measured. See its main.swift.
.executableTarget(name: "notebook-ingest", dependencies: ["NotebookKit"]),
.testTarget(name: "NotebookKitTests", dependencies: ["NotebookKit"],
resources: [.copy("Fixtures")]),
]
)