diff --git a/bigquery_storage/noxfile.py b/bigquery_storage/noxfile.py index bfac9f4c2bce..6707f89b921e 100644 --- a/bigquery_storage/noxfile.py +++ b/bigquery_storage/noxfile.py @@ -68,6 +68,8 @@ def default(session): for local_dep in LOCAL_DEPS: session.install("-e", local_dep) session.install("-e", ".") + session.install("-e", "pandas") + session.install("-e", "fastavro") # Run py.test against the unit tests. session.run( @@ -114,6 +116,8 @@ def system(session): for local_dep in LOCAL_DEPS: session.install("-e", local_dep) session.install("-e", "../test_utils/") + session.install("-e", "pandas") + session.install("-e", "fastavro") session.install("-e", ".") # Run py.test against the system tests. @@ -134,3 +138,22 @@ def cover(session): session.run("coverage", "report", "--show-missing", "--fail-under=100") session.run("coverage", "erase") + + +@nox.session(python='3.6') +def docs(session): + """Build the docs.""" + session.install('sphinx', 'sphinx_rtd_theme') + session.install('-e', '.[pandas,fastavro]') + shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True) + session.run( + 'sphinx-build', + '-W', # warnings as errors + '-T', # show full traceback on exception + '-N', # no colors + '-b', 'html', + '-d', os.path.join('docs', '_build', 'doctrees', ''), + os.path.join('docs', ''), + os.path.join('docs', '_build', 'html', ''), + ) + diff --git a/bigquery_storage/synth.py b/bigquery_storage/synth.py index cdf3c39797dd..7bca8d7df85d 100644 --- a/bigquery_storage/synth.py +++ b/bigquery_storage/synth.py @@ -119,7 +119,34 @@ # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- -templated_files = common.py_library(unit_cov_level=97, cov_level=100) +templated_files = common.py_library( + unit_cov_level=97, cov_level=100, + system_test_dependencies=["pandas", "fastavro"], + unit_test_dependencies=["pandas", "fastavro"], +) s.move(templated_files) +s.replace( + 'noxfile.py', + "session.run\(\"coverage\", \"erase\"\)", + "\g<0>\n\n" + ''' +@nox.session(python='3.6') +def docs(session): + """Build the docs.""" + session.install('sphinx', 'sphinx_rtd_theme') + session.install('-e', '.[pandas,fastavro]') + shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True) + session.run( + 'sphinx-build', + '-W', # warnings as errors + '-T', # show full traceback on exception + '-N', # no colors + '-b', 'html', + '-d', os.path.join('docs', '_build', 'doctrees', ''), + os.path.join('docs', ''), + os.path.join('docs', '_build', 'html', ''), + ) +''') + s.shell.run(["nox", "-s", "blacken"], hide_output=False)