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

chore: Remove numpy dependency #918

Open
zilto opened this issue May 27, 2024 · 2 comments
Open

chore: Remove numpy dependency #918

zilto opened this issue May 27, 2024 · 2 comments
Labels
plugin Relates to a Hamilton plugin (adapters, materializers, etc.) refactor

Comments

@zilto
Copy link
Collaborator

zilto commented May 27, 2024

You can use Hamilton without numpy so there's no reason to have it as a dependency.

By searching numpy in hamilton/**.py, there are 3 results:

  • hamilton/base.py where NumpyMatrixResult is defined. This could be moved to the hamilton/plugins/h_numpy.py. We would need to solve the import pattern.
  • hamilton/telemetry.py there's a check for the base.NumpyMatrixBuilder. We can probably just remove or stitch with the above change?
  • hamilton/log_setup.py where np.seterr is used to ignore some numpy error. This should be safe to delete?

By searchin numpy in tests/**.py there are more results. Numpy is used to test the 3 previous elements, but also as an input for certain tests and for @check_output stuff.

  • The easy fix is to keep numpy in the test dependencies.
  • We could move certain tests to tests/plugins/test_h_numpy.py

Also, we would have to make sure that the examples have an explicit dependency on numpy if they are using it.

@zilto zilto added refactor plugin Relates to a Hamilton plugin (adapters, materializers, etc.) labels May 27, 2024
@radujica
Copy link

radujica commented Jun 5, 2024

looks like the same could be said about pandas? it does pop up in more places, but none look core

@elijahbenizzy
Copy link
Collaborator

looks like the same could be said about pandas? it does pop up in more places, but none look core

Yes! It's only left there for legacy reasons. One thing I've been meaning to do is add a hamilton[raw] that doesn't install it or numpy. The library should have zero dependencies. That's dependent on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin Relates to a Hamilton plugin (adapters, materializers, etc.) refactor
Projects
None yet
Development

No branches or pull requests

3 participants