From 763edeb4f4e8bc4b8bb05a992dae80c49c245e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a=20=28Swast=29?= Date: Tue, 12 Mar 2024 12:46:16 -0500 Subject: [PATCH] fix: move `third_party.bigframes_vendored` to `bigframes_vendored` (#424) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will avoid potential conflicts when run from a location that contains the commonly named `third_party` directory. Note: I followed the instructions here: https://stackoverflow.com/a/17179022/101923 but I also had to add a `pyproject.toml` file to support editable installations (see: https://togithub.com/pypa/setuptools/issues/230#issuecomment-1473278299). Fixes internal issue 328781348. 🦕 --- MANIFEST.in | 2 +- bigframes/_config/__init__.py | 3 +- bigframes/_config/display_options.py | 3 +- bigframes/_config/sampling_options.py | 2 +- bigframes/core/blocks.py | 2 +- bigframes/core/compile/aggregate_compiler.py | 2 +- bigframes/core/groupby/__init__.py | 2 +- bigframes/core/indexes/index.py | 2 +- bigframes/core/tools/datetimes.py | 2 +- bigframes/core/utils.py | 3 +- bigframes/core/window/__init__.py | 3 +- bigframes/dataframe.py | 4 +- bigframes/dtypes.py | 6 +-- bigframes/functions/remote_function.py | 2 +- bigframes/ml/base.py | 7 +-- bigframes/ml/cluster.py | 6 +-- bigframes/ml/compose.py | 7 +-- bigframes/ml/decomposition.py | 6 +-- bigframes/ml/ensemble.py | 24 +++++------ bigframes/ml/linear_model.py | 14 +++--- bigframes/ml/metrics/_metrics.py | 6 +-- bigframes/ml/metrics/pairwise.py | 3 +- bigframes/ml/pipeline.py | 6 +-- bigframes/ml/preprocessing.py | 43 ++++++++----------- bigframes/operations/base.py | 2 +- bigframes/operations/datetimes.py | 3 +- bigframes/operations/plotting.py | 3 +- bigframes/operations/strings.py | 3 +- bigframes/operations/structs.py | 3 +- bigframes/pandas/__init__.py | 12 +++--- bigframes/py.typed | 0 bigframes/series.py | 2 +- bigframes/session/__init__.py | 16 +++---- noxfile.py | 5 ++- owlbot.py | 2 +- pyproject.toml | 3 ++ setup.py | 10 ++++- tests/system/small/test_ibis.py | 2 +- tests/unit/test_remote_function.py | 2 +- .../tests/unit/test_pandas_helpers.py | 2 +- .../ibis/backends/bigquery/__init__.py | 4 +- .../ibis/backends/bigquery/registry.py | 3 +- .../ibis/expr/operations/__init__.py | 6 +-- .../bigframes_vendored/pandas/core/frame.py | 2 +- .../bigframes_vendored/pandas/core/generic.py | 3 +- .../bigframes_vendored/pandas/core/series.py | 6 +-- third_party/bigframes_vendored/py.typed | 0 .../sklearn/cluster/_kmeans.py | 3 +- .../sklearn/compose/_column_transformer.py | 3 +- .../sklearn/decomposition/_pca.py | 3 +- .../sklearn/linear_model/_base.py | 5 ++- .../sklearn/linear_model/_logistic.py | 7 ++- .../bigframes_vendored/sklearn/pipeline.py | 3 +- .../sklearn/preprocessing/_data.py | 3 +- .../sklearn/preprocessing/_discretization.py | 3 +- .../sklearn/preprocessing/_encoder.py | 3 +- .../sklearn/preprocessing/_label.py | 3 +- 57 files changed, 152 insertions(+), 138 deletions(-) create mode 100644 bigframes/py.typed create mode 100644 pyproject.toml create mode 100644 third_party/bigframes_vendored/py.typed diff --git a/MANIFEST.in b/MANIFEST.in index b422266a96..02b1f4ba4b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! include README.rst LICENSE -recursive-include third_party * +recursive-include third_party/bigframes_vendored * recursive-include bigframes *.json *.proto py.typed recursive-include tests * global-exclude *.py[co] diff --git a/bigframes/_config/__init__.py b/bigframes/_config/__init__.py index 8dcebfce6a..bdd7a8f2d6 100644 --- a/bigframes/_config/__init__.py +++ b/bigframes/_config/__init__.py @@ -17,11 +17,12 @@ DataFrames from this package. """ +import bigframes_vendored.pandas._config.config as pandas_config + import bigframes._config.bigquery_options as bigquery_options import bigframes._config.compute_options as compute_options import bigframes._config.display_options as display_options import bigframes._config.sampling_options as sampling_options -import third_party.bigframes_vendored.pandas._config.config as pandas_config class Options: diff --git a/bigframes/_config/display_options.py b/bigframes/_config/display_options.py index afa36aa84c..2af07d30a8 100644 --- a/bigframes/_config/display_options.py +++ b/bigframes/_config/display_options.py @@ -18,10 +18,9 @@ import dataclasses from typing import Literal, Optional +import bigframes_vendored.pandas.core.config_init as vendored_pandas_config import pandas as pd -import third_party.bigframes_vendored.pandas.core.config_init as vendored_pandas_config - @dataclasses.dataclass class DisplayOptions: diff --git a/bigframes/_config/sampling_options.py b/bigframes/_config/sampling_options.py index a80b9601ca..f4fa0928e1 100644 --- a/bigframes/_config/sampling_options.py +++ b/bigframes/_config/sampling_options.py @@ -19,7 +19,7 @@ import dataclasses from typing import Literal, Optional -import third_party.bigframes_vendored.pandas.core.config_init as vendored_pandas_config +import bigframes_vendored.pandas.core.config_init as vendored_pandas_config @dataclasses.dataclass diff --git a/bigframes/core/blocks.py b/bigframes/core/blocks.py index 993f2caa47..93dcd1d691 100644 --- a/bigframes/core/blocks.py +++ b/bigframes/core/blocks.py @@ -29,6 +29,7 @@ from typing import Iterable, List, Mapping, Optional, Sequence, Tuple import warnings +import bigframes_vendored.pandas.io.common as vendored_pandas_io_common import google.cloud.bigquery as bigquery import pandas as pd @@ -45,7 +46,6 @@ import bigframes.operations as ops import bigframes.operations.aggregations as agg_ops import bigframes.session._io.pandas -import third_party.bigframes_vendored.pandas.io.common as vendored_pandas_io_common # Type constraint for wherever column labels are used Label = typing.Hashable diff --git a/bigframes/core/compile/aggregate_compiler.py b/bigframes/core/compile/aggregate_compiler.py index 86ba16e347..7059c4fdc1 100644 --- a/bigframes/core/compile/aggregate_compiler.py +++ b/bigframes/core/compile/aggregate_compiler.py @@ -15,6 +15,7 @@ import typing from typing import cast, Optional +import bigframes_vendored.ibis.expr.operations as vendored_ibis_ops import ibis import ibis.expr.datatypes as ibis_dtypes import ibis.expr.types as ibis_types @@ -26,7 +27,6 @@ import bigframes.core.window_spec as window_spec import bigframes.dtypes as dtypes import bigframes.operations.aggregations as agg_ops -import third_party.bigframes_vendored.ibis.expr.operations as vendored_ibis_ops scalar_compiler = scalar_compilers.scalar_op_compiler diff --git a/bigframes/core/groupby/__init__.py b/bigframes/core/groupby/__init__.py index 9a0889b041..837eb28f68 100644 --- a/bigframes/core/groupby/__init__.py +++ b/bigframes/core/groupby/__init__.py @@ -16,6 +16,7 @@ import typing +import bigframes_vendored.pandas.core.groupby as vendored_pandas_groupby import pandas as pd import bigframes.constants as constants @@ -30,7 +31,6 @@ import bigframes.dtypes as dtypes import bigframes.operations.aggregations as agg_ops import bigframes.series as series -import third_party.bigframes_vendored.pandas.core.groupby as vendored_pandas_groupby @log_adapter.class_logger diff --git a/bigframes/core/indexes/index.py b/bigframes/core/indexes/index.py index 3ae4fbe24a..328dd49397 100644 --- a/bigframes/core/indexes/index.py +++ b/bigframes/core/indexes/index.py @@ -19,6 +19,7 @@ import typing from typing import Hashable, Optional, Sequence, Union +import bigframes_vendored.pandas.core.indexes.base as vendored_pandas_index import google.cloud.bigquery as bigquery import numpy as np import pandas @@ -33,7 +34,6 @@ import bigframes.formatting_helpers as formatter import bigframes.operations as ops import bigframes.operations.aggregations as agg_ops -import third_party.bigframes_vendored.pandas.core.indexes.base as vendored_pandas_index if typing.TYPE_CHECKING: import bigframes.dataframe diff --git a/bigframes/core/tools/datetimes.py b/bigframes/core/tools/datetimes.py index 093fa0a670..4aaf320c7a 100644 --- a/bigframes/core/tools/datetimes.py +++ b/bigframes/core/tools/datetimes.py @@ -16,6 +16,7 @@ from datetime import datetime from typing import Optional, Union +import bigframes_vendored.pandas.core.tools.datetimes as vendored_pandas_datetimes import pandas as pd import bigframes.constants as constants @@ -23,7 +24,6 @@ import bigframes.dataframe import bigframes.operations as ops import bigframes.series -import third_party.bigframes_vendored.pandas.core.tools.datetimes as vendored_pandas_datetimes def to_datetime( diff --git a/bigframes/core/utils.py b/bigframes/core/utils.py index 4331999dd6..1976ec1e39 100644 --- a/bigframes/core/utils.py +++ b/bigframes/core/utils.py @@ -15,11 +15,10 @@ import typing from typing import Hashable, Iterable, List +import bigframes_vendored.pandas.io.common as vendored_pandas_io_common import pandas as pd import typing_extensions -import third_party.bigframes_vendored.pandas.io.common as vendored_pandas_io_common - UNNAMED_COLUMN_ID = "bigframes_unnamed_column" UNNAMED_INDEX_ID = "bigframes_unnamed_index" diff --git a/bigframes/core/window/__init__.py b/bigframes/core/window/__init__.py index 8711625f88..fb682c950e 100644 --- a/bigframes/core/window/__init__.py +++ b/bigframes/core/window/__init__.py @@ -16,11 +16,12 @@ import typing +import bigframes_vendored.pandas.core.window.rolling as vendored_pandas_rolling + from bigframes.core import log_adapter import bigframes.core as core import bigframes.core.blocks as blocks import bigframes.operations.aggregations as agg_ops -import third_party.bigframes_vendored.pandas.core.window.rolling as vendored_pandas_rolling @log_adapter.class_logger diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index a122212d04..6ed882987c 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -34,6 +34,8 @@ Union, ) +import bigframes_vendored.pandas.core.frame as vendored_pandas_frame +import bigframes_vendored.pandas.pandas._typing as vendored_pandas_typing import google.api_core.exceptions import google.cloud.bigquery as bigquery import numpy @@ -63,8 +65,6 @@ import bigframes.series import bigframes.series as bf_series import bigframes.session._io.bigquery -import third_party.bigframes_vendored.pandas.core.frame as vendored_pandas_frame -import third_party.bigframes_vendored.pandas.pandas._typing as vendored_pandas_typing if typing.TYPE_CHECKING: import bigframes.session diff --git a/bigframes/dtypes.py b/bigframes/dtypes.py index 8a2055ef7f..f29d653d4f 100644 --- a/bigframes/dtypes.py +++ b/bigframes/dtypes.py @@ -20,6 +20,9 @@ import typing from typing import Any, Dict, Iterable, Literal, Tuple, Union +import bigframes_vendored.google_cloud_bigquery._pandas_helpers as gcb3p_pandas_helpers +import bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes +import bigframes_vendored.ibis.expr.operations as vendored_ibis_ops import geopandas as gpd # type: ignore import google.cloud.bigquery as bigquery import ibis @@ -31,9 +34,6 @@ import pyarrow as pa import bigframes.constants as constants -import third_party.bigframes_vendored.google_cloud_bigquery._pandas_helpers as gcb3p_pandas_helpers -import third_party.bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes -import third_party.bigframes_vendored.ibis.expr.operations as vendored_ibis_ops # Type hints for Pandas dtypes supported by BigQuery DataFrame Dtype = Union[ diff --git a/bigframes/functions/remote_function.py b/bigframes/functions/remote_function.py index 5bc8291f59..29c1c68e7c 100644 --- a/bigframes/functions/remote_function.py +++ b/bigframes/functions/remote_function.py @@ -32,6 +32,7 @@ if TYPE_CHECKING: from bigframes.session import Session +import bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes import cloudpickle import google.api_core.exceptions import google.api_core.retry @@ -47,7 +48,6 @@ from bigframes import clients import bigframes.constants as constants import bigframes.dtypes -import third_party.bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes logger = logging.getLogger(__name__) diff --git a/bigframes/ml/base.py b/bigframes/ml/base.py index 845b64caf1..9001987e9a 100644 --- a/bigframes/ml/base.py +++ b/bigframes/ml/base.py @@ -24,12 +24,13 @@ import abc from typing import cast, Optional, TypeVar, Union +import bigframes_vendored.sklearn.base + from bigframes.ml import core import bigframes.pandas as bpd -import third_party.bigframes_vendored.sklearn.base -class BaseEstimator(third_party.bigframes_vendored.sklearn.base.BaseEstimator, abc.ABC): +class BaseEstimator(bigframes_vendored.sklearn.base.BaseEstimator, abc.ABC): """ A BigQuery DataFrames machine learning component following the SKLearn API design Ref: https://bit.ly/3NyhKjN @@ -80,7 +81,7 @@ def __repr__(self): # Estimator pretty printer adapted from Sklearn's, which is in turn an adaption of # the inbuilt pretty-printer in CPython - import third_party.bigframes_vendored.cpython._pprint as adapted_pprint + import bigframes_vendored.cpython._pprint as adapted_pprint prettyprinter = adapted_pprint._EstimatorPrettyPrinter( compact=True, indent=1, indent_at_name=True, n_max_elements_to_show=30 diff --git a/bigframes/ml/cluster.py b/bigframes/ml/cluster.py index 6b79d356a2..360ab01453 100644 --- a/bigframes/ml/cluster.py +++ b/bigframes/ml/cluster.py @@ -19,22 +19,22 @@ from typing import Dict, List, Optional, Union +import bigframes_vendored.sklearn.cluster._kmeans from google.cloud import bigquery import bigframes from bigframes.core import log_adapter from bigframes.ml import base, core, globals, utils import bigframes.pandas as bpd -import third_party.bigframes_vendored.sklearn.cluster._kmeans @log_adapter.class_logger class KMeans( base.UnsupervisedTrainablePredictor, - third_party.bigframes_vendored.sklearn.cluster._kmeans.KMeans, + bigframes_vendored.sklearn.cluster._kmeans.KMeans, ): - __doc__ = third_party.bigframes_vendored.sklearn.cluster._kmeans.KMeans.__doc__ + __doc__ = bigframes_vendored.sklearn.cluster._kmeans.KMeans.__doc__ def __init__(self, n_clusters: int = 8): self.n_clusters = n_clusters diff --git a/bigframes/ml/compose.py b/bigframes/ml/compose.py index ace876dd2d..d35941b338 100644 --- a/bigframes/ml/compose.py +++ b/bigframes/ml/compose.py @@ -21,11 +21,12 @@ import typing from typing import List, Optional, Tuple, Union +import bigframes_vendored.sklearn.compose._column_transformer + from bigframes import constants from bigframes.core import log_adapter from bigframes.ml import base, core, globals, preprocessing, utils import bigframes.pandas as bpd -import third_party.bigframes_vendored.sklearn.compose._column_transformer CompilablePreprocessorType = Union[ preprocessing.OneHotEncoder, @@ -40,10 +41,10 @@ @log_adapter.class_logger class ColumnTransformer( base.Transformer, - third_party.bigframes_vendored.sklearn.compose._column_transformer.ColumnTransformer, + bigframes_vendored.sklearn.compose._column_transformer.ColumnTransformer, ): __doc__ = ( - third_party.bigframes_vendored.sklearn.compose._column_transformer.ColumnTransformer.__doc__ + bigframes_vendored.sklearn.compose._column_transformer.ColumnTransformer.__doc__ ) def __init__( diff --git a/bigframes/ml/decomposition.py b/bigframes/ml/decomposition.py index ef777cb33a..f2b7c97994 100644 --- a/bigframes/ml/decomposition.py +++ b/bigframes/ml/decomposition.py @@ -19,21 +19,21 @@ from typing import List, Optional, Union +import bigframes_vendored.sklearn.decomposition._pca from google.cloud import bigquery import bigframes from bigframes.core import log_adapter from bigframes.ml import base, core, globals, utils import bigframes.pandas as bpd -import third_party.bigframes_vendored.sklearn.decomposition._pca @log_adapter.class_logger class PCA( base.UnsupervisedTrainablePredictor, - third_party.bigframes_vendored.sklearn.decomposition._pca.PCA, + bigframes_vendored.sklearn.decomposition._pca.PCA, ): - __doc__ = third_party.bigframes_vendored.sklearn.decomposition._pca.PCA.__doc__ + __doc__ = bigframes_vendored.sklearn.decomposition._pca.PCA.__doc__ def __init__(self, n_components: int = 3): self.n_components = n_components diff --git a/bigframes/ml/ensemble.py b/bigframes/ml/ensemble.py index 7fcaa926ed..23b227de67 100644 --- a/bigframes/ml/ensemble.py +++ b/bigframes/ml/ensemble.py @@ -19,14 +19,14 @@ from typing import Dict, List, Literal, Optional, Union +import bigframes_vendored.sklearn.ensemble._forest +import bigframes_vendored.xgboost.sklearn from google.cloud import bigquery import bigframes from bigframes.core import log_adapter from bigframes.ml import base, core, globals, utils import bigframes.pandas as bpd -import third_party.bigframes_vendored.sklearn.ensemble._forest -import third_party.bigframes_vendored.xgboost.sklearn _BQML_PARAMS_MAPPING = { "booster": "boosterType", @@ -51,9 +51,9 @@ @log_adapter.class_logger class XGBRegressor( base.SupervisedTrainablePredictor, - third_party.bigframes_vendored.xgboost.sklearn.XGBRegressor, + bigframes_vendored.xgboost.sklearn.XGBRegressor, ): - __doc__ = third_party.bigframes_vendored.xgboost.sklearn.XGBRegressor.__doc__ + __doc__ = bigframes_vendored.xgboost.sklearn.XGBRegressor.__doc__ def __init__( self, @@ -208,10 +208,10 @@ def to_gbq(self, model_name: str, replace: bool = False) -> XGBRegressor: @log_adapter.class_logger class XGBClassifier( base.SupervisedTrainablePredictor, - third_party.bigframes_vendored.xgboost.sklearn.XGBClassifier, + bigframes_vendored.xgboost.sklearn.XGBClassifier, ): - __doc__ = third_party.bigframes_vendored.xgboost.sklearn.XGBClassifier.__doc__ + __doc__ = bigframes_vendored.xgboost.sklearn.XGBClassifier.__doc__ def __init__( self, @@ -364,12 +364,10 @@ def to_gbq(self, model_name: str, replace: bool = False) -> XGBClassifier: @log_adapter.class_logger class RandomForestRegressor( base.SupervisedTrainablePredictor, - third_party.bigframes_vendored.sklearn.ensemble._forest.RandomForestRegressor, + bigframes_vendored.sklearn.ensemble._forest.RandomForestRegressor, ): - __doc__ = ( - third_party.bigframes_vendored.sklearn.ensemble._forest.RandomForestRegressor.__doc__ - ) + __doc__ = bigframes_vendored.sklearn.ensemble._forest.RandomForestRegressor.__doc__ def __init__( self, @@ -531,12 +529,10 @@ def to_gbq(self, model_name: str, replace: bool = False) -> RandomForestRegresso @log_adapter.class_logger class RandomForestClassifier( base.SupervisedTrainablePredictor, - third_party.bigframes_vendored.sklearn.ensemble._forest.RandomForestClassifier, + bigframes_vendored.sklearn.ensemble._forest.RandomForestClassifier, ): - __doc__ = ( - third_party.bigframes_vendored.sklearn.ensemble._forest.RandomForestClassifier.__doc__ - ) + __doc__ = bigframes_vendored.sklearn.ensemble._forest.RandomForestClassifier.__doc__ def __init__( self, diff --git a/bigframes/ml/linear_model.py b/bigframes/ml/linear_model.py index b0c4069352..68d1e12676 100644 --- a/bigframes/ml/linear_model.py +++ b/bigframes/ml/linear_model.py @@ -19,6 +19,8 @@ from typing import Dict, List, Literal, Optional, Union +import bigframes_vendored.sklearn.linear_model._base +import bigframes_vendored.sklearn.linear_model._logistic from google.cloud import bigquery import bigframes @@ -26,8 +28,6 @@ from bigframes.core import log_adapter from bigframes.ml import base, core, globals, utils import bigframes.pandas as bpd -import third_party.bigframes_vendored.sklearn.linear_model._base -import third_party.bigframes_vendored.sklearn.linear_model._logistic _BQML_PARAMS_MAPPING = { "optimize_strategy": "optimizationStrategy", @@ -50,11 +50,9 @@ @log_adapter.class_logger class LinearRegression( base.SupervisedTrainablePredictor, - third_party.bigframes_vendored.sklearn.linear_model._base.LinearRegression, + bigframes_vendored.sklearn.linear_model._base.LinearRegression, ): - __doc__ = ( - third_party.bigframes_vendored.sklearn.linear_model._base.LinearRegression.__doc__ - ) + __doc__ = bigframes_vendored.sklearn.linear_model._base.LinearRegression.__doc__ def __init__( self, @@ -184,10 +182,10 @@ def to_gbq(self, model_name: str, replace: bool = False) -> LinearRegression: @log_adapter.class_logger class LogisticRegression( base.SupervisedTrainablePredictor, - third_party.bigframes_vendored.sklearn.linear_model._logistic.LogisticRegression, + bigframes_vendored.sklearn.linear_model._logistic.LogisticRegression, ): __doc__ = ( - third_party.bigframes_vendored.sklearn.linear_model._logistic.LogisticRegression.__doc__ + bigframes_vendored.sklearn.linear_model._logistic.LogisticRegression.__doc__ ) # TODO(ashleyxu) support class_weights in the constructor. diff --git a/bigframes/ml/metrics/_metrics.py b/bigframes/ml/metrics/_metrics.py index 5c81f16e31..e8c7400f35 100644 --- a/bigframes/ml/metrics/_metrics.py +++ b/bigframes/ml/metrics/_metrics.py @@ -19,6 +19,9 @@ import typing from typing import Tuple, Union +import bigframes_vendored.sklearn.metrics._classification as vendored_mertics_classification +import bigframes_vendored.sklearn.metrics._ranking as vendored_mertics_ranking +import bigframes_vendored.sklearn.metrics._regression as vendored_metrics_regression import numpy as np import pandas as pd import sklearn.metrics as sklearn_metrics # type: ignore @@ -26,9 +29,6 @@ import bigframes.constants as constants from bigframes.ml import utils import bigframes.pandas as bpd -import third_party.bigframes_vendored.sklearn.metrics._classification as vendored_mertics_classification -import third_party.bigframes_vendored.sklearn.metrics._ranking as vendored_mertics_ranking -import third_party.bigframes_vendored.sklearn.metrics._regression as vendored_metrics_regression def r2_score( diff --git a/bigframes/ml/metrics/pairwise.py b/bigframes/ml/metrics/pairwise.py index ef2c08d471..bdbe4a682d 100644 --- a/bigframes/ml/metrics/pairwise.py +++ b/bigframes/ml/metrics/pairwise.py @@ -15,9 +15,10 @@ import inspect from typing import Union +import bigframes_vendored.sklearn.metrics.pairwise as vendored_metrics_pairwise + from bigframes.ml import core, utils import bigframes.pandas as bpd -import third_party.bigframes_vendored.sklearn.metrics.pairwise as vendored_metrics_pairwise def paired_cosine_distances( diff --git a/bigframes/ml/pipeline.py b/bigframes/ml/pipeline.py index 4ae2bfe555..9289b613b8 100644 --- a/bigframes/ml/pipeline.py +++ b/bigframes/ml/pipeline.py @@ -20,6 +20,7 @@ from typing import cast, List, Optional, Tuple, Union +import bigframes_vendored.sklearn.pipeline from google.cloud import bigquery import bigframes @@ -27,15 +28,14 @@ from bigframes.core import log_adapter from bigframes.ml import base, compose, forecasting, loader, preprocessing, utils import bigframes.pandas as bpd -import third_party.bigframes_vendored.sklearn.pipeline @log_adapter.class_logger class Pipeline( base.BaseEstimator, - third_party.bigframes_vendored.sklearn.pipeline.Pipeline, + bigframes_vendored.sklearn.pipeline.Pipeline, ): - __doc__ = third_party.bigframes_vendored.sklearn.pipeline.Pipeline.__doc__ + __doc__ = bigframes_vendored.sklearn.pipeline.Pipeline.__doc__ def __init__(self, steps: List[Tuple[str, base.BaseEstimator]]): self.steps = steps diff --git a/bigframes/ml/preprocessing.py b/bigframes/ml/preprocessing.py index a403e57e71..23eab42978 100644 --- a/bigframes/ml/preprocessing.py +++ b/bigframes/ml/preprocessing.py @@ -20,23 +20,22 @@ import typing from typing import Any, cast, List, Literal, Optional, Tuple, Union +import bigframes_vendored.sklearn.preprocessing._data +import bigframes_vendored.sklearn.preprocessing._discretization +import bigframes_vendored.sklearn.preprocessing._encoder +import bigframes_vendored.sklearn.preprocessing._label + from bigframes.core import log_adapter from bigframes.ml import base, core, globals, utils import bigframes.pandas as bpd -import third_party.bigframes_vendored.sklearn.preprocessing._data -import third_party.bigframes_vendored.sklearn.preprocessing._discretization -import third_party.bigframes_vendored.sklearn.preprocessing._encoder -import third_party.bigframes_vendored.sklearn.preprocessing._label @log_adapter.class_logger class StandardScaler( base.Transformer, - third_party.bigframes_vendored.sklearn.preprocessing._data.StandardScaler, + bigframes_vendored.sklearn.preprocessing._data.StandardScaler, ): - __doc__ = ( - third_party.bigframes_vendored.sklearn.preprocessing._data.StandardScaler.__doc__ - ) + __doc__ = bigframes_vendored.sklearn.preprocessing._data.StandardScaler.__doc__ def __init__(self): self._bqml_model: Optional[core.BqmlModel] = None @@ -116,11 +115,9 @@ def transform(self, X: Union[bpd.DataFrame, bpd.Series]) -> bpd.DataFrame: @log_adapter.class_logger class MaxAbsScaler( base.Transformer, - third_party.bigframes_vendored.sklearn.preprocessing._data.MaxAbsScaler, + bigframes_vendored.sklearn.preprocessing._data.MaxAbsScaler, ): - __doc__ = ( - third_party.bigframes_vendored.sklearn.preprocessing._data.MaxAbsScaler.__doc__ - ) + __doc__ = bigframes_vendored.sklearn.preprocessing._data.MaxAbsScaler.__doc__ def __init__(self): self._bqml_model: Optional[core.BqmlModel] = None @@ -200,11 +197,9 @@ def transform(self, X: Union[bpd.DataFrame, bpd.Series]) -> bpd.DataFrame: @log_adapter.class_logger class MinMaxScaler( base.Transformer, - third_party.bigframes_vendored.sklearn.preprocessing._data.MinMaxScaler, + bigframes_vendored.sklearn.preprocessing._data.MinMaxScaler, ): - __doc__ = ( - third_party.bigframes_vendored.sklearn.preprocessing._data.MinMaxScaler.__doc__ - ) + __doc__ = bigframes_vendored.sklearn.preprocessing._data.MinMaxScaler.__doc__ def __init__(self): self._bqml_model: Optional[core.BqmlModel] = None @@ -284,10 +279,10 @@ def transform(self, X: Union[bpd.DataFrame, bpd.Series]) -> bpd.DataFrame: @log_adapter.class_logger class KBinsDiscretizer( base.Transformer, - third_party.bigframes_vendored.sklearn.preprocessing._discretization.KBinsDiscretizer, + bigframes_vendored.sklearn.preprocessing._discretization.KBinsDiscretizer, ): __doc__ = ( - third_party.bigframes_vendored.sklearn.preprocessing._discretization.KBinsDiscretizer.__doc__ + bigframes_vendored.sklearn.preprocessing._discretization.KBinsDiscretizer.__doc__ ) def __init__( @@ -403,15 +398,13 @@ def transform(self, X: Union[bpd.DataFrame, bpd.Series]) -> bpd.DataFrame: @log_adapter.class_logger class OneHotEncoder( base.Transformer, - third_party.bigframes_vendored.sklearn.preprocessing._encoder.OneHotEncoder, + bigframes_vendored.sklearn.preprocessing._encoder.OneHotEncoder, ): # BQML max value https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-one-hot-encoder#syntax TOP_K_DEFAULT = 1000000 FREQUENCY_THRESHOLD_DEFAULT = 0 - __doc__ = ( - third_party.bigframes_vendored.sklearn.preprocessing._encoder.OneHotEncoder.__doc__ - ) + __doc__ = bigframes_vendored.sklearn.preprocessing._encoder.OneHotEncoder.__doc__ # All estimators must implement __init__ to document their parameters, even # if they don't have any @@ -533,15 +526,13 @@ def transform(self, X: Union[bpd.DataFrame, bpd.Series]) -> bpd.DataFrame: @log_adapter.class_logger class LabelEncoder( base.LabelTransformer, - third_party.bigframes_vendored.sklearn.preprocessing._label.LabelEncoder, + bigframes_vendored.sklearn.preprocessing._label.LabelEncoder, ): # BQML max value https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-one-hot-encoder#syntax TOP_K_DEFAULT = 1000000 FREQUENCY_THRESHOLD_DEFAULT = 0 - __doc__ = ( - third_party.bigframes_vendored.sklearn.preprocessing._label.LabelEncoder.__doc__ - ) + __doc__ = bigframes_vendored.sklearn.preprocessing._label.LabelEncoder.__doc__ # All estimators must implement __init__ to document their parameters, even # if they don't have any diff --git a/bigframes/operations/base.py b/bigframes/operations/base.py index 154247c033..9bfa0500b5 100644 --- a/bigframes/operations/base.py +++ b/bigframes/operations/base.py @@ -16,6 +16,7 @@ import typing +import bigframes_vendored.pandas.pandas._typing as vendored_pandas_typing import pandas as pd import bigframes.constants as constants @@ -28,7 +29,6 @@ import bigframes.operations.aggregations as agg_ops import bigframes.series as series import bigframes.session -import third_party.bigframes_vendored.pandas.pandas._typing as vendored_pandas_typing class SeriesMethods: diff --git a/bigframes/operations/datetimes.py b/bigframes/operations/datetimes.py index 3165e6f003..66ec347add 100644 --- a/bigframes/operations/datetimes.py +++ b/bigframes/operations/datetimes.py @@ -17,11 +17,12 @@ import datetime as dt from typing import Optional +import bigframes_vendored.pandas.core.indexes.accessor as vendordt + from bigframes.core import log_adapter import bigframes.operations as ops import bigframes.operations.base import bigframes.series as series -import third_party.bigframes_vendored.pandas.core.indexes.accessor as vendordt @log_adapter.class_logger diff --git a/bigframes/operations/plotting.py b/bigframes/operations/plotting.py index ef36e9383a..d19485e65e 100644 --- a/bigframes/operations/plotting.py +++ b/bigframes/operations/plotting.py @@ -14,9 +14,10 @@ from typing import Optional, Sequence +import bigframes_vendored.pandas.plotting._core as vendordt + import bigframes.constants as constants import bigframes.operations._matplotlib as bfplt -import third_party.bigframes_vendored.pandas.plotting._core as vendordt class PlotAccessor: diff --git a/bigframes/operations/strings.py b/bigframes/operations/strings.py index 2798f18b38..abd45a1453 100644 --- a/bigframes/operations/strings.py +++ b/bigframes/operations/strings.py @@ -17,13 +17,14 @@ import re from typing import cast, Literal, Optional, Union +import bigframes_vendored.pandas.core.strings.accessor as vendorstr + import bigframes.constants as constants from bigframes.core import log_adapter import bigframes.dataframe as df import bigframes.operations as ops import bigframes.operations.base import bigframes.series as series -import third_party.bigframes_vendored.pandas.core.strings.accessor as vendorstr # Maps from python to re2 REGEXP_FLAGS = { diff --git a/bigframes/operations/structs.py b/bigframes/operations/structs.py index 0e00b781c9..e8a1af9602 100644 --- a/bigframes/operations/structs.py +++ b/bigframes/operations/structs.py @@ -14,12 +14,13 @@ from __future__ import annotations +import bigframes_vendored.pandas.core.arrays.arrow.accessors as vendoracessors + from bigframes.core import log_adapter import bigframes.dataframe import bigframes.operations import bigframes.operations.base import bigframes.series -import third_party.bigframes_vendored.pandas.core.arrays.arrow.accessors as vendoracessors @log_adapter.class_logger diff --git a/bigframes/pandas/__init__.py b/bigframes/pandas/__init__.py index 195d7eabfa..03c8412907 100644 --- a/bigframes/pandas/__init__.py +++ b/bigframes/pandas/__init__.py @@ -36,6 +36,12 @@ Union, ) +import bigframes_vendored.pandas.core.reshape.concat as vendored_pandas_concat +import bigframes_vendored.pandas.core.reshape.encoding as vendored_pandas_encoding +import bigframes_vendored.pandas.core.reshape.merge as vendored_pandas_merge +import bigframes_vendored.pandas.core.reshape.tile as vendored_pandas_tile +import bigframes_vendored.pandas.core.tools.datetimes as vendored_pandas_datetimes +import bigframes_vendored.pandas.io.gbq as vendored_pandas_gbq from google.cloud import bigquery import numpy import pandas @@ -59,12 +65,6 @@ import bigframes.series import bigframes.session import bigframes.session.clients -import third_party.bigframes_vendored.pandas.core.reshape.concat as vendored_pandas_concat -import third_party.bigframes_vendored.pandas.core.reshape.encoding as vendored_pandas_encoding -import third_party.bigframes_vendored.pandas.core.reshape.merge as vendored_pandas_merge -import third_party.bigframes_vendored.pandas.core.reshape.tile as vendored_pandas_tile -import third_party.bigframes_vendored.pandas.core.tools.datetimes as vendored_pandas_datetimes -import third_party.bigframes_vendored.pandas.io.gbq as vendored_pandas_gbq # Include method definition so that the method appears in our docs for diff --git a/bigframes/py.typed b/bigframes/py.typed new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bigframes/series.py b/bigframes/series.py index 21f1f3b4e4..ef2feb4f92 100644 --- a/bigframes/series.py +++ b/bigframes/series.py @@ -23,6 +23,7 @@ import typing from typing import Any, Mapping, Optional, Tuple, Union +import bigframes_vendored.pandas.core.series as vendored_pandas_series import google.cloud.bigquery as bigquery import numpy import pandas @@ -53,7 +54,6 @@ import bigframes.operations.plotting as plotting import bigframes.operations.strings as strings import bigframes.operations.structs as structs -import third_party.bigframes_vendored.pandas.core.series as vendored_pandas_series LevelType = typing.Union[str, int] LevelsType = typing.Union[LevelType, typing.Sequence[LevelType]] diff --git a/bigframes/session/__init__.py b/bigframes/session/__init__.py index b553865ea9..e3c392cd2f 100644 --- a/bigframes/session/__init__.py +++ b/bigframes/session/__init__.py @@ -39,6 +39,14 @@ ) import warnings +# Even though the ibis.backends.bigquery import is unused, it's needed +# to register new and replacement ops with the Ibis BigQuery backend. +import bigframes_vendored.ibis.backends.bigquery # noqa +import bigframes_vendored.ibis.expr.operations as vendored_ibis_ops +import bigframes_vendored.pandas.io.gbq as third_party_pandas_gbq +import bigframes_vendored.pandas.io.parquet as third_party_pandas_parquet +import bigframes_vendored.pandas.io.parsers.readers as third_party_pandas_readers +import bigframes_vendored.pandas.io.pickle as third_party_pandas_pickle import google.api_core.client_info import google.api_core.client_options import google.api_core.exceptions @@ -81,14 +89,6 @@ import bigframes.session.clients import bigframes.version -# Even though the ibis.backends.bigquery import is unused, it's needed -# to register new and replacement ops with the Ibis BigQuery backend. -import third_party.bigframes_vendored.ibis.expr.operations as vendored_ibis_ops -import third_party.bigframes_vendored.pandas.io.gbq as third_party_pandas_gbq -import third_party.bigframes_vendored.pandas.io.parquet as third_party_pandas_parquet -import third_party.bigframes_vendored.pandas.io.parsers.readers as third_party_pandas_readers -import third_party.bigframes_vendored.pandas.io.pickle as third_party_pandas_pickle - _BIGFRAMES_DEFAULT_CONNECTION_ID = "bigframes-default-connection" _MAX_CLUSTER_COLUMNS = 4 diff --git a/noxfile.py b/noxfile.py index db503c43fd..e7f238c01f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -219,7 +219,10 @@ def unit_noextras(session): @nox.session(python=DEFAULT_PYTHON_VERSION) def mypy(session): """Run type checks with mypy.""" - session.install("-e", ".") + # Editable mode is not compatible with mypy when there are multiple + # package directories. See: + # https://github.com/python/mypy/issues/10564#issuecomment-851687749 + session.install(".") # Just install the dependencies' type info directly, since "mypy --install-types" # might require an additional pass. diff --git a/owlbot.py b/owlbot.py index dc84de7d8f..4dc6d1aca3 100644 --- a/owlbot.py +++ b/owlbot.py @@ -63,7 +63,7 @@ s.replace( ["MANIFEST.in"], re.escape("recursive-include google"), - "recursive-include third_party *\nrecursive-include bigframes", + "recursive-include third_party/bigframes_vendored *\nrecursive-include bigframes", ) # Even though BigQuery DataFrames isn't technically a client library, we are diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..fed528d4a7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 027c1b76af..a626fd4b34 100644 --- a/setup.py +++ b/setup.py @@ -88,7 +88,11 @@ packages = [ package for package in setuptools.find_namespace_packages() - if package.startswith("bigframes") or package.startswith("third_party") + if package.startswith("bigframes") +] + [ + package + for package in setuptools.find_namespace_packages("third_party") + if package.startswith("bigframes_vendored") ] setuptools.setup( @@ -115,6 +119,10 @@ install_requires=dependencies, extras_require=extras, platforms="Posix; MacOS X; Windows", + package_dir={ + "bigframes": "bigframes", + "bigframes_vendored": "third_party/bigframes_vendored", + }, packages=packages, python_requires=">=3.9", include_package_data=True, diff --git a/tests/system/small/test_ibis.py b/tests/system/small/test_ibis.py index 9fe1176068..e2648d1eba 100644 --- a/tests/system/small/test_ibis.py +++ b/tests/system/small/test_ibis.py @@ -14,10 +14,10 @@ """Tests for monkeypatched ibis code.""" +import bigframes_vendored.ibis.expr.operations as vendored_ibis_ops import ibis.expr.types as ibis_types import bigframes -import third_party.bigframes_vendored.ibis.expr.operations as vendored_ibis_ops def test_approximate_quantiles(session: bigframes.Session, scalars_table_id: str): diff --git a/tests/unit/test_remote_function.py b/tests/unit/test_remote_function.py index 629bc5326a..1acff27c7f 100644 --- a/tests/unit/test_remote_function.py +++ b/tests/unit/test_remote_function.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +import bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes from ibis.expr import datatypes as ibis_types import bigframes.dtypes -import third_party.bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes def test_supported_types_correspond(): diff --git a/third_party/bigframes_vendored/google_cloud_bigquery/tests/unit/test_pandas_helpers.py b/third_party/bigframes_vendored/google_cloud_bigquery/tests/unit/test_pandas_helpers.py index dc4a09cc54..c798b0d169 100644 --- a/third_party/bigframes_vendored/google_cloud_bigquery/tests/unit/test_pandas_helpers.py +++ b/third_party/bigframes_vendored/google_cloud_bigquery/tests/unit/test_pandas_helpers.py @@ -25,7 +25,7 @@ @pytest.fixture def module_under_test(): - from third_party.bigframes_vendored.google_cloud_bigquery import _pandas_helpers + from bigframes_vendored.google_cloud_bigquery import _pandas_helpers return _pandas_helpers diff --git a/third_party/bigframes_vendored/ibis/backends/bigquery/__init__.py b/third_party/bigframes_vendored/ibis/backends/bigquery/__init__.py index 43508fab11..1d2d05a741 100644 --- a/third_party/bigframes_vendored/ibis/backends/bigquery/__init__.py +++ b/third_party/bigframes_vendored/ibis/backends/bigquery/__init__.py @@ -1,3 +1,3 @@ # Import all sub-modules to monkeypatch everything. -import third_party.bigframes_vendored.ibis.backends.bigquery.compiler # noqa -import third_party.bigframes_vendored.ibis.backends.bigquery.registry # noqa +import bigframes_vendored.ibis.backends.bigquery.compiler # noqa +import bigframes_vendored.ibis.backends.bigquery.registry # noqa diff --git a/third_party/bigframes_vendored/ibis/backends/bigquery/registry.py b/third_party/bigframes_vendored/ibis/backends/bigquery/registry.py index e1b28690d7..3f89feaa34 100644 --- a/third_party/bigframes_vendored/ibis/backends/bigquery/registry.py +++ b/third_party/bigframes_vendored/ibis/backends/bigquery/registry.py @@ -1,10 +1,9 @@ # Contains code from https://github.com/ibis-project/ibis/blob/master/ibis/backends/bigquery/registry.py """Module to convert from Ibis expression to SQL string.""" +import bigframes_vendored.ibis.expr.operations as vendored_ibis_ops from ibis.backends.bigquery.registry import OPERATION_REGISTRY -import third_party.bigframes_vendored.ibis.expr.operations as vendored_ibis_ops - def _approx_quantiles(translator, op: vendored_ibis_ops.ApproximateMultiQuantile): arg = translator.translate(op.arg) diff --git a/third_party/bigframes_vendored/ibis/expr/operations/__init__.py b/third_party/bigframes_vendored/ibis/expr/operations/__init__.py index 8219701392..2c2efe528d 100644 --- a/third_party/bigframes_vendored/ibis/expr/operations/__init__.py +++ b/third_party/bigframes_vendored/ibis/expr/operations/__init__.py @@ -1,6 +1,6 @@ # Contains code from https://github.com/ibis-project/ibis/blob/master/ibis/expr/operations/__init__.py from __future__ import annotations -from third_party.bigframes_vendored.ibis.expr.operations.analytic import * # noqa: F401 F403 -from third_party.bigframes_vendored.ibis.expr.operations.json import * # noqa: F401 F403 -from third_party.bigframes_vendored.ibis.expr.operations.reductions import * # noqa: F401 F403 +from bigframes_vendored.ibis.expr.operations.analytic import * # noqa: F401 F403 +from bigframes_vendored.ibis.expr.operations.json import * # noqa: F401 F403 +from bigframes_vendored.ibis.expr.operations.reductions import * # noqa: F401 F403 diff --git a/third_party/bigframes_vendored/pandas/core/frame.py b/third_party/bigframes_vendored/pandas/core/frame.py index 0399d9c5b9..313c6663c8 100644 --- a/third_party/bigframes_vendored/pandas/core/frame.py +++ b/third_party/bigframes_vendored/pandas/core/frame.py @@ -13,11 +13,11 @@ from typing import Hashable, Iterable, Literal, Mapping, Optional, Sequence, Union +from bigframes_vendored.pandas.core.generic import NDFrame import numpy as np import pandas as pd from bigframes import constants -from third_party.bigframes_vendored.pandas.core.generic import NDFrame # ----------------------------------------------------------------------- # DataFrame class diff --git a/third_party/bigframes_vendored/pandas/core/generic.py b/third_party/bigframes_vendored/pandas/core/generic.py index b55c7e23d8..01d8f7a174 100644 --- a/third_party/bigframes_vendored/pandas/core/generic.py +++ b/third_party/bigframes_vendored/pandas/core/generic.py @@ -3,8 +3,9 @@ from typing import Iterator, Literal, Optional +from bigframes_vendored.pandas.core import indexing + from bigframes import constants -from third_party.bigframes_vendored.pandas.core import indexing class NDFrame(indexing.IndexingMixin): diff --git a/third_party/bigframes_vendored/pandas/core/series.py b/third_party/bigframes_vendored/pandas/core/series.py index 2c4f2aaa8f..beaf8aedb1 100644 --- a/third_party/bigframes_vendored/pandas/core/series.py +++ b/third_party/bigframes_vendored/pandas/core/series.py @@ -5,16 +5,16 @@ from typing import Hashable, IO, Literal, Mapping, Sequence, TYPE_CHECKING +from bigframes_vendored.pandas.core.generic import NDFrame import numpy as np from pandas._libs import lib from pandas._typing import Axis, FilePath, NaPosition, WriteBuffer from bigframes import constants -from third_party.bigframes_vendored.pandas.core.generic import NDFrame if TYPE_CHECKING: - from third_party.bigframes_vendored.pandas.core.frame import DataFrame - from third_party.bigframes_vendored.pandas.core.groupby import SeriesGroupBy + from bigframes_vendored.pandas.core.frame import DataFrame + from bigframes_vendored.pandas.core.groupby import SeriesGroupBy class Series(NDFrame): # type: ignore[misc] diff --git a/third_party/bigframes_vendored/py.typed b/third_party/bigframes_vendored/py.typed new file mode 100644 index 0000000000..e69de29bb2 diff --git a/third_party/bigframes_vendored/sklearn/cluster/_kmeans.py b/third_party/bigframes_vendored/sklearn/cluster/_kmeans.py index be6c5e7c52..d72b9b7bd5 100644 --- a/third_party/bigframes_vendored/sklearn/cluster/_kmeans.py +++ b/third_party/bigframes_vendored/sklearn/cluster/_kmeans.py @@ -13,8 +13,9 @@ from abc import ABC +from bigframes_vendored.sklearn.base import BaseEstimator + from bigframes import constants -from third_party.bigframes_vendored.sklearn.base import BaseEstimator class _BaseKMeans(BaseEstimator, ABC): diff --git a/third_party/bigframes_vendored/sklearn/compose/_column_transformer.py b/third_party/bigframes_vendored/sklearn/compose/_column_transformer.py index dead173b2d..b08eb10492 100644 --- a/third_party/bigframes_vendored/sklearn/compose/_column_transformer.py +++ b/third_party/bigframes_vendored/sklearn/compose/_column_transformer.py @@ -6,8 +6,9 @@ from abc import ABCMeta +from bigframes_vendored.sklearn.base import BaseEstimator + from bigframes import constants -from third_party.bigframes_vendored.sklearn.base import BaseEstimator class _BaseComposition(BaseEstimator, metaclass=ABCMeta): diff --git a/third_party/bigframes_vendored/sklearn/decomposition/_pca.py b/third_party/bigframes_vendored/sklearn/decomposition/_pca.py index 011ecc06dd..30c9c3b0b6 100644 --- a/third_party/bigframes_vendored/sklearn/decomposition/_pca.py +++ b/third_party/bigframes_vendored/sklearn/decomposition/_pca.py @@ -12,8 +12,9 @@ from abc import ABCMeta +from bigframes_vendored.sklearn.base import BaseEstimator + from bigframes import constants -from third_party.bigframes_vendored.sklearn.base import BaseEstimator class PCA(BaseEstimator, metaclass=ABCMeta): diff --git a/third_party/bigframes_vendored/sklearn/linear_model/_base.py b/third_party/bigframes_vendored/sklearn/linear_model/_base.py index ab946e5861..ad2c872468 100644 --- a/third_party/bigframes_vendored/sklearn/linear_model/_base.py +++ b/third_party/bigframes_vendored/sklearn/linear_model/_base.py @@ -17,13 +17,14 @@ from abc import ABCMeta -from bigframes import constants -from third_party.bigframes_vendored.sklearn.base import ( +from bigframes_vendored.sklearn.base import ( BaseEstimator, ClassifierMixin, RegressorMixin, ) +from bigframes import constants + class LinearModel(BaseEstimator, metaclass=ABCMeta): def predict(self, X): diff --git a/third_party/bigframes_vendored/sklearn/linear_model/_logistic.py b/third_party/bigframes_vendored/sklearn/linear_model/_logistic.py index 989ca03c82..621c78d551 100644 --- a/third_party/bigframes_vendored/sklearn/linear_model/_logistic.py +++ b/third_party/bigframes_vendored/sklearn/linear_model/_logistic.py @@ -12,14 +12,13 @@ # Original location: https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/linear_model/_logistic.py -from typing import List, Optional - -from bigframes import constants -from third_party.bigframes_vendored.sklearn.linear_model._base import ( +from bigframes_vendored.sklearn.linear_model._base import ( BaseEstimator, LinearClassifierMixin, ) +from bigframes import constants + class LogisticRegression(LinearClassifierMixin, BaseEstimator): """Logistic Regression (aka logit, MaxEnt) classifier. diff --git a/third_party/bigframes_vendored/sklearn/pipeline.py b/third_party/bigframes_vendored/sklearn/pipeline.py index 4b8eb25a97..aed1565960 100644 --- a/third_party/bigframes_vendored/sklearn/pipeline.py +++ b/third_party/bigframes_vendored/sklearn/pipeline.py @@ -11,8 +11,9 @@ from abc import ABCMeta +from bigframes_vendored.sklearn.base import BaseEstimator + from bigframes import constants -from third_party.bigframes_vendored.sklearn.base import BaseEstimator class Pipeline(BaseEstimator, metaclass=ABCMeta): diff --git a/third_party/bigframes_vendored/sklearn/preprocessing/_data.py b/third_party/bigframes_vendored/sklearn/preprocessing/_data.py index 5ce102d573..1ff83aa640 100644 --- a/third_party/bigframes_vendored/sklearn/preprocessing/_data.py +++ b/third_party/bigframes_vendored/sklearn/preprocessing/_data.py @@ -7,8 +7,9 @@ # Eric Chang # License: BSD 3 clause +from bigframes_vendored.sklearn.base import BaseEstimator, TransformerMixin + from bigframes import constants -from third_party.bigframes_vendored.sklearn.base import BaseEstimator, TransformerMixin class StandardScaler(BaseEstimator, TransformerMixin): diff --git a/third_party/bigframes_vendored/sklearn/preprocessing/_discretization.py b/third_party/bigframes_vendored/sklearn/preprocessing/_discretization.py index 0236558dd4..5fcc481573 100644 --- a/third_party/bigframes_vendored/sklearn/preprocessing/_discretization.py +++ b/third_party/bigframes_vendored/sklearn/preprocessing/_discretization.py @@ -3,8 +3,9 @@ # License: BSD +from bigframes_vendored.sklearn.base import BaseEstimator, TransformerMixin + from bigframes import constants -from third_party.bigframes_vendored.sklearn.base import BaseEstimator, TransformerMixin class KBinsDiscretizer(TransformerMixin, BaseEstimator): diff --git a/third_party/bigframes_vendored/sklearn/preprocessing/_encoder.py b/third_party/bigframes_vendored/sklearn/preprocessing/_encoder.py index 8da9a98c53..5e5e8ac042 100644 --- a/third_party/bigframes_vendored/sklearn/preprocessing/_encoder.py +++ b/third_party/bigframes_vendored/sklearn/preprocessing/_encoder.py @@ -2,8 +2,9 @@ # Joris Van den Bossche # License: BSD 3 clause +from bigframes_vendored.sklearn.base import BaseEstimator + from bigframes import constants -from third_party.bigframes_vendored.sklearn.base import BaseEstimator class OneHotEncoder(BaseEstimator): diff --git a/third_party/bigframes_vendored/sklearn/preprocessing/_label.py b/third_party/bigframes_vendored/sklearn/preprocessing/_label.py index 83f8eb0f9c..cc6b995c8c 100644 --- a/third_party/bigframes_vendored/sklearn/preprocessing/_label.py +++ b/third_party/bigframes_vendored/sklearn/preprocessing/_label.py @@ -6,8 +6,9 @@ # Hamzeh Alsalhi # License: BSD 3 clause +from bigframes_vendored.sklearn.base import BaseEstimator + from bigframes import constants -from third_party.bigframes_vendored.sklearn.base import BaseEstimator class LabelEncoder(BaseEstimator):