diff --git a/.kokoro/continuous/prerelease.cfg b/.kokoro/continuous/prerelease.cfg deleted file mode 100644 index 00bc8678..00000000 --- a/.kokoro/continuous/prerelease.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Only run this nox session. -env_vars: { - key: "NOX_SESSION" - value: "prerelease" -} diff --git a/.kokoro/presubmit/prerelease.cfg b/.kokoro/presubmit/prerelease.cfg deleted file mode 100644 index 00bc8678..00000000 --- a/.kokoro/presubmit/prerelease.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Only run this nox session. -env_vars: { - key: "NOX_SESSION" - value: "prerelease" -} diff --git a/README.rst b/README.rst index ca98bba0..d4b4ea68 100644 --- a/README.rst +++ b/README.rst @@ -34,6 +34,9 @@ In order to use this library, you first need to go through the following steps: .. _Enable the BigQuery Storage API.: https://console.cloud.google.com/apis/library/bigquery.googleapis.com .. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html +.. note:: + This library is only compatible with SQLAlchemy versions < 2.0.0 + Installation ------------ diff --git a/dev_requirements.txt b/dev_requirements.txt index e7289070..17e4e6d0 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,4 +1,4 @@ -sqlalchemy>=1.1.9 +sqlalchemy>=1.1.9,<2.0.0 google-cloud-bigquery>=1.6.0 future==0.18.2 pytest===6.2.5 diff --git a/noxfile.py b/noxfile.py index 0cb4e3f5..8a258f42 100644 --- a/noxfile.py +++ b/noxfile.py @@ -283,76 +283,6 @@ def system(session): ) -@nox.session(python=DEFAULT_PYTHON_VERSION) -def prerelease(session): - session.install( - "--prefer-binary", - "--pre", - "--upgrade", - "alembic", - "geoalchemy2", - "google-api-core", - "google-cloud-bigquery", - "google-cloud-bigquery-storage", - "sqlalchemy", - "shapely", - # These are transitive dependencies, but we'd still like to know if a - # change in a prerelease there breaks this connector. - "google-cloud-core", - "grpcio", - ) - session.install( - "freezegun", - "google-cloud-testutils", - "mock", - "psutil", - "pytest", - "pytest-cov", - "pytz", - ) - - # Because we test minimum dependency versions on the minimum Python - # version, the first version we test with in the unit tests sessions has a - # constraints file containing all dependencies and extras. - with open( - CURRENT_DIRECTORY - / "testing" - / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", - encoding="utf-8", - ) as constraints_file: - constraints_text = constraints_file.read() - - # Ignore leading whitespace and comment lines. - deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] - - # We use --no-deps to ensure that pre-release versions aren't overwritten - # by the version ranges in setup.py. - session.install(*deps) - session.install("--no-deps", "-e", ".") - - # Print out prerelease package versions. - session.run("python", "-m", "pip", "freeze") - - # Run all tests, except a few samples tests which require extra dependencies. - session.run( - "py.test", - "--quiet", - f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml", - os.path.join("tests", "unit"), - ) - session.run( - "py.test", - "--quiet", - f"--junitxml=prerelease_system_{session.python}_sponge_log.xml", - os.path.join("tests", "system"), - ) - - @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS[-1]) def compliance(session): """Run the SQLAlchemy dialect-compliance system tests""" @@ -369,7 +299,7 @@ def compliance(session): session.skip("Compliance tests were not found") session.install("--pre", "grpcio") - + session.install("--pre", "--no-deps", "--upgrade", "sqlalchemy<2.0.0") session.install( "mock", # TODO: Allow latest version of pytest once SQLAlchemy 1.4.28+ is supported. @@ -400,6 +330,11 @@ def compliance(session): "--only-rerun=400 Cannot execute DML over a non-existent table", system_test_folder_path, *session.posargs, + # To suppress the "Deprecated API features detected!" warning when + # features not compatible with 2.0 are detected, use a value of "1" + env={ + "SQLALCHEMY_SILENCE_UBER_WARNING": "1", + }, ) @@ -493,9 +428,7 @@ def prerelease_deps(session): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS + SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES ) session.install(*system_deps_all) @@ -522,6 +455,7 @@ def prerelease_deps(session): prerel_deps = [ "protobuf", + "sqlalchemy<2.0.0", # dependency of grpc "six", "googleapis-common-protos", diff --git a/owlbot.py b/owlbot.py index 0b9a84fa..aac3da31 100644 --- a/owlbot.py +++ b/owlbot.py @@ -72,10 +72,28 @@ "import re\nimport shutil", ) + s.replace( ["noxfile.py"], "--cov=google", "--cov=sqlalchemy_bigquery", ) + +s.replace( + ["noxfile.py"], + "\+ SYSTEM_TEST_EXTRAS", + "", +) + + +s.replace( + ["noxfile.py"], + '''"protobuf", + # dependency of grpc''', + '''"protobuf", + "sqlalchemy<2.0.0", + # dependency of grpc''', +) + def place_before(path, text, *before_text, escape=None): replacement = "\n".join(before_text) + "\n" + text if escape: @@ -96,78 +114,6 @@ def place_before(path, text, *before_text, escape=None): "nox.options.stop_on_first_error = True", ) -prerelease = r''' -@nox.session(python=DEFAULT_PYTHON_VERSION) -def prerelease(session): - session.install( - "--prefer-binary", - "--pre", - "--upgrade", - "alembic", - "geoalchemy2", - "google-api-core", - "google-cloud-bigquery", - "google-cloud-bigquery-storage", - "sqlalchemy", - "shapely", - # These are transitive dependencies, but we'd still like to know if a - # change in a prerelease there breaks this connector. - "google-cloud-core", - "grpcio", - ) - session.install( - "freezegun", - "google-cloud-testutils", - "mock", - "psutil", - "pytest", - "pytest-cov", - "pytz", - ) - - # Because we test minimum dependency versions on the minimum Python - # version, the first version we test with in the unit tests sessions has a - # constraints file containing all dependencies and extras. - with open( - CURRENT_DIRECTORY - / "testing" - / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", - encoding="utf-8", - ) as constraints_file: - constraints_text = constraints_file.read() - - # Ignore leading whitespace and comment lines. - deps = [ - match.group(1) - for match in re.finditer( - r"^\\s*(\\S+)(?===\\S+)", constraints_text, flags=re.MULTILINE - ) - ] - - # We use --no-deps to ensure that pre-release versions aren't overwritten - # by the version ranges in setup.py. - session.install(*deps) - session.install("--no-deps", "-e", ".") - - # Print out prerelease package versions. - session.run("python", "-m", "pip", "freeze") - - # Run all tests, except a few samples tests which require extra dependencies. - session.run( - "py.test", - "--quiet", - f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml", - os.path.join("tests", "unit"), - ) - session.run( - "py.test", - "--quiet", - f"--junitxml=prerelease_system_{session.python}_sponge_log.xml", - os.path.join("tests", "system"), - ) - - -''' # Maybe we can get rid of this when we don't need pytest-rerunfailures, # which we won't need when BQ retries itself: @@ -189,7 +135,7 @@ def compliance(session): session.skip("Compliance tests were not found") session.install("--pre", "grpcio") - + session.install("--pre", "--no-deps", "--upgrade", "sqlalchemy<2.0.0") session.install( "mock", # TODO: Allow latest version of pytest once SQLAlchemy 1.4.28+ is supported. @@ -220,6 +166,11 @@ def compliance(session): "--only-rerun=400 Cannot execute DML over a non-existent table", system_test_folder_path, *session.posargs, + # To suppress the "Deprecated API features detected!" warning when + # features not compatible with 2.0 are detected, use a value of "1" + env={ + "SQLALCHEMY_SILENCE_UBER_WARNING": "1", + }, ) @@ -229,7 +180,7 @@ def compliance(session): "noxfile.py", "@nox.session(python=DEFAULT_PYTHON_VERSION)\n" "def cover(session):", - prerelease + compliance, + compliance, escape="()", ) diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt index eebb9da6..77dc823a 100644 --- a/testing/constraints-3.9.txt +++ b/testing/constraints-3.9.txt @@ -1 +1 @@ -sqlalchemy>=1.4.13 +sqlalchemy>=1.4.13,<2.0.0