Remove duplicated dependencies
Calling cargo tree -d --workspace at the root of the repo reveals all of Linfa's duplicated dependencies. These are dependencies that have the same name but different versions, leading to bloat. We want to eliminate as many duplicated dependencies as possible by ensuring that multiple instances of the same crate in the dependency tree have the same version. We should also prioritize the non-dev dependencies since they affect the end users.
I investigated a bit and came up with these different dependency mismatches:
cfg-ifcaused byreqwest, opened an issue here https://github.com/davidMcneil/mnist/issues/7generic-arraycaused byndarray-npywhich we can bump once we moved tondarray = 0.15getrandom,rand,rand-chacha,rand_corecaused by usingrand = 0.8inlinfa, we could downgrade to0.7here or wait for the ndarray bumphashbrowncaused by an old version ofhnsw. This also requires a bump inndarray-stats/indexmap/hashbrowndependency to be on the latest version, opened a PR https://github.com/bluss/indexmap/pull/193itertoolscaused by inconsistency incriterion's dependency graph and old version ofndarray-stats(can be updated once we havendarray = 0.15)num-bigint,num-complexcaused byndarray-npywhich can only be updated once we bump ndarray itselfpin-project-litecaused by inconcistency inreqwestdependency graph, also depends on https://github.com/davidMcneil/mnist/issues/7socket2caused by usingreqwestandcurltimecaused byreqwestas well, which uses an older version compared toargmin
the problems are therefore originating from three sources:
- we need the
ndarraybump to be consistent to the ecosystem reqwestindexmapuses an older version ofhashbrown
reqwest is not a big deal because it only affects dev-dependencies. Does downgrading rand in linfa break anything?
reqwestis not a big deal because it only affects dev-dependencies. Does downgradingrandinlinfabreak anything?
yes the ndarray bump is the main issue here. Downgrading rand requires reverting some function signatures. The dependency tree of rand is not really worth the work
After bumping ndarray to v0.15, approx is still duplicated since argmin v0.4.6 uses approx v0.5 but ndarray uses approx v0.4.
Update: Following are the main sources behind duplicated dependencies:
- [ ]
approxinconsistency betweenndarrayandargmin - [x]
mnistusingreqwest, which has a lot of dupes (davidMcneil/mnist#7)
Is using the approx-0_5 feature in ndarray a potential solution to the approx duplication?
Otherwise, the approx bump is coming in v0.16.0 of ndarray
The approx-0_5 feature should solve the issue. Double-check to make sure.