Skip to content

Commit 3d40de0

Browse files
committed
add core_deps_from_source nox session
1 parent 6d1eb61 commit 3d40de0

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

packages/pandas-gbq/noxfile.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,103 @@ def prerelease_deps(session):
410410
)
411411

412412

413+
@nox.session(python=DEFAULT_PYTHON_VERSION)
414+
@_calculate_duration
415+
def core_deps_from_source(session):
416+
session.install(
417+
# https://arrow.apache.org/docs/developers/python.html#installing-nightly-packages
418+
"--extra-index-url",
419+
"https://pypi.fury.io/arrow-nightlies/",
420+
"--prefer-binary",
421+
"--pre",
422+
"--upgrade",
423+
"pyarrow",
424+
)
425+
session.install(
426+
"--prefer-binary",
427+
"--pre",
428+
"--upgrade",
429+
"google-cloud-core",
430+
"google-resumable-media",
431+
# Exclude version 1.49.0rc1 which has a known issue. See https://github.com/grpc/grpc/pull/30642
432+
"grpcio!=1.49.0rc1",
433+
"pandas",
434+
)
435+
session.install(
436+
"freezegun",
437+
"google-cloud-datacatalog",
438+
"google-cloud-storage",
439+
"google-cloud-testutils",
440+
"IPython",
441+
"mock",
442+
"psutil",
443+
"pytest",
444+
"pytest-cov",
445+
)
446+
447+
# Install python-bigquery from main to detect
448+
# any potential breaking changes. For context, see:
449+
# https://github.com/googleapis/python-bigquery-pandas/issues/854
450+
session.install("https://github.com/googleapis/python-bigquery/archive/main.zip")
451+
452+
# Because we test minimum dependency versions on the minimum Python
453+
# version, the first version we test with in the unit tests sessions has a
454+
# constraints file containing all dependencies and extras.
455+
with open(
456+
CURRENT_DIRECTORY
457+
/ "testing"
458+
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
459+
encoding="utf-8",
460+
) as constraints_file:
461+
constraints_text = constraints_file.read()
462+
463+
# Ignore leading whitespace and comment lines.
464+
constraints_deps = [
465+
match.group(1)
466+
for match in re.finditer(
467+
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
468+
)
469+
]
470+
471+
# We use --no-deps to ensure that pre-release versions aren't overwritten
472+
# by the version ranges in setup.py.
473+
session.install(*constraints_deps)
474+
session.install("--no-deps", "-e", ".[all]")
475+
476+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2358): `grpcio` and
477+
# `grpcio-status` should be added to the list below so that they are installed from source,
478+
# rather than PyPI.
479+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2357): `protobuf` should be
480+
# added to the list below so that it is installed from source, rather than PyPI
481+
# Note: If a dependency is added to the `core_dependencies_from_source` list,
482+
# the `prerel_deps` list in the `prerelease_deps` nox session should also be updated.
483+
core_dependencies_from_source = [
484+
"googleapis-common-protos @ git+https://github.com/googleapis/google-cloud-python#egg=googleapis-common-protos&subdirectory=packages/googleapis-common-protos",
485+
"google-api-core @ git+https://github.com/googleapis/python-api-core.git",
486+
"google-auth @ git+https://github.com/googleapis/google-auth-library-python.git",
487+
"google-cloud-bigquery-storage @ git+https://github.com/googleapis/google-cloud-python.git@main#subdirectory=packages/google-cloud-bigquery-storage",
488+
"grpc-google-iam-v1 @ git+https://github.com/googleapis/google-cloud-python#egg=grpc-google-iam-v1&subdirectory=packages/grpc-google-iam-v1",
489+
"proto-plus @ git+https://github.com/googleapis/proto-plus-python.git",
490+
]
491+
492+
for dep in core_dependencies_from_source:
493+
session.install(dep, "--no-deps", "--ignore-installed")
494+
print(f"Installed {dep}")
495+
496+
# Print out prerelease package versions.
497+
session.run("python", "-m", "pip", "freeze")
498+
499+
# Run all tests, except a few samples tests which require extra dependencies.
500+
session.run(
501+
"py.test",
502+
"--quiet",
503+
"-W default::PendingDeprecationWarning",
504+
f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml",
505+
os.path.join("tests", "unit"),
506+
*session.posargs,
507+
)
508+
509+
413510
@nox.session(python=DEFAULT_PYTHON_VERSION)
414511
@_calculate_duration
415512
def cover(session):

0 commit comments

Comments
 (0)