-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathfirestore-integration.yaml
More file actions
750 lines (724 loc) · 23.4 KB
/
Copy pathfirestore-integration.yaml
File metadata and controls
750 lines (724 loc) · 23.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
description: Integrate Google Cloud Firestore Handwritten code
# TODO(Fill in issue number below to add more context)
url: https://github.com/googleapis/gapic-generator-python/issues/123
replacements:
- paths: [
"packages/google-cloud-firestore/google/cloud/firestore_bundle/types/bundle.py",
]
before: |
import google.firestore.v1.document_pb2 as document_pb2 # type: ignore
import google.firestore.v1.query_pb2 as query_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
import proto # type: ignore
after: |
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
import proto # type: ignore
from google.cloud.firestore_v1.types import document as document_pb2 # type: ignore
from google.cloud.firestore_v1.types import query as query_pb2 # type: ignore
count: 1
- paths: [
"packages/google-cloud-firestore/google/cloud/firestore_v1/__init__.py",
]
before: |
import sys\n
import google.api_core as api_core\n
from google.cloud.firestore_v1 import gapic_version as package_version
[\s\S]*?"WriteResult",\n\)
after: |
"""Python idiomatic client for Google Cloud Firestore."""\n
from google.cloud.firestore_v1 import gapic_version as package_version
__version__: str = package_version.__version__
from typing import List
from google.cloud.firestore_v1 import types
from google.cloud.firestore_v1._helpers import (
ExistsOption,
GeoPoint,
LastUpdateOption,
ReadAfterWriteError,
WriteOption,
)
from google.cloud.firestore_v1.async_batch import AsyncWriteBatch
from google.cloud.firestore_v1.async_client import AsyncClient
from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
from google.cloud.firestore_v1.async_document import AsyncDocumentReference
from google.cloud.firestore_v1.async_pipeline import AsyncPipeline
from google.cloud.firestore_v1.async_query import AsyncQuery
from google.cloud.firestore_v1.async_transaction import (
AsyncTransaction,
async_transactional,
)
from google.cloud.firestore_v1.base_aggregation import CountAggregation
from google.cloud.firestore_v1.base_document import DocumentSnapshot
from google.cloud.firestore_v1.base_pipeline import SubPipeline
from google.cloud.firestore_v1.base_query import And, FieldFilter, Or
from google.cloud.firestore_v1.batch import WriteBatch
from google.cloud.firestore_v1.client import Client
from google.cloud.firestore_v1.collection import CollectionReference
from google.cloud.firestore_v1.document import DocumentReference
from google.cloud.firestore_v1.pipeline import Pipeline
from google.cloud.firestore_v1.pipeline_result import (
AsyncPipelineStream,
PipelineResult,
PipelineSnapshot,
PipelineStream,
)
from google.cloud.firestore_v1.pipeline_source import PipelineSource
from google.cloud.firestore_v1.pipeline_types import (
FindNearestOptions,
Ordering,
PipelineDataType,
SampleOptions,
SearchOptions,
TimeGranularity,
TimePart,
TimeUnit,
UnnestOptions,
)
from google.cloud.firestore_v1.query import CollectionGroup, Query
from google.cloud.firestore_v1.query_profile import (
ExplainOptions,
PipelineExplainOptions,
)
from google.cloud.firestore_v1.transaction import Transaction, transactional
from google.cloud.firestore_v1.transforms import (
DELETE_FIELD,
SERVER_TIMESTAMP,
ArrayRemove,
ArrayUnion,
Increment,
Maximum,
Minimum,
)
from google.cloud.firestore_v1.watch import Watch
# TODO(https://github.com/googleapis/python-firestore/issues/93): this is all on the generated surface. We require this to match
# firestore.py. So comment out until needed on customer level for certain.
# from .services.firestore import FirestoreClient
# from .types.common import DocumentMask
# from .types.common import Precondition
# from .types.common import TransactionOptions
# from .types.document import ArrayValue
# from .types.document import Document
# from .types.document import MapValue
# from .types.document import Value
# from .types.firestore import BatchGetDocumentsRequest
# from .types.firestore import BatchGetDocumentsResponse
# from .types.firestore import BatchWriteRequest
# from .types.firestore import BatchWriteResponse
# from .types.firestore import BeginTransactionRequest
# from .types.firestore import BeginTransactionResponse
# from .types.firestore import CommitRequest
# from .types.firestore import CommitResponse
# from .types.firestore import CreateDocumentRequest
# from .types.firestore import DeleteDocumentRequest
# from .types.firestore import GetDocumentRequest
# from .types.firestore import ListCollectionIdsRequest
# from .types.firestore import ListCollectionIdsResponse
# from .types.firestore import ListDocumentsRequest
# from .types.firestore import ListDocumentsResponse
# from .types.firestore import ListenRequest
# from .types.firestore import ListenResponse
# from .types.firestore import PartitionQueryRequest
# from .types.firestore import PartitionQueryResponse
# from .types.firestore import RollbackRequest
# from .types.firestore import RunQueryRequest
# from .types.firestore import RunQueryResponse
# from .types.firestore import Target
# from .types.firestore import TargetChange
# from .types.firestore import UpdateDocumentRequest
# from .types.firestore import WriteRequest
# from .types.firestore import WriteResponse
# from .types.query import Cursor
# from .types.query import StructuredQuery
# from .types.write import DocumentChange
# from .types.write import DocumentDelete
# from .types.write import DocumentRemove
from .types.write import DocumentTransform
# from .types.write import ExistenceFilter
# from .types.write import Write
# from .types.write import WriteResult
__all__: List[str] = [
"__version__",
"And",
"ArrayRemove",
"ArrayUnion",
"AsyncClient",
"AsyncCollectionReference",
"AsyncDocumentReference",
"AsyncPipeline",
"AsyncPipelineStream",
"AsyncQuery",
"async_transactional",
"AsyncTransaction",
"AsyncWriteBatch",
"Client",
"CountAggregation",
"CollectionGroup",
"CollectionReference",
"DELETE_FIELD",
"DocumentReference",
"DocumentSnapshot",
"DocumentTransform",
"ExistsOption",
"ExplainOptions",
"FieldFilter",
"FindNearestOptions",
"GeoPoint",
"Increment",
"LastUpdateOption",
"Maximum",
"Minimum",
"Or",
"Ordering",
"Pipeline",
"PipelineDataType",
"PipelineExplainOptions",
"PipelineResult",
"PipelineSnapshot",
"PipelineSource",
"PipelineStream",
"Query",
"ReadAfterWriteError",
"SERVER_TIMESTAMP",
"SampleOptions",
"SearchOptions",
"SubPipeline",
"TimeGranularity",
"TimePart",
"TimeUnit",
"Transaction",
"transactional",
"types",
"UnnestOptions",
"Watch",
"WriteBatch",
"WriteOption",
]
count: 1
- paths: [
"packages/google-cloud-firestore/google/cloud/firestore/__init__.py",
]
before: |
from google.cloud.firestore import gapic_version as package_version
[\s\S]*?"WriteResult",\n\)
after: |
"""Python idiomatic client for Google Cloud Firestore."""\n
from google.cloud.firestore_v1 import gapic_version as package_version
__version__ = package_version.__version__
from typing import List
from google.cloud.firestore_v1 import (
DELETE_FIELD,
SERVER_TIMESTAMP,
And,
ArrayRemove,
ArrayUnion,
AsyncClient,
AsyncCollectionReference,
AsyncDocumentReference,
AsyncPipeline,
AsyncPipelineStream,
AsyncQuery,
AsyncTransaction,
AsyncWriteBatch,
Client,
CollectionGroup,
CollectionReference,
CountAggregation,
DocumentReference,
DocumentSnapshot,
DocumentTransform,
ExistsOption,
ExplainOptions,
FieldFilter,
FindNearestOptions,
GeoPoint,
Increment,
LastUpdateOption,
Maximum,
Minimum,
Or,
Ordering,
Pipeline,
PipelineDataType,
PipelineExplainOptions,
PipelineResult,
PipelineSnapshot,
PipelineSource,
PipelineStream,
Query,
ReadAfterWriteError,
SampleOptions,
SearchOptions,
SubPipeline,
TimeGranularity,
TimePart,
TimeUnit,
Transaction,
UnnestOptions,
Watch,
WriteBatch,
WriteOption,
async_transactional,
transactional,
types,
)
__all__: List[str] = [
"__version__",
"And",
"ArrayRemove",
"ArrayUnion",
"AsyncClient",
"AsyncCollectionReference",
"AsyncDocumentReference",
"AsyncPipeline",
"AsyncPipelineStream",
"AsyncQuery",
"async_transactional",
"AsyncTransaction",
"AsyncWriteBatch",
"Client",
"CountAggregation",
"CollectionGroup",
"CollectionReference",
"DELETE_FIELD",
"DocumentReference",
"DocumentSnapshot",
"DocumentTransform",
"ExistsOption",
"ExplainOptions",
"FieldFilter",
"FindNearestOptions",
"GeoPoint",
"Increment",
"LastUpdateOption",
"Maximum",
"Minimum",
"Or",
"Ordering",
"Pipeline",
"PipelineDataType",
"PipelineExplainOptions",
"PipelineResult",
"PipelineSnapshot",
"PipelineSource",
"PipelineStream",
"Query",
"ReadAfterWriteError",
"SERVER_TIMESTAMP",
"SampleOptions",
"SearchOptions",
"SubPipeline",
"TimeGranularity",
"TimePart",
"TimeUnit",
"Transaction",
"transactional",
"types",
"UnnestOptions",
"Watch",
"WriteBatch",
"WriteOption",
]
count: 1
count: 1
- paths: [
"packages/google-cloud-firestore/google/cloud/firestore_admin_v1/__init__.py",
]
before: |
import sys\n
import google.api_core as api_core\n
from google.cloud.firestore_admin_v1 import gapic_version as package_version
[\s\S]*?"WeeklyRecurrence",\n\)
after: |
from .services.firestore_admin import FirestoreAdminClient
from .types.field import Field
from .types.firestore_admin import (
CreateIndexRequest,
DeleteIndexRequest,
ExportDocumentsRequest,
GetFieldRequest,
GetIndexRequest,
ImportDocumentsRequest,
ListFieldsRequest,
ListFieldsResponse,
ListIndexesRequest,
ListIndexesResponse,
UpdateFieldRequest,
)
from .types.index import Index
from .types.location import LocationMetadata
from .types.operation import (
ExportDocumentsMetadata,
ExportDocumentsResponse,
FieldOperationMetadata,
ImportDocumentsMetadata,
IndexOperationMetadata,
OperationState,
Progress,
)
__all__ = (
"CreateIndexRequest",
"DeleteIndexRequest",
"ExportDocumentsMetadata",
"ExportDocumentsRequest",
"ExportDocumentsResponse",
"Field",
"FieldOperationMetadata",
"GetFieldRequest",
"GetIndexRequest",
"ImportDocumentsMetadata",
"ImportDocumentsRequest",
"Index",
"IndexOperationMetadata",
"ListFieldsRequest",
"ListFieldsResponse",
"ListIndexesRequest",
"ListIndexesResponse",
"LocationMetadata",
"OperationState",
"Progress",
"UpdateFieldRequest",
"FirestoreAdminClient",
)
count: 1
- paths: [
"packages/google-cloud-firestore/google/cloud/firestore_admin/__init__.py",
]
before: |
from google.cloud.firestore_admin import gapic_version as package_version
[\s\S]*?"UserCreds",\n\)
after: |
from google.cloud.firestore_admin_v1.services.firestore_admin import (
FirestoreAdminClient,
)
from google.cloud.firestore_admin_v1.types.field import Field
from google.cloud.firestore_admin_v1.types.firestore_admin import (
CreateIndexRequest,
DeleteIndexRequest,
ExportDocumentsRequest,
GetFieldRequest,
GetIndexRequest,
ImportDocumentsRequest,
ListFieldsRequest,
ListFieldsResponse,
ListIndexesRequest,
ListIndexesResponse,
UpdateFieldRequest,
)
from google.cloud.firestore_admin_v1.types.index import Index
from google.cloud.firestore_admin_v1.types.location import LocationMetadata
from google.cloud.firestore_admin_v1.types.operation import (
ExportDocumentsMetadata,
ExportDocumentsResponse,
FieldOperationMetadata,
ImportDocumentsMetadata,
IndexOperationMetadata,
OperationState,
Progress,
)
__all__ = (
"CreateIndexRequest",
"DeleteIndexRequest",
"ExportDocumentsMetadata",
"ExportDocumentsRequest",
"ExportDocumentsResponse",
"Field",
"FieldOperationMetadata",
"GetFieldRequest",
"GetIndexRequest",
"ImportDocumentsMetadata",
"ImportDocumentsRequest",
"Index",
"IndexOperationMetadata",
"ListFieldsRequest",
"ListFieldsResponse",
"ListIndexesRequest",
"ListIndexesResponse",
"LocationMetadata",
"OperationState",
"Progress",
"UpdateFieldRequest",
"FirestoreAdminClient",
)
count: 1
- paths: [
"packages/google-cloud-firestore/google/cloud/firestore_bundle/__init__.py",
]
before: |
__lazy_modules__ = \{
\ "google.cloud.firestore_bundle.types.bundle",
\}\n\n
from .types.bundle import \(
after: |
__lazy_modules__ = {
"google.cloud.firestore_bundle.types.bundle",
}\n\n
from .bundle import FirestoreBundle
from .types.bundle import (
count: 1
- paths: [
"packages/google-cloud-firestore/google/cloud/firestore_bundle/__init__.py",
]
before: '__all__ = \(\n "BundleElement",\n'
after: |
__all__ = (
"FirestoreBundle",
"BundleElement",
count: 1
- paths: [
"packages/google-cloud-firestore/noxfile.py",
]
before: |
# Error if a python version is missing
nox.options.error_on_missing_interpreters = True\n\n
\@nox.session\(python=ALL_PYTHON\)
def mypy\(session\):
after: |
# Error if a python version is missing
nox.options.error_on_missing_interpreters = True\n\n
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
def system_emulated(session):
import signal
import subprocess
try:
# https://github.com/googleapis/python-firestore/issues/472
# Kokoro image doesn't have java installed, don't attempt to run emulator.
subprocess.call(["java", "--version"])
except OSError:
session.skip("java not found but required for emulator support")
try:
subprocess.call(["gcloud", "--version"])
except OSError:
session.skip("gcloud not found but required for emulator support")
# Currently, CI/CD doesn't have beta component of gcloud.
subprocess.call(
[
"gcloud",
"components",
"install",
"beta",
"cloud-firestore-emulator",
]
)
hostport = "localhost:8789"
session.env["FIRESTORE_EMULATOR_HOST"] = hostport
p = subprocess.Popen(
[
"gcloud",
"--quiet",
"beta",
"emulators",
"firestore",
"start",
"--host-port",
hostport,
]
)
try:
system(session)
finally:
# Stop Emulator
os.killpg(os.getpgid(p.pid), signal.SIGKILL)\n\n
@nox.session(python=ALL_PYTHON)
def mypy(session):
count: 1
- paths: [
packages/google-cloud-firestore/noxfile.py
]
before: |
UNIT_TEST_EXTERNAL_DEPENDENCIES: List\[str\] = \[\]
after: |
UNIT_TEST_EXTERNAL_DEPENDENCIES: List[str] = [
"aiounittest",
"six",
"freezegun",
]
count: 1
- paths: [
packages/google-cloud-firestore/noxfile.py
]
before: |
SYSTEM_TEST_STANDARD_DEPENDENCIES = \[
"mock",
"pytest",
"google-cloud-testutils",
\]
after: |
SYSTEM_TEST_STANDARD_DEPENDENCIES = [
"mock",
"pytest",
]
count: 1
- paths: [
packages/google-cloud-firestore/noxfile.py
]
before: |
SYSTEM_TEST_LOCAL_DEPENDENCIES: List\[str\] = \[\]
after: |
SYSTEM_TEST_LOCAL_DEPENDENCIES: List[str] = [
"../google-cloud-testutils"
]
count: 1
# TODO(https://github.com/googleapis/google-cloud-python/issues/17429):
# Temporary post-processing rule to add pytest-xdist dependency.
# Remove this once gapic-generator includes pytest-xdist by default.
- paths: [
packages/google-cloud-firestore/noxfile.py
]
before: |
SYSTEM_TEST_EXTERNAL_DEPENDENCIES: List\[str\] = \[\]
after: |
SYSTEM_TEST_EXTERNAL_DEPENDENCIES: List[str] = [
"pytest-asyncio",
"six",
"pyyaml",
"pytest-xdist",
]
count: 1
- paths: [
packages/google-cloud-firestore/noxfile.py
]
before: |
"pytest-asyncio",
after: |
"pytest-asyncio==0.21.2",
count: 2
# TODO(https://github.com/googleapis/google-cloud-python/issues/17429):
# Temporary post-processing rule to inject `-n auto` for Firestore parallel tests.
# This rule should be removed once the generator template changes are released
# and the generator version is updated in librarian.yaml.
- paths: [
packages/google-cloud-firestore/noxfile.py
]
before: |
# Run py.test against the system tests.
\ if system_test_exists:
\ session.run\(
\ "py.test",
\ "--quiet",
\ f"--junitxml=system_\{session.python\}_sponge_log.xml",
\ system_test_path,
\ \*session.posargs,
\ \)
\ if system_test_folder_exists:
\ session.run\(
\ "py.test",
\ "--quiet",
\ f"--junitxml=system_\{session.python\}_sponge_log.xml",
\ system_test_folder_path,
\ \*session.posargs,
\ \)
after: |
# Run py.test against the system tests.
if system_test_exists:
session.run(
"py.test",
"-n",
"10",
"--quiet",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_path,
*session.posargs,
)
if system_test_folder_exists:
session.run(
"py.test",
"-n",
"10",
"--quiet",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_folder_path,
*session.posargs,
)
count: 1
- paths: [
"packages/google-cloud-firestore/docs/conf.py",
]
before: |
exclude_patterns = \[
\ "_build",
after: |
exclude_patterns = [
"**/firestore.rst",
"**/firestore_admin.rst",
"**/services_.rst",
"**/types_.rst",
"_build",
count: 1
- paths: [
"packages/google-cloud-firestore/setup.py",
]
before: |
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
\ "grpcio >= 1.59.0, < 2.0.0",
after: |
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
"google-cloud-core >= 2.0.0, <3.0.0",
"grpcio >= 1.59.0, < 2.0.0",
count: 1
- paths: [
"packages/google-cloud-firestore/docs/index.rst",
]
before: |
.. include:: multiprocessing.rst\n\n
API Reference
-------------
.. toctree::
\ :maxdepth: 2\n
\ firestore_admin_v1/services_
\ firestore_admin_v1/types_
after: |
.. include:: multiprocessing.rst\n\n
API Reference
-------------
.. toctree::
:maxdepth: 2
firestore_admin_v1/admin_client
firestore_bundle/bundles
firestore_v1/aggregation
firestore_v1/batch
firestore_v1/bulk_writer
firestore_v1/client
firestore_v1/collection
firestore_v1/document
firestore_v1/field_path
firestore_v1/query
firestore_v1/transaction
firestore_v1/transforms
firestore_v1/types
count: 1
- paths: [
"packages/google-cloud-firestore/testing/constraints-3.10.txt",
]
before: |
google-auth==2.14.1
grpcio==1.59.0
after: |
google-auth==2.14.1
google-cloud-core==2.0.0
grpcio==1.59.0
count: 1
- paths: [
"packages/google-cloud-firestore/testing/constraints-3.13.txt",
"packages/google-cloud-firestore/testing/constraints-3.14.txt",
]
before: |
google-auth>=2
grpcio>=1
after: |
google-auth>=2
google-cloud-core>=2
grpcio>=1
count: 2