Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is arrow a peer dependency? #31

Open
domoritz opened this issue Mar 14, 2024 · 3 comments
Open

Why is arrow a peer dependency? #31

domoritz opened this issue Mar 14, 2024 · 3 comments

Comments

@domoritz
Copy link

Shouldn't it be a normal dependency with a flexible range of allowed versions? Having two package versions seems fishy.

@jraymakers
Copy link
Collaborator

jraymakers commented Mar 14, 2024

We found that when different parts of an application depended on apache-arrow directly, multiple copies of this package could get pulled in. If this happens, breaking bugs can occur. Several parts of apache-arrow use instanceof to check the type of objects (e.g. RecordBatch, Table). If multiple copies of the library are in use, multiple instances of each type object exist, so these checks can unexpectedly return false when comparing two semantically-equivalent but distinct copies of the "same" type.

By making apache-arrow a peer dependency, with a range that matches the version of apache-arrow used by the version of duckdb-wasm we depend on, we ensure there is only a single copy around.

@domoritz
Copy link
Author

What if instead you make it a dependency but you allow any version (*)? Would the bundler resolve the dependency to a single version rather than a copy?

I guess the underlying issue is that arrow does not follow semantic versioning.

@jraymakers
Copy link
Collaborator

We do depend on some fixes & features in the newer versions, so "*" isn't really correct. I'm not sure whether it would resolve the multi-copy issue. It's hard to reason about the many different dependency and bundler configurations that applications might use.

The updated SDK I'm working on changes the dependency structure. (In particular, we'll depend on duckdb-wasm using NPM, instead of using a version built & hosted by MotherDuck.) As I work on that, I'll investigate whether there's a simpler solution to this problem that doesn't require peer dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants