Skip to content

Commit

Permalink
chore: Improve local dev build speed (#434)
Browse files Browse the repository at this point in the history
- **Tokio on rt-multi-thread only**
- **Remove manual checks from lancedb integration test**
- **Ensure all deps in workspace manifest**
- **Remove unused deps**
- **Remove examples and benchmarks from default members**
  • Loading branch information
timonv authored Nov 5, 2024
1 parent 4a800cf commit 52198f7
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 138 deletions.
14 changes: 0 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 30 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = ["swiftide", "swiftide-*", "examples", "benchmarks"]
default-members = ["swiftide", "swiftide-*"]

resolver = "2"

Expand All @@ -23,7 +24,7 @@ anyhow = { version = "1.0" }
async-trait = { version = "0.1" }
derive_builder = { version = "0.20" }
futures-util = { version = "0.3" }
tokio = { version = "1.41", features = ["full"] }
tokio = { version = "1.41", features = ["rt-multi-thread"] }
tokio-stream = { version = "0.1" }
tracing = { version = "0.1", features = ["log"] }
num_cpus = { version = "1.16" }
Expand Down Expand Up @@ -52,6 +53,34 @@ arrow-array = { version = "52.0", default-features = false }
arrow = { version = "52.2" }
parquet = { version = "52.2", default-features = false, features = ["async"] }
redb = { version = "2.1" }
aws-config = "1.5"
aws-credential-types = "1.2"
aws-sdk-bedrockruntime = "1.37"
criterion = { version = "0.5.1", default-features = false }
darling = "0.20"
deadpool = "0.12"
document-features = "0.2.10"
fastembed = "4.0"
flv-util = "0.5.2"
htmd = "0.1"
ignore = "0.4"
ollama-rs = "0.2.1"
proc-macro2 = "1.0"
quote = "1.0"
redis = "0.27"
reqwest = { version = "0.12.5", default-features = false }
secrecy = "0.8.0"
syn = "2.0"
tera = { version = "1.20", default-features = false }
text-splitter = "0.17"
tracing-subscriber = "0.3"
tree-sitter = "0.23"
tree-sitter-java = "0.23"
tree-sitter-javascript = "0.23"
tree-sitter-python = "0.23"
tree-sitter-ruby = "0.23"
tree-sitter-rust = "0.23"
tree-sitter-typescript = "0.23"

# Testing
test-log = "0.2.16"
Expand Down
9 changes: 1 addition & 8 deletions benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,8 @@ homepage.workspace = true
[dev-dependencies]
tokio = { workspace = true, features = ["full"] }
swiftide = { path = "../swiftide", features = ["all", "redb", "test-utils"] }
swiftide-test-utils = { path = "../swiftide-test-utils", features = [
"test-utils",
] }
tracing-subscriber = "0.3"
serde_json = { workspace = true }
criterion = { version = "0.5.1", features = [
"html_reports",
"async_tokio",
], default-features = false }
criterion = { workspace = true, features = ["html_reports", "async_tokio"] }
anyhow = { workspace = true }
futures-util = { workspace = true }
testcontainers = { workspace = true, features = ["blocking"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ swiftide = { path = "../swiftide/", features = [
"fluvio",
"lancedb",
] }
tracing-subscriber = "0.3"
tracing-subscriber = { workspace = true }
serde_json = { workspace = true }
spider = { workspace = true }
qdrant-client = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion swiftide-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ derive_builder = { workspace = true }
dyn-clone = { workspace = true }
pin-project = { workspace = true }

tera = { version = "1.20", default-features = false }
tera = { workspace = true }
uuid = { workspace = true, features = ["v4", "v3"] }

# Integrations
Expand Down
4 changes: 2 additions & 2 deletions swiftide-indexing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ strum = { workspace = true }
strum_macros = { workspace = true }
indoc = { workspace = true }

ignore = "0.4"
text-splitter = { version = "0.17", features = ["markdown"] }
ignore = { workspace = true }
text-splitter = { workspace = true, features = ["markdown"] }

[dev-dependencies]
swiftide-core = { path = "../swiftide-core", features = ["test-utils"] }
Expand Down
50 changes: 18 additions & 32 deletions swiftide-integrations/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,24 @@ async-openai = { workspace = true, optional = true }
qdrant-client = { workspace = true, optional = true, default-features = false, features = [
"serde",
] }
redis = { version = "0.27", features = [
"aio",
"tokio-comp",
"connection-manager",
"tokio-rustls-comp",
], optional = true }
tree-sitter = { version = "0.23", optional = true }
tree-sitter-rust = { version = "0.23", optional = true }
tree-sitter-python = { version = "0.23", optional = true }
tree-sitter-ruby = { version = "0.23", optional = true }
tree-sitter-typescript = { version = "0.23", optional = true }
tree-sitter-javascript = { version = "0.23", optional = true }
tree-sitter-java = { version = "0.23", optional = true }
fastembed = { version = "4.0", optional = true }
redis = { workspace = true, features = ["aio", "tokio-comp", "connection-manager", "tokio-rustls-comp"], optional = true }
tree-sitter = { workspace = true, optional = true }
tree-sitter-rust = { workspace = true, optional = true }
tree-sitter-python = { workspace = true, optional = true }
tree-sitter-ruby = { workspace = true, optional = true }
tree-sitter-typescript = { workspace = true, optional = true }
tree-sitter-javascript = { workspace = true, optional = true }
tree-sitter-java = { workspace = true, optional = true }
fastembed = { workspace = true, optional = true }
spider = { workspace = true, optional = true }
htmd = { version = "0.1", optional = true }
aws-config = { version = "1.5", features = [
"behavior-version-latest",
], optional = true }
aws-credential-types = { version = "1.2", features = [
"hardcoded-credentials",
], optional = true }
aws-sdk-bedrockruntime = { version = "1.37", features = [
"behavior-version-latest",
], optional = true }
secrecy = { version = "0.8.0", optional = true }
reqwest = { version = "0.12.5", optional = true, default-features = false }
ollama-rs = { version = "0.2.1", optional = true }
deadpool = { version = "0.12", optional = true, features = [
"managed",
"rt_tokio_1",
] }
htmd = { workspace = true, optional = true }
aws-config = { workspace = true, features = ["behavior-version-latest"], optional = true }
aws-credential-types = { workspace = true, features = ["hardcoded-credentials"], optional = true }
aws-sdk-bedrockruntime = { workspace = true, features = ["behavior-version-latest"], optional = true }
secrecy = { workspace = true, optional = true }
reqwest = { workspace = true, optional = true }
ollama-rs = { workspace = true, optional = true }
deadpool = { workspace = true, features = ["managed", "rt_tokio_1"], optional = true }
fluvio = { workspace = true, optional = true }
arrow-array = { workspace = true, optional = true }
lancedb = { workspace = true, optional = true }
Expand All @@ -87,7 +73,7 @@ temp-dir = { workspace = true }
arrow = { workspace = true, features = ["test_utils"] }

# Used for hacking fluv to play nice
flv-util = "0.5.2"
flv-util = { workspace = true }

mockall = { workspace = true }
test-log = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions swiftide-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ homepage.workspace = true
proc-macro = true

[dependencies]
quote = "1.0"
syn = "2.0"
darling = "0.20"
proc-macro2 = "1.0"
quote = { workspace = true }
syn = { workspace = true }
darling = { workspace = true }
proc-macro2 = { workspace = true }

[lints]
workspace = true
5 changes: 0 additions & 5 deletions swiftide-query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ swiftide-core = { path = "../swiftide-core", version = "0.14.1" }
[dev-dependencies]
swiftide-core = { path = "../swiftide-core", features = ["test-utils"] }

test-log = { workspace = true }
testcontainers = { workspace = true }
mockall = { workspace = true }
temp-dir = { workspace = true }
wiremock = { workspace = true }
test-case = { workspace = true }
insta = { workspace = true }


Expand Down
4 changes: 0 additions & 4 deletions swiftide-test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@ qdrant-client = { workspace = true, default-features = false, features = [
] }

anyhow = { workspace = true }
test-log = { workspace = true }
testcontainers = { workspace = true }
mockall = { workspace = true }
temp-dir = { workspace = true }
wiremock = { workspace = true }
test-case = { workspace = true }
insta = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
Expand Down
5 changes: 1 addition & 4 deletions swiftide/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ homepage.workspace = true
[badges]

[dependencies]
document-features = "0.2.10"
document-features = { workspace = true }

# Local dependencies
swiftide-core = { path = "../swiftide-core", version = "0.14" }
Expand Down Expand Up @@ -101,12 +101,9 @@ testcontainers = { workspace = true }
mockall = { workspace = true }
temp-dir = { workspace = true }
wiremock = { workspace = true }
test-case = { workspace = true }
insta = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
lancedb = { workspace = true }
arrow-array = { workspace = true }

[lints]
Expand Down
66 changes: 4 additions & 62 deletions swiftide/tests/lancedb.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
use arrow_array::{cast::AsArray, Array, RecordBatch, StringArray};
use lancedb::query::ExecutableQuery;
use swiftide::indexing;
use swiftide::query::{self, states, Query, TransformationEvent};
use swiftide::{
indexing::{
transformers::{
metadata_qa_code::NAME as METADATA_QA_CODE_NAME, ChunkCode, MetadataQACode,
},
EmbeddedField,
},
query::TryStreamExt as _,
use swiftide::indexing::{
transformers::{metadata_qa_code::NAME as METADATA_QA_CODE_NAME, ChunkCode, MetadataQACode},
EmbeddedField,
};
use swiftide::query::{self, states, Query, TransformationEvent};
use swiftide_indexing::{loaders, transformers, Pipeline};
use swiftide_integrations::{fastembed::FastEmbed, lancedb::LanceDB};
use swiftide_query::{answers, query_transformers, response_transformers};
Expand Down Expand Up @@ -95,55 +88,4 @@ async fn test_lancedb() {
documents.first().unwrap(),
"fn main() { println!(\"Hello, World!\"); }"
);

// Manually assert everything was stored as expected
let conn = lancedb.get_connection().await.unwrap();
let table = conn.open_table("swiftide_test").execute().await.unwrap();

let result: RecordBatch = table
.query()
.execute()
.await
.unwrap()
.try_collect::<Vec<_>>()
.await
.unwrap()
.first()
.unwrap()
.clone();

assert_eq!(result.num_rows(), 1);
assert_eq!(result.num_columns(), 5);
dbg!(result.columns());
assert!(result.column_by_name("id").is_some());
assert_eq!(
result
.column_by_name("chunk")
.unwrap()
.as_any()
.downcast_ref::<StringArray>() // as_string() doesn't work, wtf
.unwrap()
.value(0),
code
);
assert_eq!(
result
.column_by_name("questions_and_answers__code_")
.unwrap()
.as_any()
.downcast_ref::<StringArray>() // as_string() doesn't work, wtf
.unwrap()
.value(0),
"\n\nHello there, how may I assist you today?"
);

assert_eq!(
result
.column_by_name("vector_combined")
.unwrap()
.as_fixed_size_list()
.value(0)
.len(),
384
);
}

0 comments on commit 52198f7

Please sign in to comment.