From 1fcec7540b4bbc878b7ea13b488c7da778e5cbaf Mon Sep 17 00:00:00 2001 From: Chelsea Lin Date: Mon, 29 Apr 2024 22:51:09 +0000 Subject: [PATCH 1/5] test: add mypy type checking --- bigquery_magics/bigquery.py | 2 +- noxfile.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/bigquery_magics/bigquery.py b/bigquery_magics/bigquery.py index e09f7ef..bab533b 100644 --- a/bigquery_magics/bigquery.py +++ b/bigquery_magics/bigquery.py @@ -108,7 +108,7 @@ try: from google.cloud import bigquery_storage # type: ignore except ImportError: - bigquery_storage = None + bigquery_storage = None # type: ignore IPYTHON_USER_AGENT = "ipython-{}".format(IPython.__version__) context = bigquery_magics.config.context diff --git a/noxfile.py b/noxfile.py index f5dd689..46fdbbd 100644 --- a/noxfile.py +++ b/noxfile.py @@ -167,6 +167,25 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +@nox.session(python=DEFAULT_PYTHON_VERSION) +def mypy(session): + """Run type checks with mypy.""" + session.install(".") + session.install("mypy") + + # Just install the dependencies' type info directly, since "mypy --install-types" + # might require an additional pass. + session.install( + "types-protobuf", + "types-python-dateutil", + "types-requests", + "types-setuptools", + ) + + shutil.rmtree(".mypy_cache", ignore_errors=True) + session.run("mypy", "-p", "bigquery_magics", "--show-traceback") + + def install_unittest_dependencies(session, *constraints): standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES session.install(*standard_deps, *constraints) From 93bde0ae1f2cd67a14ecf68e71c25f8e22a104c7 Mon Sep 17 00:00:00 2001 From: Chelsea Lin Date: Mon, 29 Apr 2024 22:57:40 +0000 Subject: [PATCH 2/5] test: add mypy type checking --- noxfile.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/noxfile.py b/noxfile.py index 46fdbbd..88eff3f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -173,15 +173,6 @@ def mypy(session): session.install(".") session.install("mypy") - # Just install the dependencies' type info directly, since "mypy --install-types" - # might require an additional pass. - session.install( - "types-protobuf", - "types-python-dateutil", - "types-requests", - "types-setuptools", - ) - shutil.rmtree(".mypy_cache", ignore_errors=True) session.run("mypy", "-p", "bigquery_magics", "--show-traceback") From ba6daff15b80e8bf9ff804595bb028d67dce9472 Mon Sep 17 00:00:00 2001 From: Chelsea Lin Date: Mon, 29 Apr 2024 23:07:19 +0000 Subject: [PATCH 3/5] add mypy --- noxfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/noxfile.py b/noxfile.py index 88eff3f..8f230e0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -108,6 +108,7 @@ "blacken", "docs", "format", + "mypy", ] # Error if a python version is missing From 615a3c65a63e6db6ad650b995723bfb4c2b9a359 Mon Sep 17 00:00:00 2001 From: Chelsea Lin Date: Mon, 29 Apr 2024 23:09:38 +0000 Subject: [PATCH 4/5] order sessions name --- noxfile.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/noxfile.py b/noxfile.py index 8f230e0..e2a4374 100644 --- a/noxfile.py +++ b/noxfile.py @@ -100,15 +100,15 @@ # 'docfx' is excluded since it only needs to run in 'docs-presubmit' nox.options.sessions = [ - "unit", - "system", - "cover", - "lint", - "lint_setup_py", "blacken", + "cover", "docs", "format", + "lint", + "lint_setup_py", "mypy", + "system", + "unit", ] # Error if a python version is missing From c9b104b7759fe1f4141f42fb5dd2b794a751626e Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 30 Apr 2024 18:55:29 +0000 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- noxfile.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/noxfile.py b/noxfile.py index e2a4374..f5dd689 100644 --- a/noxfile.py +++ b/noxfile.py @@ -100,15 +100,14 @@ # 'docfx' is excluded since it only needs to run in 'docs-presubmit' nox.options.sessions = [ - "blacken", + "unit", + "system", "cover", - "docs", - "format", "lint", "lint_setup_py", - "mypy", - "system", - "unit", + "blacken", + "docs", + "format", ] # Error if a python version is missing @@ -168,16 +167,6 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") -@nox.session(python=DEFAULT_PYTHON_VERSION) -def mypy(session): - """Run type checks with mypy.""" - session.install(".") - session.install("mypy") - - shutil.rmtree(".mypy_cache", ignore_errors=True) - session.run("mypy", "-p", "bigquery_magics", "--show-traceback") - - def install_unittest_dependencies(session, *constraints): standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES session.install(*standard_deps, *constraints)