Skip to content

Commit e8772e0

Browse files
authored
Add [all] extras to install all extra dependencies (googleapis#7610)
* Add [all] extras to install all extra dependencies An [all] extra will be useful for convenience to get all the "bonus" features like progress bars, pandas integration, and BigQuery Storage API integration. It also simplifies the noxfile a bit, since the list of extras installed in each session was getting long, especially after using the bqstorage extra instead of in LOCAL_DEPS. * Need fastavro to actually read rows from bqstorage. * Blacken * Use lists for all extras.
1 parent 958935e commit e8772e0

2 files changed

Lines changed: 20 additions & 18 deletions

File tree

bigquery/noxfile.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@
2020
import nox
2121

2222

23-
LOCAL_DEPS = (
24-
os.path.join("..", "api_core[grpc]"),
25-
os.path.join("..", "core"),
26-
# TODO: Move bigquery_storage back to dev_install once dtypes feature is
27-
# released. Issue #7049
28-
os.path.join("..", "bigquery_storage[pandas,fastavro]"),
29-
)
23+
LOCAL_DEPS = (os.path.join("..", "api_core[grpc]"), os.path.join("..", "core"))
3024

3125
BLACK_PATHS = ("docs", "google", "samples", "tests", "noxfile.py", "setup.py")
3226

@@ -45,10 +39,7 @@ def default(session):
4539
session.install("-e", local_dep)
4640

4741
# Pyarrow does not support Python 3.7
48-
if session.python == "3.7":
49-
dev_install = ".[pandas, tqdm]"
50-
else:
51-
dev_install = ".[pandas, pyarrow, tqdm]"
42+
dev_install = ".[all]"
5243
session.install("-e", dev_install)
5344

5445
# IPython does not support Python 2 after version 5.x
@@ -95,7 +86,7 @@ def system(session):
9586
session.install("-e", local_dep)
9687
session.install("-e", os.path.join("..", "storage"))
9788
session.install("-e", os.path.join("..", "test_utils"))
98-
session.install("-e", ".[pandas]")
89+
session.install("-e", ".[all]")
9990

10091
# IPython does not support Python 2 after version 5.x
10192
if session.python == "2.7":
@@ -123,7 +114,7 @@ def snippets(session):
123114
session.install("-e", local_dep)
124115
session.install("-e", os.path.join("..", "storage"))
125116
session.install("-e", os.path.join("..", "test_utils"))
126-
session.install("-e", ".[pandas, pyarrow, fastparquet]")
117+
session.install("-e", ".[all]")
127118

128119
# Run py.test against the snippets tests.
129120
session.run("py.test", os.path.join("docs", "snippets.py"), *session.posargs)
@@ -183,7 +174,7 @@ def docs(session):
183174
for local_dep in LOCAL_DEPS:
184175
session.install("-e", local_dep)
185176
session.install("-e", os.path.join("..", "storage"))
186-
session.install("-e", ".[pandas, pyarrow]")
177+
session.install("-e", ".[all]")
187178

188179
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
189180
session.run(

bigquery/setup.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,25 @@
3636
"protobuf >= 3.6.0",
3737
]
3838
extras = {
39-
"bqstorage": "google-cloud-bigquery-storage >= 0.2.0dev1, <2.0.0dev",
40-
"pandas": "pandas>=0.17.1",
39+
"bqstorage": [
40+
"google-cloud-bigquery-storage >= 0.2.0dev1, <2.0.0dev",
41+
"fastavro>=0.21.2",
42+
],
43+
"pandas": ["pandas>=0.17.1"],
4144
# Exclude PyArrow dependency from Windows Python 2.7.
42-
'pyarrow: platform_system != "Windows" or python_version >= "3.4"': "pyarrow>=0.4.1",
43-
"tqdm": "tqdm >= 4.0.0, <5.0.0dev",
45+
'pyarrow: platform_system != "Windows" or python_version >= "3.4"': [
46+
"pyarrow>=0.4.1"
47+
],
48+
"tqdm": ["tqdm >= 4.0.0, <5.0.0dev"],
4449
"fastparquet": ["fastparquet", "python-snappy"],
4550
}
4651

52+
all_extras = []
53+
54+
for extra in extras:
55+
all_extras.extend(extras[extra])
56+
57+
extras["all"] = all_extras
4758

4859
# Setup boilerplate below this line.
4960

0 commit comments

Comments
 (0)