Skip to content

Commit 763edeb

Browse files
authored
fix: move third_party.bigframes_vendored to bigframes_vendored (#424)
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. 🦕
1 parent 4aadff4 commit 763edeb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+152
-138
lines changed

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# Generated by synthtool. DO NOT EDIT!
1818
include README.rst LICENSE
19-
recursive-include third_party *
19+
recursive-include third_party/bigframes_vendored *
2020
recursive-include bigframes *.json *.proto py.typed
2121
recursive-include tests *
2222
global-exclude *.py[co]

bigframes/_config/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
DataFrames from this package.
1818
"""
1919

20+
import bigframes_vendored.pandas._config.config as pandas_config
21+
2022
import bigframes._config.bigquery_options as bigquery_options
2123
import bigframes._config.compute_options as compute_options
2224
import bigframes._config.display_options as display_options
2325
import bigframes._config.sampling_options as sampling_options
24-
import third_party.bigframes_vendored.pandas._config.config as pandas_config
2526

2627

2728
class Options:

bigframes/_config/display_options.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
import dataclasses
1919
from typing import Literal, Optional
2020

21+
import bigframes_vendored.pandas.core.config_init as vendored_pandas_config
2122
import pandas as pd
2223

23-
import third_party.bigframes_vendored.pandas.core.config_init as vendored_pandas_config
24-
2524

2625
@dataclasses.dataclass
2726
class DisplayOptions:

bigframes/_config/sampling_options.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import dataclasses
2020
from typing import Literal, Optional
2121

22-
import third_party.bigframes_vendored.pandas.core.config_init as vendored_pandas_config
22+
import bigframes_vendored.pandas.core.config_init as vendored_pandas_config
2323

2424

2525
@dataclasses.dataclass

bigframes/core/blocks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from typing import Iterable, List, Mapping, Optional, Sequence, Tuple
3030
import warnings
3131

32+
import bigframes_vendored.pandas.io.common as vendored_pandas_io_common
3233
import google.cloud.bigquery as bigquery
3334
import pandas as pd
3435

@@ -45,7 +46,6 @@
4546
import bigframes.operations as ops
4647
import bigframes.operations.aggregations as agg_ops
4748
import bigframes.session._io.pandas
48-
import third_party.bigframes_vendored.pandas.io.common as vendored_pandas_io_common
4949

5050
# Type constraint for wherever column labels are used
5151
Label = typing.Hashable

bigframes/core/compile/aggregate_compiler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import typing
1616
from typing import cast, Optional
1717

18+
import bigframes_vendored.ibis.expr.operations as vendored_ibis_ops
1819
import ibis
1920
import ibis.expr.datatypes as ibis_dtypes
2021
import ibis.expr.types as ibis_types
@@ -26,7 +27,6 @@
2627
import bigframes.core.window_spec as window_spec
2728
import bigframes.dtypes as dtypes
2829
import bigframes.operations.aggregations as agg_ops
29-
import third_party.bigframes_vendored.ibis.expr.operations as vendored_ibis_ops
3030

3131
scalar_compiler = scalar_compilers.scalar_op_compiler
3232

bigframes/core/groupby/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import typing
1818

19+
import bigframes_vendored.pandas.core.groupby as vendored_pandas_groupby
1920
import pandas as pd
2021

2122
import bigframes.constants as constants
@@ -30,7 +31,6 @@
3031
import bigframes.dtypes as dtypes
3132
import bigframes.operations.aggregations as agg_ops
3233
import bigframes.series as series
33-
import third_party.bigframes_vendored.pandas.core.groupby as vendored_pandas_groupby
3434

3535

3636
@log_adapter.class_logger

bigframes/core/indexes/index.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import typing
2020
from typing import Hashable, Optional, Sequence, Union
2121

22+
import bigframes_vendored.pandas.core.indexes.base as vendored_pandas_index
2223
import google.cloud.bigquery as bigquery
2324
import numpy as np
2425
import pandas
@@ -33,7 +34,6 @@
3334
import bigframes.formatting_helpers as formatter
3435
import bigframes.operations as ops
3536
import bigframes.operations.aggregations as agg_ops
36-
import third_party.bigframes_vendored.pandas.core.indexes.base as vendored_pandas_index
3737

3838
if typing.TYPE_CHECKING:
3939
import bigframes.dataframe

bigframes/core/tools/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
from datetime import datetime
1717
from typing import Optional, Union
1818

19+
import bigframes_vendored.pandas.core.tools.datetimes as vendored_pandas_datetimes
1920
import pandas as pd
2021

2122
import bigframes.constants as constants
2223
import bigframes.core.global_session as global_session
2324
import bigframes.dataframe
2425
import bigframes.operations as ops
2526
import bigframes.series
26-
import third_party.bigframes_vendored.pandas.core.tools.datetimes as vendored_pandas_datetimes
2727

2828

2929
def to_datetime(

bigframes/core/utils.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
import typing
1616
from typing import Hashable, Iterable, List
1717

18+
import bigframes_vendored.pandas.io.common as vendored_pandas_io_common
1819
import pandas as pd
1920
import typing_extensions
2021

21-
import third_party.bigframes_vendored.pandas.io.common as vendored_pandas_io_common
22-
2322
UNNAMED_COLUMN_ID = "bigframes_unnamed_column"
2423
UNNAMED_INDEX_ID = "bigframes_unnamed_index"
2524

bigframes/core/window/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

1717
import typing
1818

19+
import bigframes_vendored.pandas.core.window.rolling as vendored_pandas_rolling
20+
1921
from bigframes.core import log_adapter
2022
import bigframes.core as core
2123
import bigframes.core.blocks as blocks
2224
import bigframes.operations.aggregations as agg_ops
23-
import third_party.bigframes_vendored.pandas.core.window.rolling as vendored_pandas_rolling
2425

2526

2627
@log_adapter.class_logger

bigframes/dataframe.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
Union,
3535
)
3636

37+
import bigframes_vendored.pandas.core.frame as vendored_pandas_frame
38+
import bigframes_vendored.pandas.pandas._typing as vendored_pandas_typing
3739
import google.api_core.exceptions
3840
import google.cloud.bigquery as bigquery
3941
import numpy
@@ -63,8 +65,6 @@
6365
import bigframes.series
6466
import bigframes.series as bf_series
6567
import bigframes.session._io.bigquery
66-
import third_party.bigframes_vendored.pandas.core.frame as vendored_pandas_frame
67-
import third_party.bigframes_vendored.pandas.pandas._typing as vendored_pandas_typing
6868

6969
if typing.TYPE_CHECKING:
7070
import bigframes.session

bigframes/dtypes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
import typing
2121
from typing import Any, Dict, Iterable, Literal, Tuple, Union
2222

23+
import bigframes_vendored.google_cloud_bigquery._pandas_helpers as gcb3p_pandas_helpers
24+
import bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes
25+
import bigframes_vendored.ibis.expr.operations as vendored_ibis_ops
2326
import geopandas as gpd # type: ignore
2427
import google.cloud.bigquery as bigquery
2528
import ibis
@@ -31,9 +34,6 @@
3134
import pyarrow as pa
3235

3336
import bigframes.constants as constants
34-
import third_party.bigframes_vendored.google_cloud_bigquery._pandas_helpers as gcb3p_pandas_helpers
35-
import third_party.bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes
36-
import third_party.bigframes_vendored.ibis.expr.operations as vendored_ibis_ops
3737

3838
# Type hints for Pandas dtypes supported by BigQuery DataFrame
3939
Dtype = Union[

bigframes/functions/remote_function.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
if TYPE_CHECKING:
3333
from bigframes.session import Session
3434

35+
import bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes
3536
import cloudpickle
3637
import google.api_core.exceptions
3738
import google.api_core.retry
@@ -47,7 +48,6 @@
4748
from bigframes import clients
4849
import bigframes.constants as constants
4950
import bigframes.dtypes
50-
import third_party.bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes
5151

5252
logger = logging.getLogger(__name__)
5353

bigframes/ml/base.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
import abc
2525
from typing import cast, Optional, TypeVar, Union
2626

27+
import bigframes_vendored.sklearn.base
28+
2729
from bigframes.ml import core
2830
import bigframes.pandas as bpd
29-
import third_party.bigframes_vendored.sklearn.base
3031

3132

32-
class BaseEstimator(third_party.bigframes_vendored.sklearn.base.BaseEstimator, abc.ABC):
33+
class BaseEstimator(bigframes_vendored.sklearn.base.BaseEstimator, abc.ABC):
3334
"""
3435
A BigQuery DataFrames machine learning component following the SKLearn API
3536
design Ref: https://bit.ly/3NyhKjN
@@ -80,7 +81,7 @@ def __repr__(self):
8081

8182
# Estimator pretty printer adapted from Sklearn's, which is in turn an adaption of
8283
# the inbuilt pretty-printer in CPython
83-
import third_party.bigframes_vendored.cpython._pprint as adapted_pprint
84+
import bigframes_vendored.cpython._pprint as adapted_pprint
8485

8586
prettyprinter = adapted_pprint._EstimatorPrettyPrinter(
8687
compact=True, indent=1, indent_at_name=True, n_max_elements_to_show=30

bigframes/ml/cluster.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@
1919

2020
from typing import Dict, List, Optional, Union
2121

22+
import bigframes_vendored.sklearn.cluster._kmeans
2223
from google.cloud import bigquery
2324

2425
import bigframes
2526
from bigframes.core import log_adapter
2627
from bigframes.ml import base, core, globals, utils
2728
import bigframes.pandas as bpd
28-
import third_party.bigframes_vendored.sklearn.cluster._kmeans
2929

3030

3131
@log_adapter.class_logger
3232
class KMeans(
3333
base.UnsupervisedTrainablePredictor,
34-
third_party.bigframes_vendored.sklearn.cluster._kmeans.KMeans,
34+
bigframes_vendored.sklearn.cluster._kmeans.KMeans,
3535
):
3636

37-
__doc__ = third_party.bigframes_vendored.sklearn.cluster._kmeans.KMeans.__doc__
37+
__doc__ = bigframes_vendored.sklearn.cluster._kmeans.KMeans.__doc__
3838

3939
def __init__(self, n_clusters: int = 8):
4040
self.n_clusters = n_clusters

bigframes/ml/compose.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
import typing
2222
from typing import List, Optional, Tuple, Union
2323

24+
import bigframes_vendored.sklearn.compose._column_transformer
25+
2426
from bigframes import constants
2527
from bigframes.core import log_adapter
2628
from bigframes.ml import base, core, globals, preprocessing, utils
2729
import bigframes.pandas as bpd
28-
import third_party.bigframes_vendored.sklearn.compose._column_transformer
2930

3031
CompilablePreprocessorType = Union[
3132
preprocessing.OneHotEncoder,
@@ -40,10 +41,10 @@
4041
@log_adapter.class_logger
4142
class ColumnTransformer(
4243
base.Transformer,
43-
third_party.bigframes_vendored.sklearn.compose._column_transformer.ColumnTransformer,
44+
bigframes_vendored.sklearn.compose._column_transformer.ColumnTransformer,
4445
):
4546
__doc__ = (
46-
third_party.bigframes_vendored.sklearn.compose._column_transformer.ColumnTransformer.__doc__
47+
bigframes_vendored.sklearn.compose._column_transformer.ColumnTransformer.__doc__
4748
)
4849

4950
def __init__(

bigframes/ml/decomposition.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@
1919

2020
from typing import List, Optional, Union
2121

22+
import bigframes_vendored.sklearn.decomposition._pca
2223
from google.cloud import bigquery
2324

2425
import bigframes
2526
from bigframes.core import log_adapter
2627
from bigframes.ml import base, core, globals, utils
2728
import bigframes.pandas as bpd
28-
import third_party.bigframes_vendored.sklearn.decomposition._pca
2929

3030

3131
@log_adapter.class_logger
3232
class PCA(
3333
base.UnsupervisedTrainablePredictor,
34-
third_party.bigframes_vendored.sklearn.decomposition._pca.PCA,
34+
bigframes_vendored.sklearn.decomposition._pca.PCA,
3535
):
36-
__doc__ = third_party.bigframes_vendored.sklearn.decomposition._pca.PCA.__doc__
36+
__doc__ = bigframes_vendored.sklearn.decomposition._pca.PCA.__doc__
3737

3838
def __init__(self, n_components: int = 3):
3939
self.n_components = n_components

bigframes/ml/ensemble.py

+10-14
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
from typing import Dict, List, Literal, Optional, Union
2121

22+
import bigframes_vendored.sklearn.ensemble._forest
23+
import bigframes_vendored.xgboost.sklearn
2224
from google.cloud import bigquery
2325

2426
import bigframes
2527
from bigframes.core import log_adapter
2628
from bigframes.ml import base, core, globals, utils
2729
import bigframes.pandas as bpd
28-
import third_party.bigframes_vendored.sklearn.ensemble._forest
29-
import third_party.bigframes_vendored.xgboost.sklearn
3030

3131
_BQML_PARAMS_MAPPING = {
3232
"booster": "boosterType",
@@ -51,9 +51,9 @@
5151
@log_adapter.class_logger
5252
class XGBRegressor(
5353
base.SupervisedTrainablePredictor,
54-
third_party.bigframes_vendored.xgboost.sklearn.XGBRegressor,
54+
bigframes_vendored.xgboost.sklearn.XGBRegressor,
5555
):
56-
__doc__ = third_party.bigframes_vendored.xgboost.sklearn.XGBRegressor.__doc__
56+
__doc__ = bigframes_vendored.xgboost.sklearn.XGBRegressor.__doc__
5757

5858
def __init__(
5959
self,
@@ -208,10 +208,10 @@ def to_gbq(self, model_name: str, replace: bool = False) -> XGBRegressor:
208208
@log_adapter.class_logger
209209
class XGBClassifier(
210210
base.SupervisedTrainablePredictor,
211-
third_party.bigframes_vendored.xgboost.sklearn.XGBClassifier,
211+
bigframes_vendored.xgboost.sklearn.XGBClassifier,
212212
):
213213

214-
__doc__ = third_party.bigframes_vendored.xgboost.sklearn.XGBClassifier.__doc__
214+
__doc__ = bigframes_vendored.xgboost.sklearn.XGBClassifier.__doc__
215215

216216
def __init__(
217217
self,
@@ -364,12 +364,10 @@ def to_gbq(self, model_name: str, replace: bool = False) -> XGBClassifier:
364364
@log_adapter.class_logger
365365
class RandomForestRegressor(
366366
base.SupervisedTrainablePredictor,
367-
third_party.bigframes_vendored.sklearn.ensemble._forest.RandomForestRegressor,
367+
bigframes_vendored.sklearn.ensemble._forest.RandomForestRegressor,
368368
):
369369

370-
__doc__ = (
371-
third_party.bigframes_vendored.sklearn.ensemble._forest.RandomForestRegressor.__doc__
372-
)
370+
__doc__ = bigframes_vendored.sklearn.ensemble._forest.RandomForestRegressor.__doc__
373371

374372
def __init__(
375373
self,
@@ -531,12 +529,10 @@ def to_gbq(self, model_name: str, replace: bool = False) -> RandomForestRegresso
531529
@log_adapter.class_logger
532530
class RandomForestClassifier(
533531
base.SupervisedTrainablePredictor,
534-
third_party.bigframes_vendored.sklearn.ensemble._forest.RandomForestClassifier,
532+
bigframes_vendored.sklearn.ensemble._forest.RandomForestClassifier,
535533
):
536534

537-
__doc__ = (
538-
third_party.bigframes_vendored.sklearn.ensemble._forest.RandomForestClassifier.__doc__
539-
)
535+
__doc__ = bigframes_vendored.sklearn.ensemble._forest.RandomForestClassifier.__doc__
540536

541537
def __init__(
542538
self,

0 commit comments

Comments
 (0)