linfa
linfa copied to clipboard
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-if
caused byreqwest
, opened an issue here https://github.com/davidMcneil/mnist/issues/7 -
generic-array
caused byndarray-npy
which we can bump once we moved tondarray = 0.15
-
getrandom
,rand
,rand-chacha
,rand_core
caused by usingrand = 0.8
inlinfa
, we could downgrade to0.7
here or wait for the ndarray bump -
hashbrown
caused by an old version ofhnsw
. This also requires a bump inndarray-stats/indexmap/hashbrown
dependency to be on the latest version, opened a PR https://github.com/bluss/indexmap/pull/193 -
itertools
caused by inconsistency incriterion
's dependency graph and old version ofndarray-stats
(can be updated once we havendarray = 0.15
) -
num-bigint
,num-complex
caused byndarray-npy
which can only be updated once we bump ndarray itself -
pin-project-lite
caused by inconcistency inreqwest
dependency graph, also depends on https://github.com/davidMcneil/mnist/issues/7 -
socket2
caused by usingreqwest
andcurl
-
time
caused byreqwest
as well, which uses an older version compared toargmin
the problems are therefore originating from three sources:
- we need the
ndarray
bump to be consistent to the ecosystem -
reqwest
-
indexmap
uses an older version ofhashbrown
reqwest
is not a big deal because it only affects dev-dependencies. Does downgrading rand
in linfa
break anything?
reqwest
is not a big deal because it only affects dev-dependencies. Does downgradingrand
inlinfa
break 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:
- [ ]
approx
inconsistency betweenndarray
andargmin
- [x]
mnist
usingreqwest
, 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.