Repository: googleapis/python-bigquery

Issue:
Python 3.10 support
Hello!

It would be great to get python 3.10 supported by this excellent package.

Thanks,
Rustam


Discussion:
Thanks for the request! We're working on making sure our test infrastructure and dependencies support Python 3.10 first.
Now that pandas (https://pypi.org/project/pandas/1.3.4/#files) and pyarrow (https://pypi.org/project/pyarrow/6.0.0/#files) have made releases that support Python 3.10, I believe this is unblocked.

Resolving patch:
diff --git a/noxfile.py b/noxfile.py
--- a/noxfile.py
+++ b/noxfile.py
@@ -27,8 +27,8 @@
 BLACK_PATHS = ("docs", "google", "samples", "tests", "noxfile.py", "setup.py")
 
 DEFAULT_PYTHON_VERSION = "3.8"
-SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
-UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
+SYSTEM_TEST_PYTHON_VERSIONS = ["3.8", "3.10"]
+UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
 CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
 
 # 'docfx' is excluded since it only needs to run in 'docs-presubmit'
@@ -69,7 +69,12 @@ def default(session, install_extras=True):
         constraints_path,
     )
 
-    install_target = ".[all]" if install_extras else "."
+    if install_extras and session.python == "3.10":
+        install_target = ".[bqstorage,pandas,tqdm,opentelemetry]"
+    elif install_extras:
+        install_target = ".[all]"
+    else:
+        install_target = "."
     session.install("-e", install_target, "-c", constraints_path)
 
     session.install("ipython", "-c", constraints_path)
@@ -153,7 +158,11 @@ def system(session):
     # Data Catalog needed for the column ACL test with a real Policy Tag.
     session.install("google-cloud-datacatalog", "-c", constraints_path)
 
-    session.install("-e", ".[all]", "-c", constraints_path)
+    if session.python == "3.10":
+        extras = "[bqstorage,pandas,tqdm,opentelemetry]"
+    else:
+        extras = "[all]"
+    session.install("-e", f".{extras}", "-c", constraints_path)
     session.install("ipython", "-c", constraints_path)
 
     # Run py.test against the system tests.
diff --git a/samples/geography/noxfile_config.py b/samples/geography/noxfile_config.py
--- a/samples/geography/noxfile_config.py
+++ b/samples/geography/noxfile_config.py
@@ -22,7 +22,12 @@
 
 TEST_CONFIG_OVERRIDE = {
     # You can opt out from the test for specific Python versions.
-    "ignored_versions": ["2.7"],
+    "ignored_versions": [
+        "2.7",
+        # TODO: Enable 3.10 once there is a geopandas/fiona release.
+        # https://github.com/Toblerity/Fiona/issues/1043
+        "3.10",
+    ],
     # An envvar key for determining the project id to use. Change it
     # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
     # build specific Cloud project. You can also use your own string
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -59,7 +59,7 @@
     ]
     + pyarrow_dep,
     "geopandas": ["geopandas>=0.9.0, <1.0dev", "Shapely>=1.6.0, <2.0dev"],
-    "pandas": ["pandas>=0.23.0"] + pyarrow_dep,
+    "pandas": ["pandas>=0.24.2"] + pyarrow_dep,
     "bignumeric_type": pyarrow_dep,
     "tqdm": ["tqdm >= 4.7.4, <5.0.0dev"],
     "opentelemetry": [
@@ -127,6 +127,7 @@
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
         "Operating System :: OS Independent",
         "Topic :: Internet",
     ],
@@ -135,7 +136,7 @@
     namespace_packages=namespaces,
     install_requires=dependencies,
     extras_require=extras,
-    python_requires=">=3.6, <3.10",
+    python_requires=">=3.6, <3.11",
     include_package_data=True,
     zip_safe=False,
 )


Test patch: