From 6db79941ef6bdb30d53552f27a6e06d4da4d4a31 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Tue, 1 Mar 2022 10:23:54 -0600 Subject: [PATCH 1/5] deps: add "extra" for IPython, exclude bad IPython release --- noxfile.py | 7 +------ setup.py | 1 + testing/constraints-3.6.txt | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/noxfile.py b/noxfile.py index 505911861..6304747d1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -79,8 +79,6 @@ def default(session, install_extras=True): install_target = "." session.install("-e", install_target, "-c", constraints_path) - session.install("ipython", "-c", constraints_path) - # Run py.test against the unit tests. session.run( "py.test", @@ -119,7 +117,6 @@ def unit_noextras(session): def mypy(session): """Run type checks with mypy.""" session.install("-e", ".[all]") - session.install("ipython") session.install(MYPY_VERSION) # Just install the dependencies' type info directly, since "mypy --install-types" @@ -138,7 +135,6 @@ def pytype(session): # https://github.com/googleapis/python-bigquery/issues/655 session.install("attrs==20.3.0") session.install("-e", ".[all]") - session.install("ipython") session.install(PYTYPE_VERSION) session.run("pytype") @@ -180,7 +176,6 @@ def system(session): else: extras = "[all]" session.install("-e", f".{extras}", "-c", constraints_path) - session.install("ipython", "-c", constraints_path) # Run py.test against the system tests. session.run("py.test", "--quiet", os.path.join("tests", "system"), *session.posargs) @@ -355,7 +350,7 @@ def blacken(session): def docs(session): """Build the docs.""" - session.install("ipython", "recommonmark", "sphinx==4.0.1", "sphinx_rtd_theme") + session.install("recommonmark", "sphinx==4.0.1", "sphinx_rtd_theme") session.install("google-cloud-storage") session.install("-e", ".[all]") diff --git a/setup.py b/setup.py index 5c0b80f7c..f6194f50e 100644 --- a/setup.py +++ b/setup.py @@ -61,6 +61,7 @@ "geopandas": ["geopandas>=0.9.0, <1.0dev", "Shapely>=1.6.0, <2.0dev"], "pandas": ["pandas>=0.24.2"] + pyarrow_dep, "bignumeric_type": pyarrow_dep, + "ipython": ["ipython>=7.0.1,!=8.1.0"], "tqdm": ["tqdm >= 4.7.4, <5.0.0dev"], "opentelemetry": [ "opentelemetry-api >= 1.1.0", diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index f967077bc..7f52e441d 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -11,6 +11,7 @@ google-cloud-bigquery-storage==2.0.0 google-cloud-core==1.4.1 google-resumable-media==0.6.0 grpcio==1.38.1 +ipython==7.0.1 opentelemetry-api==1.1.0 opentelemetry-instrumentation==0.20b0 opentelemetry-sdk==1.1.0 From 5488a0408d2be152dcb86cd32a327cadd1f004a7 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Tue, 1 Mar 2022 13:51:32 -0600 Subject: [PATCH 2/5] skip magics tests when IPython not installed --- tests/unit/line_arg_parser/test_lexer.py | 2 ++ tests/unit/line_arg_parser/test_parser.py | 2 ++ tests/unit/line_arg_parser/test_visitors.py | 2 ++ tests/unit/test_magics.py | 25 ++++++++++----------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/tests/unit/line_arg_parser/test_lexer.py b/tests/unit/line_arg_parser/test_lexer.py index 22fa96f22..3624ed0f3 100644 --- a/tests/unit/line_arg_parser/test_lexer.py +++ b/tests/unit/line_arg_parser/test_lexer.py @@ -14,6 +14,8 @@ import pytest +IPython = pytest.importorskip("IPython") + @pytest.fixture(scope="session") def lexer_class(): diff --git a/tests/unit/line_arg_parser/test_parser.py b/tests/unit/line_arg_parser/test_parser.py index 3edff88e9..3f9e9ff41 100644 --- a/tests/unit/line_arg_parser/test_parser.py +++ b/tests/unit/line_arg_parser/test_parser.py @@ -14,6 +14,8 @@ import pytest +IPython = pytest.importorskip("IPython") + @pytest.fixture(scope="session") def parser_class(): diff --git a/tests/unit/line_arg_parser/test_visitors.py b/tests/unit/line_arg_parser/test_visitors.py index 51d4f837a..288ef5f71 100644 --- a/tests/unit/line_arg_parser/test_visitors.py +++ b/tests/unit/line_arg_parser/test_visitors.py @@ -14,6 +14,8 @@ import pytest +IPython = pytest.importorskip("IPython") + @pytest.fixture def base_visitor(): diff --git a/tests/unit/test_magics.py b/tests/unit/test_magics.py index 2801768f8..9815ec547 100644 --- a/tests/unit/test_magics.py +++ b/tests/unit/test_magics.py @@ -17,31 +17,30 @@ from concurrent import futures import warnings -import mock -import pytest - -try: - import pandas -except ImportError: # pragma: NO COVER - pandas = None - from google.api_core import exceptions import google.auth.credentials +import mock +import pytest +from tests.unit.helpers import make_connection +from test_utils.imports import maybe_fail_import from google.cloud import bigquery from google.cloud.bigquery import job from google.cloud.bigquery import table -from google.cloud.bigquery.magics import magics from google.cloud.bigquery.retry import DEFAULT_TIMEOUT -from tests.unit.helpers import make_connection -from test_utils.imports import maybe_fail_import +try: + from google.cloud.bigquery.magics import magics +except ImportError: + magics = None + +bigquery_storage = pytest.importorskip("google.cloud.bigquery_storage") IPython = pytest.importorskip("IPython") +interactiveshell = pytest.importorskip("IPython.terminal.interactiveshell") io = pytest.importorskip("IPython.utils.io") tools = pytest.importorskip("IPython.testing.tools") -interactiveshell = pytest.importorskip("IPython.terminal.interactiveshell") -bigquery_storage = pytest.importorskip("google.cloud.bigquery_storage") +pandas = pytest.importorskip("pandas") @pytest.fixture(scope="session") From c98770cd01b35b2315f98e2123d888f738d3e0fd Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Tue, 1 Mar 2022 13:53:47 -0600 Subject: [PATCH 3/5] sort importorskips --- tests/unit/test_magics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_magics.py b/tests/unit/test_magics.py index 9815ec547..a4214f32f 100644 --- a/tests/unit/test_magics.py +++ b/tests/unit/test_magics.py @@ -38,8 +38,8 @@ bigquery_storage = pytest.importorskip("google.cloud.bigquery_storage") IPython = pytest.importorskip("IPython") interactiveshell = pytest.importorskip("IPython.terminal.interactiveshell") -io = pytest.importorskip("IPython.utils.io") tools = pytest.importorskip("IPython.testing.tools") +io = pytest.importorskip("IPython.utils.io") pandas = pytest.importorskip("pandas") From cf11a82bf5956cb5c123de910fce8d01539766d5 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Tue, 1 Mar 2022 14:00:20 -0600 Subject: [PATCH 4/5] add 3.10 prerelease session --- .kokoro/presubmit/prerelease-deps-3.10.cfg | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .kokoro/presubmit/prerelease-deps-3.10.cfg diff --git a/.kokoro/presubmit/prerelease-deps-3.10.cfg b/.kokoro/presubmit/prerelease-deps-3.10.cfg new file mode 100644 index 000000000..339980bdd --- /dev/null +++ b/.kokoro/presubmit/prerelease-deps-3.10.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Only run this nox session. +env_vars: { + key: "NOX_SESSION" + value: "prerelease_deps-3.10" +} From 81e41261a95b4848fa2c09b175278ace5acfcda7 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Tue, 1 Mar 2022 14:08:28 -0600 Subject: [PATCH 5/5] add continuous session --- .kokoro/continuous/prerelease-deps-3.10.cfg | 7 +++++++ .kokoro/continuous/prerelease-deps-3.8.cfg | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .kokoro/continuous/prerelease-deps-3.10.cfg diff --git a/.kokoro/continuous/prerelease-deps-3.10.cfg b/.kokoro/continuous/prerelease-deps-3.10.cfg new file mode 100644 index 000000000..339980bdd --- /dev/null +++ b/.kokoro/continuous/prerelease-deps-3.10.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Only run this nox session. +env_vars: { + key: "NOX_SESSION" + value: "prerelease_deps-3.10" +} diff --git a/.kokoro/continuous/prerelease-deps-3.8.cfg b/.kokoro/continuous/prerelease-deps-3.8.cfg index 3595fb43f..fabe3e347 100644 --- a/.kokoro/continuous/prerelease-deps-3.8.cfg +++ b/.kokoro/continuous/prerelease-deps-3.8.cfg @@ -3,5 +3,5 @@ # Only run this nox session. env_vars: { key: "NOX_SESSION" - value: "prerelease_deps" + value: "prerelease_deps-3.8" }