Skip to content

Commit

Permalink
[CHORE] drop unused deps and add machete CI check (#2520)
Browse files Browse the repository at this point in the history
* removes unneeded deps for daft crates
* adds check for them in the future in CI via cargo machete
  • Loading branch information
samster25 authored Jul 17, 2024
1 parent eb040ce commit fe98e80
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 116 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,20 @@ jobs:
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1

check-unused-cargo-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
with:
cache: false
channel: stable

- name: Install Machete
run: cargo +stable install cargo-machete
- name: Run Machete
run: cargo machete --with-metadata

doctests:
runs-on: ubuntu-latest
continue-on-error: true
Expand Down
62 changes: 0 additions & 62 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ name = "daft"
publish = false
version = "0.2.0-dev0"

[package.metadata.cargo-machete]
ignored = ["lzma_sys"]

[patch.crates-io]
arrow2 = {path = "src/arrow2"}
parquet2 = {path = "src/parquet2"}
Expand Down
3 changes: 3 additions & 0 deletions src/arrow2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,8 @@ version = "0.17.4"
[package.metadata.cargo-all-features]
allowlist = ["compute", "compute_sort", "compute_hash", "compute_nullif"]

[package.metadata.cargo-machete]
ignored = ["arrow_array", "arrow_buffer", "avro_rs", "criterion", "crossbeam_channel", "flate2", "getrandom", "rustc_version", "sample_arrow2", "sample_std", "sample_test", "tokio", "tokio_util"]

[target.wasm32-unknown-unknown.dependencies]
getrandom = {version = "0.2", features = ["js"]}
1 change: 0 additions & 1 deletion src/common/daft-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[dependencies]
bincode = {workspace = true}
common-io-config = {path = "../io-config", default-features = false}
lazy_static = {workspace = true}
pyo3 = {workspace = true, optional = true}
serde = {workspace = true}

Expand Down
1 change: 0 additions & 1 deletion src/common/treenode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[dependencies]
common-error = {path = "../error", default-features = false}
pyo3 = {workspace = true, optional = true}

[features]
python = ["common-error/python"]
Expand Down
2 changes: 0 additions & 2 deletions src/daft-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ common-daft-config = {path = "../common/daft-config", default-features = false}
common-error = {path = "../common/error", default-features = false}
daft-minhash = {path = "../daft-minhash", default-features = false}
daft-sketch = {path = "../daft-sketch", default-features = false}
dyn-clone = "1.0.17"
fastrand = "2.1.0"
fnv = "1.0.7"
html-escape = {workspace = true}
Expand All @@ -40,7 +39,6 @@ ndarray = "0.15.6"
num-derive = {workspace = true}
num-traits = {workspace = true}
pyo3 = {workspace = true, optional = true}
rand = {workspace = true}
regex = {workspace = true}
serde = {workspace = true}
serde_json = {workspace = true}
Expand Down
9 changes: 7 additions & 2 deletions src/daft-core/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ pub mod display_table;
pub mod hashable_float_wrapper;
pub mod supertype;

pub use bincode;

#[macro_export]
macro_rules! impl_binary_trait_by_reference {
($ty:ty, $trait:ident, $fname:ident) => {
Expand All @@ -26,7 +28,10 @@ macro_rules! impl_bincode_py_state_serialization {
Self::type_object(py)
.getattr("_from_serialized")?
.to_object(py),
(PyBytes::new(py, &bincode::serialize(&self).unwrap()).to_object(py),)
(
PyBytes::new(py, &$crate::utils::bincode::serialize(&self).unwrap())
.to_object(py),
)
.to_object(py),
))
}
Expand All @@ -35,7 +40,7 @@ macro_rules! impl_bincode_py_state_serialization {
pub fn _from_serialized(py: Python, serialized: PyObject) -> PyResult<Self> {
serialized
.extract::<&PyBytes>(py)
.map(|s| bincode::deserialize(s.as_bytes()).unwrap())
.map(|s| $crate::utils::bincode::deserialize(s.as_bytes()).unwrap())
}
}
};
Expand Down
8 changes: 0 additions & 8 deletions src/daft-csv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ arrow2 = {workspace = true, features = ["io_csv", "io_csv_async"]}
async-compat = {workspace = true}
async-compression = {workspace = true}
async-stream = {workspace = true}
bincode = {workspace = true}
bytes = {workspace = true}
chrono = {workspace = true}
chrono-tz = {workspace = true}
common-error = {path = "../common/error", default-features = false}
csv-async = "1.3.0"
daft-compression = {path = "../daft-compression", default-features = false}
Expand All @@ -16,15 +12,11 @@ daft-dsl = {path = "../daft-dsl", default-features = false}
daft-io = {path = "../daft-io", default-features = false}
daft-table = {path = "../daft-table", default-features = false}
futures = {workspace = true}
lexical-core = {version = "0.8"}
log = {workspace = true}
pyo3 = {workspace = true, optional = true}
rayon = {workspace = true}
serde = {workspace = true}
simdutf8 = "0.1.3"
snafu = {workspace = true}
tokio = {workspace = true}
tokio-stream = {workspace = true}
tokio-util = {workspace = true}
url = {workspace = true}

Expand Down
4 changes: 0 additions & 4 deletions src/daft-decoding/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
[dependencies]
arrow2 = {workspace = true, features = ["io_csv", "io_csv_async"]}
async-compression = {workspace = true}
atoi_simd = "0.15.5"
chrono = {workspace = true}
chrono-tz = {workspace = true}
csv-async = "1.2.6"
fast-float = "0.2.0"
simdutf8 = "0.1.3"
tokio = {workspace = true}
url = {workspace = true}

[package]
edition = {workspace = true}
Expand Down
Loading

0 comments on commit fe98e80

Please sign in to comment.