Repository: googleapis/python-bigquery

Issue:
fix: issue a warning if buggy pyarrow is detected
Fixes #781.

Some `pyarrow` versions can cause issue when loading data from dataframe. This commit detects if such pyarrow version is installed and warns the user.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-bigquery/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)



Discussion:

Resolving patch:
diff --git a/samples/geography/noxfile.py b/samples/geography/noxfile.py
--- a/samples/geography/noxfile.py
+++ b/samples/geography/noxfile.py
@@ -17,6 +17,7 @@
 import os
 from pathlib import Path
 import sys
+from typing import Callable, Dict, List, Optional
 
 import nox
 
@@ -65,7 +66,7 @@
 TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)
 
 
-def get_pytest_env_vars():
+def get_pytest_env_vars() -> Dict[str, str]:
     """Returns a dict for pytest invocation."""
     ret = {}
 
@@ -94,7 +95,7 @@ def get_pytest_env_vars():
 #
 
 
-def _determine_local_import_names(start_dir):
+def _determine_local_import_names(start_dir: str) -> List[str]:
     """Determines all import names that should be considered "local".
 
     This is used when running the linter to insure that import order is
@@ -132,7 +133,7 @@ def _determine_local_import_names(start_dir):
 
 
 @nox.session
-def lint(session):
+def lint(session: nox.sessions.Session) -> None:
     if not TEST_CONFIG["enforce_type_hints"]:
         session.install("flake8", "flake8-import-order")
     else:
@@ -153,7 +154,7 @@ def lint(session):
 
 
 @nox.session
-def blacken(session):
+def blacken(session: nox.sessions.Session) -> None:
     session.install("black")
     python_files = [path for path in os.listdir(".") if path.endswith(".py")]
 
@@ -168,7 +169,9 @@ def blacken(session):
 PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
 
 
-def _session_tests(session, post_install=None):
+def _session_tests(
+    session: nox.sessions.Session, post_install: Callable = None
+) -> None:
     """Runs py.test for a particular project."""
     if os.path.exists("requirements.txt"):
         session.install("-r", "requirements.txt")
@@ -194,7 +197,7 @@ def _session_tests(session, post_install=None):
 
 
 @nox.session(python=ALL_VERSIONS)
-def py(session):
+def py(session: nox.sessions.Session) -> None:
     """Runs py.test for a sample using the specified version of Python."""
     if session.python in TESTED_VERSIONS:
         _session_tests(session)
@@ -209,7 +212,7 @@ def py(session):
 #
 
 
-def _get_repo_root():
+def _get_repo_root() -> Optional[str]:
     """ Returns the root folder of the project. """
     # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
     p = Path(os.getcwd())
@@ -232,7 +235,7 @@ def _get_repo_root():
 
 @nox.session
 @nox.parametrize("path", GENERATED_READMES)
-def readmegen(session, path):
+def readmegen(session: nox.sessions.Session, path: str) -> None:
     """(Re-)generates the readme for a sample."""
     session.install("jinja2", "pyyaml")
     dir_ = os.path.dirname(path)
diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py
--- a/samples/snippets/noxfile.py
+++ b/samples/snippets/noxfile.py
@@ -17,6 +17,7 @@
 import os
 from pathlib import Path
 import sys
+from typing import Callable, Dict, List, Optional
 
 import nox
 
@@ -65,7 +66,7 @@
 TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)
 
 
-def get_pytest_env_vars():
+def get_pytest_env_vars() -> Dict[str, str]:
     """Returns a dict for pytest invocation."""
     ret = {}
 
@@ -94,7 +95,7 @@ def get_pytest_env_vars():
 #
 
 
-def _determine_local_import_names(start_dir):
+def _determine_local_import_names(start_dir: str) -> List[str]:
     """Determines all import names that should be considered "local".
 
     This is used when running the linter to insure that import order is
@@ -132,7 +133,7 @@ def _determine_local_import_names(start_dir):
 
 
 @nox.session
-def lint(session):
+def lint(session: nox.sessions.Session) -> None:
     if not TEST_CONFIG["enforce_type_hints"]:
         session.install("flake8", "flake8-import-order")
     else:
@@ -153,7 +154,7 @@ def lint(session):
 
 
 @nox.session
-def blacken(session):
+def blacken(session: nox.sessions.Session) -> None:
     session.install("black")
     python_files = [path for path in os.listdir(".") if path.endswith(".py")]
 
@@ -168,7 +169,9 @@ def blacken(session):
 PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
 
 
-def _session_tests(session, post_install=None):
+def _session_tests(
+    session: nox.sessions.Session, post_install: Callable = None
+) -> None:
     """Runs py.test for a particular project."""
     if os.path.exists("requirements.txt"):
         session.install("-r", "requirements.txt")
@@ -194,7 +197,7 @@ def _session_tests(session, post_install=None):
 
 
 @nox.session(python=ALL_VERSIONS)
-def py(session):
+def py(session: nox.sessions.Session) -> None:
     """Runs py.test for a sample using the specified version of Python."""
     if session.python in TESTED_VERSIONS:
         _session_tests(session)
@@ -209,7 +212,7 @@ def py(session):
 #
 
 
-def _get_repo_root():
+def _get_repo_root() -> Optional[str]:
     """ Returns the root folder of the project. """
     # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
     p = Path(os.getcwd())
@@ -232,7 +235,7 @@ def _get_repo_root():
 
 @nox.session
 @nox.parametrize("path", GENERATED_READMES)
-def readmegen(session, path):
+def readmegen(session: nox.sessions.Session, path: str) -> None:
     """(Re-)generates the readme for a sample."""
     session.install("jinja2", "pyyaml")
     dir_ = os.path.dirname(path)


Test patch: