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

deps: remove scikit-learn as a required dependency #1296

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Genesis929
Copy link
Collaborator

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@product-auto-label product-auto-label bot added size: s Pull request size is small. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Jan 16, 2025
@Genesis929 Genesis929 requested a review from GarrettWu January 17, 2025 20:54
@Genesis929 Genesis929 marked this pull request as ready for review January 17, 2025 21:14
@Genesis929 Genesis929 requested review from a team as code owners January 17, 2025 21:14
@Genesis929 Genesis929 added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 17, 2025
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 17, 2025
@Genesis929 Genesis929 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 17, 2025
@bigframes-bot bigframes-bot removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 17, 2025
Comment on lines +181 to +197
if len(x_pandas) < 2:
raise ValueError(
f"At least 2 points are needed to compute area under curve, but x.shape = {len(x_pandas)}"
)

if x_pandas.is_monotonic_decreasing:
d = -1
elif x_pandas.is_monotonic_increasing:
d = 1
else:
raise ValueError(f"x is neither increasing nor decreasing : {x_pandas}.")

if hasattr(np, "trapezoid"):
# new in numpy 2.0
return d * np.trapezoid(y_pandas, x_pandas)
# np.trapz has been deprecated in 2.0
return d * np.trapz(y_pandas, x_pandas) # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this code is copied from sklearn, we should put it in the third_party/bigframes_vendored directory.

Comment on lines +234 to +236
session.install(
"scikit-learn>=1.2.2",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not install optional dependencies in unit_noextras. The intention of such test sessions is to make sure that dependencies that are marked as optional are truly optional. This risks making a forced dependency on this package.

Also, prefer removing the package from other sessions as well.

Comment on lines +226 to +228
session.install(
"scikit-learn>=1.2.2",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is optional functionality that needs scikit-learn, please use the "extras" section in setup.py. Don't install packages this way.

@tswast tswast changed the title chore: remove unused dependencies. deps: remove scikit-learn as a required dependency Jan 21, 2025
@tswast
Copy link
Collaborator

tswast commented Jan 21, 2025

This is not a chore: . This is a user-visible change and should be labeled as such.

@tswast tswast added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 21, 2025
Copy link
Collaborator

@tswast tswast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not merge as is. We are opening our customers up to a big risk of having a broken installation by installing scikit-learn in so many of our test sessions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. do not merge Indicates a pull request not ready for merge, due to either quality or timing. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants