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

feat: add generated sync client #1017

Merged
merged 422 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
422 commits
Select commit Hold shift + click to select a range
d17a98c
Merge branch 'cross_sync_pr1_replacements' into cross_sync_pr2_genera…
daniel-sanche Jul 12, 2024
fd1fb71
fixed decorator sync_impl call
daniel-sanche Jul 12, 2024
c0b4185
Merge branch 'cross_sync_pr1_replacements' into cross_sync_pr2_genera…
daniel-sanche Jul 12, 2024
adb092e
use add_mapping in place of replace_symbols
daniel-sanche Jul 12, 2024
45efa16
support automatic attribute registration
daniel-sanche Jul 12, 2024
e1ec974
reduced replace_symbols usage in tests
daniel-sanche Jul 13, 2024
021fde2
fixed lint issues
daniel-sanche Jul 13, 2024
58405d1
Merge branch 'cross_sync_pr1_replacements' into cross_sync_pr2_genera…
daniel-sanche Jul 13, 2024
de0fd90
added missing imports
daniel-sanche Jul 13, 2024
6ca3ddd
get mappings working for sync implementation
daniel-sanche Jul 13, 2024
b2cf937
moved decorators into new file
daniel-sanche Jul 15, 2024
4860061
moved transformation from transformers into decorators
daniel-sanche Jul 16, 2024
63891d7
simplified arguments for decorators
daniel-sanche Jul 16, 2024
164f5a8
use separate decorate method
daniel-sanche Jul 16, 2024
8317973
comments and clean up
daniel-sanche Jul 17, 2024
f9dd41d
ran blacken
daniel-sanche Jul 17, 2024
22b093f
moved ast decorators into new file
daniel-sanche Jul 17, 2024
5ebf889
Merge branch 'cross_sync_pr1_replacements' into cross_sync_pr2_genera…
daniel-sanche Jul 17, 2024
8d13c5e
ran blacken
daniel-sanche Jul 17, 2024
ea8072f
Merge branch 'cross_sync_pr1_replacements' into cross_sync_pr2_genera…
daniel-sanche Jul 17, 2024
769cac1
changed sync impl name
daniel-sanche Jul 17, 2024
f87b832
fixed mapping function
daniel-sanche Jul 17, 2024
f2b6d08
convert to async with pytest mark
daniel-sanche Jul 17, 2024
754adf8
Merge branch 'cross_sync_pr1_replacements' into cross_sync_pr2_genera…
daniel-sanche Jul 17, 2024
3ed5935
convert changes async to sync def by default
daniel-sanche Jul 17, 2024
d0ba7b0
added rm_aio for stripping asyncio keywords
daniel-sanche Jul 18, 2024
37b4833
reverted client and test changes
daniel-sanche Jul 18, 2024
af020a2
Revert "reverted client and test changes"
daniel-sanche Jul 18, 2024
698902d
added sync pooled transport
daniel-sanche Jul 18, 2024
64166db
only strip CrossSync.rm_aio on Call visits
daniel-sanche Jul 18, 2024
73ba23b
support decorators in nested functions
daniel-sanche Jul 18, 2024
12e8860
added missing convert annotations
daniel-sanche Jul 22, 2024
63a528a
added import blocks for sync versions
daniel-sanche Jul 22, 2024
f5dcdf5
added annotations to tests
daniel-sanche Jul 22, 2024
be40771
removed unneeded test imports
daniel-sanche Jul 22, 2024
a676d49
ran blacken
daniel-sanche Jul 22, 2024
c63d88e
fixed lint issues
daniel-sanche Jul 22, 2024
5d11fc0
added generated files
daniel-sanche Jul 22, 2024
3bb6c6f
added files to __init__.py
daniel-sanche Jul 22, 2024
4a041c8
added cross_sync to path for transformers
daniel-sanche Jul 22, 2024
cbc36dd
support table in helpers
daniel-sanche Jul 22, 2024
03b60ed
removed quoted cross sync classes
daniel-sanche Jul 22, 2024
3762a03
fixed mypy issues
daniel-sanche Jul 22, 2024
274bd36
moved cross_sync into own directory
daniel-sanche Jul 22, 2024
5611614
added docstrings
daniel-sanche Jul 22, 2024
ad95748
added README
daniel-sanche Jul 22, 2024
cad416d
fixed README formatting
daniel-sanche Jul 22, 2024
9b92e65
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Jul 22, 2024
18292a4
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Jul 22, 2024
9a19658
added rm_aio to pytest and convert decorators
daniel-sanche Jul 23, 2024
a378c45
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Jul 23, 2024
02b2268
Merge branch 'main' into cross_sync2_pr1_architecture
daniel-sanche Jul 23, 2024
f3643f1
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Jul 23, 2024
dc54f7a
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Jul 23, 2024
b64c0c7
create paths when writing sync outputs
daniel-sanche Jul 23, 2024
223f337
moved files
daniel-sanche Jul 23, 2024
51d2358
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Jul 23, 2024
2a87b83
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Jul 23, 2024
3600a63
moved add_mapping into metaclass
daniel-sanche Jul 24, 2024
295f3a2
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Jul 24, 2024
6ce1b5c
fixed mypy issues
daniel-sanche Jul 24, 2024
6ac4c71
ignore unneeded mypy check
daniel-sanche Jul 24, 2024
d76cb5c
add mappings in __init__.py
daniel-sanche Jul 25, 2024
a36f89d
Merge branch 'main' into cross_sync2_pr1_architecture
daniel-sanche Aug 9, 2024
ceabe03
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Aug 13, 2024
56cdbc1
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Aug 13, 2024
449bb39
changed mapping method
daniel-sanche Aug 13, 2024
e5d6a29
added annotations for execute_query
daniel-sanche Aug 13, 2024
ebf126a
replace all instances in docstrings
daniel-sanche Aug 13, 2024
3d8c79b
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Aug 13, 2024
98d1fd9
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Aug 13, 2024
2c926df
regenerated files
daniel-sanche Aug 13, 2024
792abd9
added next to cross_sync
daniel-sanche Aug 30, 2024
1006496
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Aug 30, 2024
5dc231c
moved execute_query e2e tests from system to unit
daniel-sanche Aug 30, 2024
f73498c
ran blacken
daniel-sanche Aug 30, 2024
6ecbf72
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Aug 30, 2024
d884e5b
added execute_query tests
daniel-sanche Aug 30, 2024
18854f0
added docstring templating
daniel-sanche Sep 3, 2024
97d63e0
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 3, 2024
5396bc4
use templating in docstrings
daniel-sanche Sep 3, 2024
86cb80f
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 3, 2024
1433136
regenerated files
daniel-sanche Sep 3, 2024
2dce3b9
added test file for cross sync
daniel-sanche Sep 3, 2024
ade18b1
added some tests
daniel-sanche Sep 4, 2024
933a626
moved wait into aliases
daniel-sanche Sep 5, 2024
8efe71d
stripped out condition_wait
daniel-sanche Sep 5, 2024
09623f4
added tests for event_wait
daniel-sanche Sep 5, 2024
6fcbc89
added tests for create_task
daniel-sanche Sep 5, 2024
9044c4a
added tests for remaining functions
daniel-sanche Sep 5, 2024
ee11e04
added test outline for decorators
daniel-sanche Sep 5, 2024
89c2abe
added tests for ExportSync
daniel-sanche Sep 5, 2024
7925b24
added tests for convert
daniel-sanche Sep 5, 2024
de32f7f
added remaining decorator tests
daniel-sanche Sep 5, 2024
3c0f1de
added mapping tests
daniel-sanche Sep 5, 2024
da38ac4
added e2e test structure for cross_sync
daniel-sanche Sep 5, 2024
169255b
fixed failing nox tests
daniel-sanche Sep 5, 2024
5eddd03
added test cases
daniel-sanche Sep 5, 2024
c616143
added tests
daniel-sanche Sep 5, 2024
042f89b
added cross_sync_methods e2e test cases
daniel-sanche Sep 6, 2024
f186d6b
added tests for class generation
daniel-sanche Sep 6, 2024
7a0c638
moved cross_sync tests into system tests
daniel-sanche Sep 6, 2024
a3cb9a6
fixed lint issues
daniel-sanche Sep 6, 2024
0c91eb7
fixed mypy
daniel-sanche Sep 6, 2024
5484f5e
changed system_emulated version
daniel-sanche Sep 6, 2024
e7881da
fixed system test version format
daniel-sanche Sep 6, 2024
bc67b30
fixed unit-3.7 issues
daniel-sanche Sep 6, 2024
11ab1d0
fixed lint
daniel-sanche Sep 6, 2024
bb9c160
added mutations batcher tests
daniel-sanche Sep 9, 2024
06e0425
batcher uses multuple sync executors
daniel-sanche Sep 9, 2024
288c645
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 9, 2024
13abfd4
implemented wait manually
daniel-sanche Sep 9, 2024
93acd0d
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 9, 2024
49d5036
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 9, 2024
6ceb913
regenerated files
daniel-sanche Sep 9, 2024
1318ab6
fixed order of executor close
daniel-sanche Sep 10, 2024
a38b985
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 10, 2024
fd4b779
updated generated code
daniel-sanche Sep 10, 2024
8d15f48
changed num workers
daniel-sanche Sep 10, 2024
8bdddf4
added noxfile step to generate sync
daniel-sanche Sep 10, 2024
bb2a539
added test for generated code
daniel-sanche Sep 10, 2024
78c1405
added missing unit test deps
daniel-sanche Sep 10, 2024
b4608cb
run generate_sync from owlbot
daniel-sanche Sep 10, 2024
7dc9a2b
simplified file processing
daniel-sanche Sep 11, 2024
aacd8aa
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 11, 2024
18484a2
updated CrossSync.export statements
daniel-sanche Sep 11, 2024
93aac2a
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 11, 2024
41576f7
fixed issues in generation
daniel-sanche Sep 11, 2024
7d5df6d
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 11, 2024
0b9f377
fixed lint
daniel-sanche Sep 11, 2024
34833ef
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 11, 2024
8b13583
regenerated files
daniel-sanche Sep 11, 2024
7eb6ac4
use consistent black version
daniel-sanche Sep 11, 2024
0efb7f6
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Sep 11, 2024
d4224cc
changed black version
daniel-sanche Sep 11, 2024
c8d91c0
fixed underscores in annotations
daniel-sanche Sep 11, 2024
ef00397
fixed string access
daniel-sanche Sep 11, 2024
ea571bd
simplified transformers. Removed CrossSyncMethodHandler
daniel-sanche Sep 12, 2024
e42655b
simplified Convert decorator
daniel-sanche Sep 12, 2024
e972385
fixed 3.7 tests
daniel-sanche Sep 12, 2024
81a06f8
fixed mypy issues
daniel-sanche Sep 12, 2024
db8c156
extract header from code
daniel-sanche Sep 12, 2024
c418af2
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 12, 2024
d0dcbff
fix mock import
daniel-sanche Sep 12, 2024
b382993
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 12, 2024
22d3e40
fix test_sync_up_to_date test
daniel-sanche Sep 12, 2024
c16ea30
fix annotations
daniel-sanche Sep 12, 2024
37c3226
add warning to generated header
daniel-sanche Sep 13, 2024
54ee3be
updated README
daniel-sanche Sep 13, 2024
d44b829
made drop_method into drop, with support for classes
daniel-sanche Sep 13, 2024
61490e5
renamed export into convert_class
daniel-sanche Sep 13, 2024
ea0d5c4
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 13, 2024
b8b2181
use new decorator names
daniel-sanche Sep 13, 2024
74368a2
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 13, 2024
c6fcd69
regenerate files
daniel-sanche Sep 13, 2024
5e30192
removed unused annotation
daniel-sanche Sep 13, 2024
26315e4
ran blacken
daniel-sanche Sep 13, 2024
a45a6f6
extracted branch trimming into own transformer
daniel-sanche Sep 13, 2024
7052b31
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 13, 2024
be9c50d
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 13, 2024
dd2a65f
fixed visit to generic visit
daniel-sanche Sep 13, 2024
0d487eb
import ExecuteQueryIterator
daniel-sanche Sep 17, 2024
a4a591b
added docs for sync files
daniel-sanche Sep 17, 2024
5736661
add execute query iterators to cross sync mappings
daniel-sanche Sep 17, 2024
afe25fe
regenerated sync
daniel-sanche Sep 17, 2024
59a5df2
update transformer value access
daniel-sanche Sep 17, 2024
85f2bfd
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 17, 2024
1dc12c8
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 17, 2024
62d46ec
fixed py37 test
daniel-sanche Sep 17, 2024
087167f
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 17, 2024
c3675ce
regenerate files
daniel-sanche Sep 17, 2024
7dc78e1
fixed docfx
daniel-sanche Sep 17, 2024
9725131
increase max depth
daniel-sanche Sep 17, 2024
5a0fbba
put sync on top
daniel-sanche Sep 17, 2024
fd765a7
added notes to README
daniel-sanche Sep 17, 2024
487f8b2
generate into _sync_autogen directories
daniel-sanche Sep 17, 2024
77560c9
moved cross_sync directory
daniel-sanche Sep 18, 2024
252ddef
fixed outdated name
daniel-sanche Sep 18, 2024
f34d9a2
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 18, 2024
3c806b5
fixed import path
daniel-sanche Sep 18, 2024
8818628
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 18, 2024
fff417c
fixed import
daniel-sanche Sep 18, 2024
c346c56
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 18, 2024
e894845
moved files to _sync_autogen
daniel-sanche Sep 18, 2024
ab6fa6d
regenerated files
daniel-sanche Sep 18, 2024
6e71ec9
fixed imports
daniel-sanche Sep 18, 2024
720cf81
fixed import
daniel-sanche Sep 18, 2024
c82d967
moved tests
daniel-sanche Sep 18, 2024
48d44a6
renamed test file
daniel-sanche Sep 18, 2024
7c52d54
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Sep 18, 2024
ea281a6
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 18, 2024
7f07436
rm_aio in decorator for async
daniel-sanche Sep 27, 2024
e4b2e9b
remove owlbot generation
daniel-sanche Sep 27, 2024
c2c28e6
improved error message
daniel-sanche Sep 27, 2024
dba89e6
added sanity check to sync_up_to_date
daniel-sanche Sep 27, 2024
8cc4e07
use cross_sync for test proxy
daniel-sanche Sep 27, 2024
3c175ae
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 27, 2024
a8f371c
updated conformance tests for sync client
daniel-sanche Sep 27, 2024
20bb81d
fixed test proxy issues
daniel-sanche Sep 27, 2024
c75df5d
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Sep 27, 2024
61e3339
updated test proxy files
daniel-sanche Sep 27, 2024
601edf7
skip multistream conformance tests in sync surface
daniel-sanche Sep 27, 2024
86651db
add skips into github actions file
daniel-sanche Sep 27, 2024
2ab2e40
fixed typo
daniel-sanche Sep 27, 2024
14a5f25
renamed with_formatter
daniel-sanche Oct 24, 2024
8830375
fixed docstrings
daniel-sanche Oct 24, 2024
6be8180
cleaning up rm_aio
daniel-sanche Oct 24, 2024
54e3007
accept None as empty string
daniel-sanche Oct 24, 2024
5811a98
use None for empty string
daniel-sanche Oct 24, 2024
480b139
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Oct 24, 2024
66fc807
move _MB_SIZE back to batcher
daniel-sanche Oct 24, 2024
8b3b9c9
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Oct 24, 2024
89a816a
removed rm_aio call annotations
daniel-sanche Oct 25, 2024
c6f053b
fixed broken imports
daniel-sanche Oct 25, 2024
bee3e84
rm_aio at function level by default
daniel-sanche Oct 25, 2024
36c78ba
render to disk by default
daniel-sanche Oct 25, 2024
3c44095
fixed lint
daniel-sanche Oct 25, 2024
9244f56
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Oct 25, 2024
6135ccc
fixed mypy issue
daniel-sanche Oct 25, 2024
ff9d019
fixed unit tests
daniel-sanche Oct 25, 2024
56c76ef
Merge branch 'cross_sync2_pr1_architecture' into cross_sync2_pr2_anno…
daniel-sanche Oct 31, 2024
8a2f3ed
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Oct 31, 2024
26eeb0c
regnerated sync files
daniel-sanche Oct 31, 2024
ae5dc6a
Merge branch 'main' into cross_sync2_pr2_annotations
daniel-sanche Nov 8, 2024
c95ca68
addressing broken tests
daniel-sanche Nov 8, 2024
4951b0f
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Nov 11, 2024
e7ce0d0
regenerated files
daniel-sanche Nov 11, 2024
7a1e422
removed unneeded import
daniel-sanche Nov 11, 2024
008e724
fix tests
daniel-sanche Nov 11, 2024
6945a48
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Nov 11, 2024
2d04db7
fixed formatter param
daniel-sanche Nov 11, 2024
7fb2134
fixed grace_period for sync client
daniel-sanche Nov 11, 2024
e8d122e
fixed lint
daniel-sanche Nov 11, 2024
d489ad3
cleaned up imports
daniel-sanche Nov 12, 2024
e0ab0b7
Merge branch 'cross_sync2_pr2_annotations' into cross_sync2_pr3_gener…
daniel-sanche Nov 12, 2024
0d7d7ea
fixed lint
daniel-sanche Nov 12, 2024
49c7059
Merge branch 'main' into cross_sync2_pr3_generated_sync
daniel-sanche Nov 28, 2024
081a234
updated sync code
daniel-sanche Nov 28, 2024
d0768d3
fix docs issue
daniel-sanche Nov 28, 2024
61707ca
remove new tests from this PR
daniel-sanche Nov 28, 2024
b245b78
removed missing lines
daniel-sanche Nov 28, 2024
b3d5993
renamed docs files
daniel-sanche Dec 3, 2024
e54f338
fixed index file name
daniel-sanche Dec 3, 2024
216c4f1
fixed py3.7 issue
daniel-sanche Dec 5, 2024
f7d908a
made timings looser
daniel-sanche Dec 5, 2024
b3b63c4
added missing timezone in test
daniel-sanche Dec 5, 2024
2f40ea2
allow more timed out requests in test
daniel-sanche Dec 5, 2024
7365229
give larger time buffer for test
daniel-sanche Dec 5, 2024
8e3334f
updated copyright dates
daniel-sanche Dec 12, 2024
e11f701
loosened test assertion
daniel-sanche Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cross_sync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ CrossSync provides a set of annotations to mark up async classes, to guide the g

### Code Generation

Generation can be initiated using `python .cross_sync/generate.py .`
Generation can be initiated using `nox -s generate_sync`
from the root of the project. This will find all classes with the `__CROSS_SYNC_OUTPUT__ = "path/to/output"`
annotation, and generate a sync version of classes marked with `@CrossSync.convert_sync` at the output path.

Expand Down
18 changes: 0 additions & 18 deletions docs/async_data_client/async_data_usage.rst

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Bigtable Data Client Async
performance benefits, the codebase should be designed to be async from the ground up.


.. autoclass:: google.cloud.bigtable.data._async.client.BigtableDataClientAsync
.. autoclass:: google.cloud.bigtable.data.BigtableDataClientAsync
:members:
:show-inheritance:
39 changes: 39 additions & 0 deletions docs/data_client/data_client_usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Data Client
===========

Sync Surface
------------

.. toctree::
:maxdepth: 3

sync_data_client
sync_data_table
sync_data_mutations_batcher
sync_data_execute_query_iterator

Async Surface
-------------

.. toctree::
:maxdepth: 3

async_data_client
async_data_table
async_data_mutations_batcher
async_data_execute_query_iterator

Common Classes
--------------

.. toctree::
:maxdepth: 3

common_data_read_rows_query
common_data_row
common_data_row_filters
common_data_mutations
common_data_read_modify_write_rules
common_data_exceptions
common_data_execute_query_values
common_data_execute_query_metadata
6 changes: 6 additions & 0 deletions docs/data_client/sync_data_client.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bigtable Data Client
~~~~~~~~~~~~~~~~~~~~

.. autoclass:: google.cloud.bigtable.data.BigtableDataClient
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/data_client/sync_data_execute_query_iterator.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Execute Query Iterator
~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: google.cloud.bigtable.data.execute_query.ExecuteQueryIterator
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/data_client/sync_data_mutations_batcher.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Mutations Batcher
~~~~~~~~~~~~~~~~~

.. automodule:: google.cloud.bigtable.data._sync_autogen.mutations_batcher
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/data_client/sync_data_table.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Table
~~~~~

.. autoclass:: google.cloud.bigtable.data.Table
:members:
:show-inheritance:
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
Client Types
-------------
.. toctree::
:maxdepth: 2
:maxdepth: 3

data_client/data_client_usage
classic_client/usage
async_data_client/async_data_usage


Changelog
Expand Down
9 changes: 4 additions & 5 deletions docs/scripts/patch_devsite_toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def __init__(self, dir_name, index_file_name):
continue
# bail when toc indented block is done
if not line.startswith(" ") and not line.startswith("\t"):
break
in_toc = False
continue
# extract entries
self.items.append(self.extract_toc_entry(line.strip()))

Expand Down Expand Up @@ -194,9 +195,7 @@ def validate_toc(toc_file_path, expected_section_list, added_sections):
# Add secrtions for the async_data_client and classic_client directories
toc_path = "_build/html/docfx_yaml/toc.yml"
custom_sections = [
TocSection(
dir_name="async_data_client", index_file_name="async_data_usage.rst"
),
TocSection(dir_name="data_client", index_file_name="data_client_usage.rst"),
TocSection(dir_name="classic_client", index_file_name="usage.rst"),
]
add_sections(toc_path, custom_sections)
Expand All @@ -210,7 +209,7 @@ def validate_toc(toc_file_path, expected_section_list, added_sections):
"bigtable APIs",
"Changelog",
"Multiprocessing",
"Async Data Client",
"Data Client",
"Classic Client",
],
added_sections=custom_sections,
Expand Down
18 changes: 16 additions & 2 deletions google/cloud/bigtable/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

from google.cloud.bigtable.data._async.client import BigtableDataClientAsync
from google.cloud.bigtable.data._async.client import TableAsync

from google.cloud.bigtable.data._async.mutations_batcher import MutationsBatcherAsync
from google.cloud.bigtable.data._sync_autogen.client import BigtableDataClient
from google.cloud.bigtable.data._sync_autogen.client import Table
from google.cloud.bigtable.data._sync_autogen.mutations_batcher import MutationsBatcher

from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
from google.cloud.bigtable.data.read_rows_query import RowRange
Expand Down Expand Up @@ -52,20 +54,32 @@
from google.cloud.bigtable.data._async._read_rows import _ReadRowsOperationAsync
from google.cloud.bigtable.data._async._mutate_rows import _MutateRowsOperationAsync

from google.cloud.bigtable_v2.services.bigtable.client import (
BigtableClient,
)
from google.cloud.bigtable.data._sync_autogen._read_rows import _ReadRowsOperation
from google.cloud.bigtable.data._sync_autogen._mutate_rows import _MutateRowsOperation

from google.cloud.bigtable.data._cross_sync import CrossSync

CrossSync.add_mapping("GapicClient", BigtableAsyncClient)
CrossSync._Sync_Impl.add_mapping("GapicClient", BigtableClient)
CrossSync.add_mapping("_ReadRowsOperation", _ReadRowsOperationAsync)
CrossSync._Sync_Impl.add_mapping("_ReadRowsOperation", _ReadRowsOperation)
CrossSync.add_mapping("_MutateRowsOperation", _MutateRowsOperationAsync)
CrossSync._Sync_Impl.add_mapping("_MutateRowsOperation", _MutateRowsOperation)
CrossSync.add_mapping("MutationsBatcher", MutationsBatcherAsync)

CrossSync._Sync_Impl.add_mapping("MutationsBatcher", MutationsBatcher)

__version__: str = package_version.__version__

__all__ = (
"BigtableDataClientAsync",
"TableAsync",
"MutationsBatcherAsync",
"BigtableDataClient",
"Table",
"MutationsBatcher",
"RowKeySamples",
"ReadRowsQuery",
"RowRange",
Expand Down
9 changes: 9 additions & 0 deletions google/cloud/bigtable/data/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@
)
from google.cloud.bigtable.data._async.mutations_batcher import _MB_SIZE
else:
from typing import Iterable # noqa: F401
from grpc import insecure_channel
from google.cloud.bigtable_v2.services.bigtable.transports import BigtableGrpcTransport as TransportType # type: ignore
from google.cloud.bigtable.data._sync_autogen.mutations_batcher import _MB_SIZE


if TYPE_CHECKING:
Expand All @@ -100,6 +102,13 @@
from google.cloud.bigtable.data.execute_query._async.execute_query_iterator import (
ExecuteQueryIteratorAsync,
)
else:
from google.cloud.bigtable.data._sync_autogen.mutations_batcher import ( # noqa: F401
MutationsBatcher,
)
from google.cloud.bigtable.data.execute_query._sync_autogen.execute_query_iterator import ( # noqa: F401
ExecuteQueryIterator,
)


__CROSS_SYNC_OUTPUT__ = "google.cloud.bigtable.data._sync_autogen.client"
Expand Down
6 changes: 3 additions & 3 deletions google/cloud/bigtable/data/_async/mutations_batcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
from __future__ import annotations

from typing import Sequence, TYPE_CHECKING
from typing import Sequence, TYPE_CHECKING, cast
import atexit
import warnings
from collections import deque
Expand Down Expand Up @@ -250,7 +250,7 @@ def __init__(
)
# used by sync class to manage flush_internal tasks
self._sync_flush_executor = (
concurrent.futures.ThreadPoolExecutor(max_workers=1)
concurrent.futures.ThreadPoolExecutor(max_workers=4)
if not CrossSync.is_async
else None
)
Expand Down Expand Up @@ -305,7 +305,7 @@ async def append(self, mutation_entry: RowMutationEntry):
# TODO: return a future to track completion of this entry
if self._closed.is_set():
raise RuntimeError("Cannot append to closed MutationsBatcher")
if isinstance(mutation_entry, Mutation): # type: ignore
if isinstance(cast(Mutation, mutation_entry), Mutation):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need cast() here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TL;DR: because comments aren't part of the ast, so # type: ignore doesn't make it through the generation process for the sync client. But typing.cast does the same thing, by forcing the type checker to treat it as a specific type here

For why we need to ignore the type in the first place: this is a check to raise a helpful error when the user passes in a Mutation instead of a RowMutationEntry, which could be an easy mistake to make. But the type checker doesn't like this check, since we're checking if it's a type that it knows it should never be

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation!

raise ValueError(
f"invalid mutation type: {type(mutation_entry).__name__}. Only RowMutationEntry objects are supported by batcher"
)
Expand Down
5 changes: 3 additions & 2 deletions google/cloud/bigtable/data/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
if TYPE_CHECKING:
import grpc
from google.cloud.bigtable.data import TableAsync
from google.cloud.bigtable.data import Table

"""
Helper functions used in various places in the library.
Expand Down Expand Up @@ -120,7 +121,7 @@ def _retry_exception_factory(
def _get_timeouts(
operation: float | TABLE_DEFAULT,
attempt: float | None | TABLE_DEFAULT,
table: "TableAsync",
table: "TableAsync" | "Table",
) -> tuple[float, float]:
"""
Convert passed in timeout values to floats, using table defaults if necessary.
Expand Down Expand Up @@ -207,7 +208,7 @@ def _get_error_type(

def _get_retryable_errors(
call_codes: Sequence["grpc.StatusCode" | int | type[Exception]] | TABLE_DEFAULT,
table: "TableAsync",
table: "TableAsync" | "Table",
) -> list[type[Exception]]:
"""
Convert passed in retryable error codes to a list of exception types.
Expand Down
Loading
Loading