Skip to content

Commit b11224f

Browse files
authored
feat(firestore): drop Python 3.7-3.9 support and regenerate (#17247)
This PR updates python to establish version 3.10 as the minimum supported version. ### Changes * **Configuration & Dependencies**: * Updated the Python support matrix and classifiers across `setup.py`, `noxfile.py`, and `CONTRIBUTING.rst` to require Python `>= 3.10`. * Regenerated and synchronized EOL runtime constraints files. * Cleaned up and pruned obsolete warning filters inside `pytest.ini` that were previously used for Python < 3.10. * **Test Suite Enhancements**: * Refactored `test_pipeline_explain_options_explain_mode` inside both `test_system.py` and `test_system_async.py`. * Previously, the tests expected an `InvalidArgument` exception since Explain mode wasn't supported on pipeline queries. Since the live backend now natively supports Explain mode on Pipeline queries, the tests were updated to assert **successful plan metrics execution** and verify that the correct `ExplainStats` protobuf structures are returned. * **Librarian Generator Post-Processing**: * Configured and integrated permanent EOL post-processing rules directly inside `.librarian/generator-input/client-post-processing/firestore-integration.yaml` to ensure that all future gapic-generator runs automatically preserve these EOL constraints changes and avoid generator overwrites.
1 parent e906e01 commit b11224f

8 files changed

Lines changed: 62 additions & 36 deletions

File tree

.librarian/generator-input/client-post-processing/firestore-integration.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,4 +644,26 @@ replacements:
644644
firestore_v1/transforms
645645
firestore_v1/types
646646
count: 1
647-
647+
- paths: [
648+
"packages/google-cloud-firestore/testing/constraints-3.10.txt",
649+
]
650+
before: |
651+
google-auth==2.14.1
652+
grpcio==1.44.0
653+
after: |
654+
google-auth==2.14.1
655+
google-cloud-core==2.0.0
656+
grpcio==1.44.0
657+
count: 1
658+
- paths: [
659+
"packages/google-cloud-firestore/testing/constraints-3.13.txt",
660+
"packages/google-cloud-firestore/testing/constraints-3.14.txt",
661+
]
662+
before: |
663+
google-auth>=2
664+
grpcio>=1
665+
after: |
666+
google-auth>=2
667+
google-cloud-core>=2
668+
grpcio>=1
669+
count: 2

packages/google-cloud-firestore/CONTRIBUTING.rst

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In order to add a feature:
2222
documentation.
2323

2424
- The feature must work fully on the following CPython versions:
25-
3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows.
25+
3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows.
2626

2727
- The feature must not add unnecessary dependencies (where
2828
"unnecessary" is of course subjective, but new dependencies should
@@ -143,13 +143,7 @@ Running System Tests
143143
$ nox -s system
144144

145145
# Run a single system test
146-
$ nox -s system-3.7 -- -k <name of test>
147-
148-
149-
.. note::
150-
151-
System tests are only configured to run under Python 3.7.
152-
For expediency, we do not run them in older versions of Python 3.
146+
$ nox -s system-3.14 -- -k <name of test>
153147

154148
This alone will not run the tests. You'll need to change some local
155149
auth settings and change some configuration in your project to
@@ -205,11 +199,11 @@ configure them just like the System Tests.
205199

206200
# Run all tests in a folder
207201
$ cd samples/snippets
208-
$ nox -s py-3.8
202+
$ nox -s py-3.10
209203

210204
# Run a single sample test
211205
$ cd samples/snippets
212-
$ nox -s py-3.8 -- -k <name of test>
206+
$ nox -s py-3.10 -- -k <name of test>
213207

214208
********************************************
215209
Note About ``README`` as it pertains to PyPI
@@ -231,18 +225,12 @@ Supported Python Versions
231225

232226
We support:
233227

234-
- `Python 3.7`_
235-
- `Python 3.8`_
236-
- `Python 3.9`_
237228
- `Python 3.10`_
238229
- `Python 3.11`_
239230
- `Python 3.12`_
240231
- `Python 3.13`_
241232
- `Python 3.14`_
242233

243-
.. _Python 3.7: https://docs.python.org/3.7/
244-
.. _Python 3.8: https://docs.python.org/3.8/
245-
.. _Python 3.9: https://docs.python.org/3.9/
246234
.. _Python 3.10: https://docs.python.org/3.10/
247235
.. _Python 3.11: https://docs.python.org/3.11/
248236
.. _Python 3.12: https://docs.python.org/3.12/
@@ -255,7 +243,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_.
255243
.. _config: https://github.com/googleapis/google-cloud-python/blob/main/noxfile.py
256244

257245

258-
We also explicitly decided to support Python 3 beginning with version 3.7.
246+
We also explicitly decided to support Python 3 beginning with version 3.10.
259247
Reasons for this include:
260248

261249
- Encouraging use of newest versions of Python 3

packages/google-cloud-firestore/pytest.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ filterwarnings =
1414
ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning
1515
# Remove warning once https://github.com/grpc/grpc/issues/35974 is fixed
1616
ignore:unclosed:ResourceWarning
17-
# Remove after support for Python 3.7 is dropped
18-
ignore:After January 1, 2024, new releases of this library will drop support for Python 3.7:DeprecationWarning
1917
# Remove warning once https://github.com/googleapis/gapic-generator-python/issues/1939 is fixed
2018
ignore:get_mtls_endpoint_and_cert_source is deprecated.:DeprecationWarning
2119
# Remove once credential file support is removed
@@ -25,3 +23,6 @@ filterwarnings =
2523
ignore:.*\'asyncio.get_event_loop_policy\' is deprecated.*:DeprecationWarning
2624
ignore:.*Please upgrade to the latest Python version.*:FutureWarning
2725
ignore:(?s).*using a Python version.*past its end of life.*:FutureWarning
26+
# Remove once opentelemetry stops triggering SelectableGroups DeprecationWarning on Python 3.11+
27+
ignore:.*SelectableGroups dict interface is deprecated.*:DeprecationWarning
28+

packages/google-cloud-firestore/testing/constraints-3.10.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# then this file should have google-cloud-foo==1.14.0
77
google-api-core==2.17.1
88
google-auth==2.14.1
9+
google-cloud-core==2.0.0
910
grpcio==1.44.0
1011
proto-plus==1.22.3
1112
protobuf==4.25.8

packages/google-cloud-firestore/testing/constraints-3.13.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# Then this file should have google-cloud-foo>=1
88
google-api-core>=2
99
google-auth>=2
10+
google-cloud-core>=2
1011
grpcio>=1
1112
proto-plus>=1
1213
protobuf>=6

packages/google-cloud-firestore/testing/constraints-3.14.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# Then this file should have google-cloud-foo>=1
88
google-api-core>=2
99
google-auth>=2
10+
google-cloud-core>=2
1011
grpcio>=1
1112
proto-plus>=1
1213
protobuf>=6

packages/google-cloud-firestore/tests/system/test_system.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,10 +1671,13 @@ def test_query_stream_or_get_w_explain_options_analyze_false(
16711671
@pytest.mark.parametrize("method", ["execute", "stream"])
16721672
@pytest.mark.parametrize("database", [FIRESTORE_ENTERPRISE_DB], indirect=True)
16731673
def test_pipeline_explain_options_explain_mode(database, method, query_docs):
1674-
"""Explain currently not supported by backend. Expect error"""
16751674
from google.cloud.firestore_v1.query_profile import (
1675+
ExplainStats,
16761676
PipelineExplainOptions,
16771677
)
1678+
from google.cloud.firestore_v1.types.explain_stats import (
1679+
ExplainStats as ExplainStats_pb,
1680+
)
16781681

16791682
collection, _, _ = query_docs
16801683
client = collection._client
@@ -1685,11 +1688,14 @@ def test_pipeline_explain_options_explain_mode(database, method, query_docs):
16851688
method_under_test = getattr(pipeline, method)
16861689
explain_options = PipelineExplainOptions(mode="explain")
16871690

1688-
# for now, expect error on explain mode
1689-
with pytest.raises(InvalidArgument) as e:
1690-
results = method_under_test(explain_options=explain_options)
1691-
list(results)
1692-
assert "Explain execution mode is not supported" in str(e)
1691+
results = method_under_test(explain_options=explain_options)
1692+
results_list = list(results)
1693+
assert len(results_list) == 0
1694+
1695+
# Verify explain_stats.
1696+
explain_stats = results.explain_stats
1697+
assert isinstance(explain_stats, ExplainStats)
1698+
assert isinstance(explain_stats.get_raw(), ExplainStats_pb)
16931699

16941700

16951701
@pytest.mark.skipif(

packages/google-cloud-firestore/tests/system/test_system_async.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,12 +1593,13 @@ async def test_query_stream_or_get_w_explain_options_analyze_false(
15931593
@pytest.mark.parametrize("method", ["execute", "stream"])
15941594
@pytest.mark.parametrize("database", [FIRESTORE_ENTERPRISE_DB], indirect=True)
15951595
async def test_pipeline_explain_options_explain_mode(database, method, query_docs):
1596-
"""Explain currently not supported by backend. Expect error"""
1597-
from google.api_core.exceptions import InvalidArgument
1598-
15991596
from google.cloud.firestore_v1.query_profile import (
1597+
ExplainStats,
16001598
PipelineExplainOptions,
16011599
)
1600+
from google.cloud.firestore_v1.types.explain_stats import (
1601+
ExplainStats as ExplainStats_pb,
1602+
)
16021603

16031604
collection, _, _ = query_docs
16041605
client = collection._client
@@ -1608,14 +1609,19 @@ async def test_pipeline_explain_options_explain_mode(database, method, query_doc
16081609
method_under_test = getattr(pipeline, method)
16091610
explain_options = PipelineExplainOptions(mode="explain")
16101611

1611-
with pytest.raises(InvalidArgument) as e:
1612-
if method == "stream":
1613-
results = method_under_test(explain_options=explain_options)
1614-
_ = [i async for i in results]
1615-
else:
1616-
await method_under_test(explain_options=explain_options)
1612+
if method == "execute":
1613+
results = await method_under_test(explain_options=explain_options)
1614+
results_list = list(results)
1615+
else:
1616+
results = method_under_test(explain_options=explain_options)
1617+
results_list = [item async for item in results]
1618+
1619+
assert len(results_list) == 0
16171620

1618-
assert "Explain execution mode is not supported" in str(e.value)
1621+
# Verify explain_stats.
1622+
explain_stats = results.explain_stats
1623+
assert isinstance(explain_stats, ExplainStats)
1624+
assert isinstance(explain_stats.get_raw(), ExplainStats_pb)
16191625

16201626

16211627
@pytest.mark.skipif(

0 commit comments

Comments
 (0)