Content-Length: 1095936 | pFad | http://github.com/googleapis/google-cloud-python/commit/d92572ec73ec3deebcd5e3de68221e68555c2953

A9 Add [all] extras to install all extra dependencies · googleapis/google-cloud-python@d92572e · GitHub
Skip to content

Commit d92572e

Browse files
committed
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. I also blacken the setup.py file and simplify the noxfile by using this new [all] extra.
1 parent 5756bf3 commit d92572e

File tree

2 files changed

+115
-127
lines changed

2 files changed

+115
-127
lines changed

bigquery/noxfile.py

Lines changed: 72 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,9 @@
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"))
24+
25+
DEFAULT_PYTHON = "3.6"
3026

3127

3228
def default(session):
@@ -38,169 +34,154 @@ def default(session):
3834
run the tests.
3935
"""
4036
# Install all test dependencies, then install local packages in-place.
41-
session.install('mock', 'pytest', 'pytest-cov')
37+
session.install("mock", "pytest", "pytest-cov")
4238
for local_dep in LOCAL_DEPS:
43-
session.install('-e', local_dep)
39+
session.install("-e", local_dep)
4440

45-
# Pyarrow does not support Python 3.7
46-
if session.python == '3.7':
47-
dev_install = '.[pandas]'
48-
else:
49-
dev_install = '.[pandas, pyarrow]'
50-
session.install('-e', dev_install)
41+
session.install("-e", ".[all]")
5142

5243
# IPython does not support Python 2 after version 5.x
53-
if session.python == '2.7':
54-
session.install('ipython==5.5')
44+
if session.python == "2.7":
45+
session.install("ipython==5.5")
5546
else:
56-
session.install('ipython')
47+
session.install("ipython")
5748

5849
# Run py.test against the unit tests.
5950
session.run(
60-
'py.test',
61-
'--quiet',
62-
'--cov=google.cloud.bigquery',
63-
'--cov=tests.unit',
64-
'--cov-append',
65-
'--cov-config=.coveragerc',
66-
'--cov-report=',
67-
'--cov-fail-under=97',
68-
os.path.join('tests', 'unit'),
51+
"py.test",
52+
"--quiet",
53+
"--cov=google.cloud.bigquery",
54+
"--cov=tests.unit",
55+
"--cov-append",
56+
"--cov-config=.coveragerc",
57+
"--cov-report=",
58+
"--cov-fail-under=97",
59+
os.path.join("tests", "unit"),
6960
*session.posargs
7061
)
7162

7263

73-
@nox.session(python=['2.7', '3.5', '3.6', '3.7'])
64+
@nox.session(python=["2.7", "3.5", "3.6", "3.7"])
7465
def unit(session):
7566
"""Run the unit test suite."""
7667
default(session)
7768

7869

79-
@nox.session(python=['2.7', '3.6'])
70+
@nox.session(python=["2.7", DEFAULT_PYTHON])
8071
def system(session):
8172
"""Run the system test suite."""
8273

8374
# Sanity check: Only run system tests if the environment variable is set.
84-
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
85-
session.skip('Credentials must be set via environment variable.')
75+
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
76+
session.skip("Credentials must be set via environment variable.")
8677

8778
# Use pre-release gRPC for system tests.
88-
session.install('--pre', 'grpcio')
79+
session.install("--pre", "grpcio")
8980

9081
# Install all test dependencies, then install local packages in place.
91-
session.install('mock', 'pytest')
82+
session.install("mock", "pytest")
9283
for local_dep in LOCAL_DEPS:
93-
session.install('-e', local_dep)
94-
session.install('-e', os.path.join('..', 'storage'))
95-
session.install('-e', os.path.join('..', 'test_utils'))
96-
session.install('-e', '.[pandas]')
84+
session.install("-e", local_dep)
85+
session.install("-e", os.path.join("..", "storage"))
86+
session.install("-e", os.path.join("..", "test_utils"))
87+
session.install("-e", ".[all]")
9788

9889
# IPython does not support Python 2 after version 5.x
99-
if session.python == '2.7':
100-
session.install('ipython==5.5')
90+
if session.python == "2.7":
91+
session.install("ipython==5.5")
10192
else:
102-
session.install('ipython')
93+
session.install("ipython")
10394

10495
# Run py.test against the system tests.
10596
session.run(
106-
'py.test',
107-
'--quiet',
108-
os.path.join('tests', 'system.py'),
109-
*session.posargs
97+
"py.test", "--quiet", os.path.join("tests", "system.py"), *session.posargs
11098
)
11199

112100

113-
@nox.session(python=['2.7', '3.6'])
101+
@nox.session(python=["2.7", DEFAULT_PYTHON])
114102
def snippets(session):
115103
"""Run the snippets test suite."""
116104

117105
# Sanity check: Only run snippets tests if the environment variable is set.
118-
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
119-
session.skip('Credentials must be set via environment variable.')
106+
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
107+
session.skip("Credentials must be set via environment variable.")
120108

121109
# Install all test dependencies, then install local packages in place.
122-
session.install('mock', 'pytest')
110+
session.install("mock", "pytest")
123111
for local_dep in LOCAL_DEPS:
124-
session.install('-e', local_dep)
125-
session.install('-e', os.path.join('..', 'storage'))
126-
session.install('-e', os.path.join('..', 'test_utils'))
127-
session.install('-e', '.[pandas, pyarrow, fastparquet]')
112+
session.install("-e", local_dep)
113+
session.install("-e", os.path.join("..", "storage"))
114+
session.install("-e", os.path.join("..", "test_utils"))
115+
session.install("-e", ".[all]")
128116

129117
# Run py.test against the snippets tests.
130-
session.run(
131-
'py.test', os.path.join('docs', 'snippets.py'), *session.posargs)
118+
session.run("py.test", os.path.join("docs", "snippets.py"), *session.posargs)
132119

133120

134-
@nox.session(python='3.6')
121+
@nox.session(python=DEFAULT_PYTHON)
135122
def cover(session):
136123
"""Run the final coverage report.
137124
138125
This outputs the coverage report aggregating coverage from the unit
139126
test runs (not system test runs), and then erases coverage data.
140127
"""
141-
session.install('coverage', 'pytest-cov')
142-
session.run('coverage', 'report', '--show-missing', '--fail-under=100')
143-
session.run('coverage', 'erase')
128+
session.install("coverage", "pytest-cov")
129+
session.run("coverage", "report", "--show-missing", "--fail-under=100")
130+
session.run("coverage", "erase")
144131

145132

146-
@nox.session(python='3.6')
133+
@nox.session(python=DEFAULT_PYTHON)
147134
def lint(session):
148135
"""Run linters.
149136
150137
Returns a failure if the linters find linting errors or sufficiently
151138
serious code quality issues.
152139
"""
153140

154-
session.install('flake8', *LOCAL_DEPS)
155-
session.install('.')
156-
session.run('flake8', os.path.join('google', 'cloud', 'bigquery'))
157-
session.run('flake8', 'tests')
158-
session.run(
159-
'flake8', os.path.join('docs', 'snippets.py'))
141+
session.install("flake8", *LOCAL_DEPS)
142+
session.install(".")
143+
session.run("flake8", os.path.join("google", "cloud", "bigquery"))
144+
session.run("flake8", "tests")
145+
session.run("flake8", os.path.join("docs", "snippets.py"))
160146

161147

162-
@nox.session(python='3.6')
148+
@nox.session(python=DEFAULT_PYTHON)
163149
def lint_setup_py(session):
164150
"""Verify that setup.py is valid (including RST check)."""
165151

166-
session.install('docutils', 'Pygments')
167-
session.run(
168-
'python', 'setup.py', 'check', '--restructuredtext', '--strict')
169-
152+
session.install("docutils", "Pygments")
153+
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
170154

171155

172-
@nox.session(python="3.6")
156+
@nox.session(python=DEFAULT_PYTHON)
173157
def blacken(session):
174158
"""Run black.
175159
Format code to uniform standard.
176160
"""
177161
session.install("black")
178-
session.run(
179-
"black",
180-
"google",
181-
"tests",
182-
"docs",
183-
)
162+
session.run("black", "google", "tests", "docs")
184163

185164

186-
@nox.session(python='3.6')
165+
@nox.session(python=DEFAULT_PYTHON)
187166
def docs(session):
188167
"""Build the docs."""
189168

190-
session.install('ipython', 'recommonmark', 'sphinx', 'sphinx_rtd_theme')
169+
session.install("ipython", "recommonmark", "sphinx", "sphinx_rtd_theme")
191170
for local_dep in LOCAL_DEPS:
192-
session.install('-e', local_dep)
193-
session.install('-e', os.path.join('..', 'storage'))
194-
session.install('-e', '.[pandas, pyarrow]')
171+
session.install("-e", local_dep)
172+
session.install("-e", os.path.join("..", "storage"))
173+
session.install("-e", ".[all]")
195174

196-
shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True)
175+
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
197176
session.run(
198-
'sphinx-build',
199-
'-W', # warnings as errors
200-
'-T', # show full traceback on exception
201-
'-N', # no colors
202-
'-b', 'html',
203-
'-d', os.path.join('docs', '_build', 'doctrees', ''),
204-
os.path.join('docs', ''),
205-
os.path.join('docs', '_build', 'html', ''),
177+
"sphinx-build",
178+
"-W", # warnings as errors
179+
"-T", # show full traceback on exception
180+
"-N", # no colors
181+
"-b",
182+
"html",
183+
"-d",
184+
os.path.join("docs", "_build", "doctrees", ""),
185+
os.path.join("docs", ""),
186+
os.path.join("docs", "_build", "html", ""),
206187
)

bigquery/setup.py

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,78 +20,85 @@
2020

2121
# Package metadata.
2222

23-
name = 'google-cloud-bigquery'
24-
description = 'Google BigQuery API client library'
25-
version = '1.10.0'
23+
name = "google-cloud-bigquery"
24+
description = "Google BigQuery API client library"
25+
version = "1.10.0"
2626
# Should be one of:
2727
# 'Development Status :: 3 - Alpha'
2828
# 'Development Status :: 4 - Beta'
2929
# 'Development Status :: 5 - Production/Stable'
30-
release_status = 'Development Status :: 5 - Production/Stable'
30+
release_status = "Development Status :: 5 - Production/Stable"
3131
dependencies = [
32-
'google-api-core >= 1.6.0, < 2.0.0dev',
33-
'google-cloud-core >= 0.29.0, < 0.30dev',
34-
'google-resumable-media >= 0.3.1',
32+
"google-api-core >= 1.6.0, < 2.0.0dev",
33+
"google-cloud-core >= 0.29.0, < 0.30dev",
34+
"google-resumable-media >= 0.3.1",
3535
]
3636
extras = {
37-
'bqstorage': 'google-cloud-bigquery-storage >= 0.2.0dev1, <2.0.0dev',
38-
'pandas': 'pandas>=0.17.1',
37+
"bqstorage": "google-cloud-bigquery-storage[fastavro] >= 0.2.0dev1, <2.0.0dev",
38+
"pandas": "pandas>=0.17.1",
3939
# Exclude PyArrow dependency from Windows Python 2.7.
40-
'pyarrow: platform_system != "Windows" or python_version >= "3.4"':
41-
'pyarrow>=0.4.1',
42-
'fastparquet': ['fastparquet', 'python-snappy'],
40+
'pyarrow: platform_system != "Windows" or python_version >= "3.4"': "pyarrow>=0.4.1",
41+
"fastparquet": ["fastparquet", "python-snappy"],
4342
}
4443

44+
all_extras = []
45+
for extra in extras:
46+
if isinstance(extras[extra], str):
47+
all_extras.append(extras[extra])
48+
else:
49+
all_extras.extend(extras[extra])
50+
51+
extras["all"] = all_extras
4552

4653
# Setup boilerplate below this line.
4754

4855
package_root = os.path.abspath(os.path.dirname(__file__))
4956

50-
readme_filename = os.path.join(package_root, 'README.rst')
51-
with io.open(readme_filename, encoding='utf-8') as readme_file:
57+
readme_filename = os.path.join(package_root, "README.rst")
58+
with io.open(readme_filename, encoding="utf-8") as readme_file:
5259
readme = readme_file.read()
5360

5461
# Only include packages under the 'google' namespace. Do not include tests,
5562
# benchmarks, etc.
5663
packages = [
57-
package for package in setuptools.find_packages()
58-
if package.startswith('google')]
64+
package for package in setuptools.find_packages() if package.startswith("google")
65+
]
5966

6067
# Determine which namespaces are needed.
61-
namespaces = ['google']
62-
if 'google.cloud' in packages:
63-
namespaces.append('google.cloud')
68+
namespaces = ["google"]
69+
if "google.cloud" in packages:
70+
namespaces.append("google.cloud")
6471

6572

6673
setuptools.setup(
6774
name=name,
6875
version=version,
6976
description=description,
7077
long_description=readme,
71-
author='Google LLC',
72-
author_email='googleapis-packages@google.com',
73-
license='Apache 2.0',
74-
url='https://github.com/GoogleCloudPlatform/google-cloud-python',
78+
author="Google LLC",
79+
author_email="googleapis-packages@google.com",
80+
license="Apache 2.0",
81+
url="https://github.com/GoogleCloudPlatform/google-cloud-python",
7582
classifiers=[
7683
release_status,
77-
'Intended Audience :: Developers',
78-
'License :: OSI Approved :: Apache Software License',
79-
'Programming Language :: Python',
80-
'Programming Language :: Python :: 2',
81-
'Programming Language :: Python :: 2.7',
82-
'Programming Language :: Python :: 3',
83-
'Programming Language :: Python :: 3.5',
84-
'Programming Language :: Python :: 3.6',
85-
'Programming Language :: Python :: 3.7',
86-
'Operating System :: OS Independent',
87-
'Topic :: Internet',
84+
"Intended Audience :: Developers",
85+
"License :: OSI Approved :: Apache Software License",
86+
"Programming Language :: Python",
87+
"Programming Language :: Python :: 2",
88+
"Programming Language :: Python :: 2.7",
89+
"Programming Language :: Python :: 3",
90+
"Programming Language :: Python :: 3.5",
91+
"Programming Language :: Python :: 3.6",
92+
"Programming Language :: Python :: 3.7",
93+
"Operating System :: OS Independent",
94+
"Topic :: Internet",
8895
],
89-
platforms='Posix; MacOS X; Windows',
96+
platforms="Posix; MacOS X; Windows",
9097
packages=packages,
9198
namespace_packages=namespaces,
9299
install_requires=dependencies,
93100
extras_require=extras,
94-
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
101+
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
95102
include_package_data=True,
96103
zip_safe=False,
97104
)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/googleapis/google-cloud-python/commit/d92572ec73ec3deebcd5e3de68221e68555c2953

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy