Skip to content

Commit 120ccf0

Browse files
committed
experiment with module-level templates
1 parent 3b04b83 commit 120ccf0

File tree

12 files changed

+186
-15
lines changed

12 files changed

+186
-15
lines changed

bigframes/bigquery/__init__.py

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,51 @@
105105
struct,
106106
]
107107

108-
__all__ = [f.__name__ for f in _functions] + ["ai"]
108+
__all__ = [
109+
# approximate aggregate ops
110+
"approx_top_count",
111+
# array ops
112+
"array_agg",
113+
"array_length",
114+
"array_to_string",
115+
# datetime ops
116+
"unix_micros",
117+
"unix_millis",
118+
"unix_seconds",
119+
# geo ops
120+
"st_area",
121+
"st_buffer",
122+
"st_centroid",
123+
"st_convexhull",
124+
"st_difference",
125+
"st_distance",
126+
"st_intersection",
127+
"st_isclosed",
128+
"st_length",
129+
"st_regionstats",
130+
"st_simplify",
131+
# json ops
132+
"json_extract",
133+
"json_extract_array",
134+
"json_extract_string_array",
135+
"json_query",
136+
"json_query_array",
137+
"json_set",
138+
"json_value",
139+
"json_value_array",
140+
"parse_json",
141+
"to_json",
142+
"to_json_string",
143+
# search ops
144+
"create_vector_index",
145+
"vector_search",
146+
# sql ops
147+
"sql_scalar",
148+
# struct ops
149+
"struct",
150+
# Modules / SQL namespaces
151+
"ai",
152+
]
109153

110154
_module = sys.modules[__name__]
111155
for f in _functions:

bigframes/enums.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
class OrderingMode(enum.Enum):
24-
"""[Preview] Values used to determine the ordering mode.
24+
"""Values used to determine the ordering mode.
2525
2626
Default is 'strict'.
2727
"""
@@ -37,5 +37,6 @@ class DefaultIndexKind(enum.Enum):
3737
#: ``n - 3``, ``n - 2``, ``n - 1``, where ``n`` is the number of items in
3838
#: the index.
3939
SEQUENTIAL_INT64 = enum.auto()
40+
4041
# A completely null index incapable of indexing or alignment.
4142
NULL = enum.auto()

bigframes/exceptions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ class FunctionPackageVersionWarning(PreviewWarning):
127127

128128

129129
def format_message(message: str, fill: bool = True):
130-
"""Formats a warning message with ANSI color codes for the warning color.
130+
"""[Private] Formats a warning message.
131+
132+
:meta private:
131133
132134
Args:
133135
message: The warning message string.

bigframes/streaming/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from __future__ import annotations
16+
1517
import inspect
18+
import sys
1619

20+
from bigframes.core import log_adapter
1721
import bigframes.core.global_session as global_session
1822
from bigframes.pandas.io.api import _set_default_session_location_if_possible
1923
import bigframes.session
@@ -32,3 +36,12 @@ def read_gbq_table(table: str) -> streaming_dataframe.StreamingDataFrame:
3236
)
3337

3438
StreamingDataFrame = streaming_dataframe.StreamingDataFrame
39+
40+
_module = sys.modules[__name__]
41+
_functions = [read_gbq_table]
42+
43+
for _function in _functions:
44+
_decorated_object = log_adapter.method_logger(_function, custom_base_name="pandas")
45+
setattr(_module, _function.__name__, _decorated_object)
46+
47+
__all__ = ["read_gbq_table", "StreamingDataFrame"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../third_party/bigframes_vendored/pandas/doc/_templates/autosummary/class.rst
1+
../../../third_party/sphinx/ext/autosummary/templates/autosummary/class.rst
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../third_party/sphinx/ext/autosummary/templates/autosummary/module.rst

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
autoclass_content = "both"
6666
autodoc_default_options = {"members": True}
6767
autosummary_generate = True
68-
68+
autosummary_imported_members = True
6969

7070
# Add any paths that contain templates here, relative to this directory.
7171
templates_path = ["_templates"]

docs/reference/index.rst

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,34 @@ packages.
66

77
.. autosummary::
88
:toctree: api
9-
:recursive:
109

1110
bigframes.bigquery
11+
bigframes.bigquery.ai
1212
bigframes.enums
1313
bigframes.exceptions
1414
bigframes.geopandas
15-
bigframes.ml
16-
bigframes.pandas.DataFrame
15+
bigframes.pandas
1716
bigframes.streaming
17+
18+
ML APIs
19+
~~~~~~~
20+
21+
BigQuery DataFrames provides many machine learning modules, inspired by
22+
scikit-learn.
23+
24+
.. autosummary::
25+
:toctree: api
26+
27+
bigframes.ml.cluster
28+
bigframes.ml.compose
29+
bigframes.ml.decomposition
30+
bigframes.ml.ensemble
31+
bigframes.ml.forecasting
32+
bigframes.ml.imported
33+
bigframes.ml.impute
34+
bigframes.ml.linear_model
35+
bigframes.ml.llm
36+
bigframes.ml.model_selection
37+
bigframes.ml.pipeline
38+
bigframes.ml.preprocessing
39+
bigframes.ml.remote

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ def docs(session):
534534
)
535535
session.run(
536536
"sphinx-build",
537-
"-W", # warnings as errors
537+
# "-W", # warnings as errors
538538
"-T", # show full traceback on exception
539539
"-N", # no colors
540540
"-b",

third_party/sphinx/LICENSE.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
License for Sphinx
2+
==================
3+
4+
Unless otherwise indicated, all code in the Sphinx project is licenced under the
5+
two clause BSD licence below.
6+
7+
Copyright (c) 2007-2025 by the Sphinx team (see AUTHORS file).
8+
All rights reserved.
9+
10+
Redistribution and use in source and binary forms, with or without
11+
modification, are permitted provided that the following conditions are
12+
met:
13+
14+
* Redistributions of source code must retain the above copyright
15+
notice, this list of conditions and the following disclaimer.
16+
17+
* Redistributions in binary form must reproduce the above copyright
18+
notice, this list of conditions and the following disclaimer in the
19+
documentation and/or other materials provided with the distribution.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)