Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
Clean up setup.py, dependencies. (#1940)
Browse files Browse the repository at this point in the history
Fixes #1849.
Fixes #1938.
  • Loading branch information
lukesneeringer authored and michaelbausor committed May 17, 2018
1 parent c58c306 commit c5fc177
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ private List<PackageDependencyView> generateProtoPackageDependencies() {
private List<PackageDependencyView> generateAdditionalDependencies() {
ImmutableList.Builder<PackageDependencyView> dependencies = ImmutableList.builder();
dependencies.add(
PackageDependencyView.create("google-api-core", VersionBound.create("0.1.0", "0.2.0dev")));
PackageDependencyView.create(
"google-api-core[grpc]", VersionBound.create("1.1.0", "2.0.0dev")));
return dependencies.build();
}

Expand Down
127 changes: 77 additions & 50 deletions src/main/resources/com/google/api/codegen/py/setup.py.snip
Original file line number Diff line number Diff line change
@@ -1,55 +1,82 @@
@extends "py/common.snip"

@snippet generate(metadata)
{@licenseSection(metadata.fileHeader)}

"""A setup module for the GAPIC {@metadata.fullName} library.

See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""

from setuptools import setup, find_packages
import io
import sys

install_requires = [
@join packageDep : metadata.dependencies
'{@packageDep.name} >= {@packageDep.versionBound.lower}, < {@packageDep.versionBound.upper}',
@end
]

with io.open('README.rst', 'r', encoding='utf-8') as readme_file:
long_description = readme_file.read()

setup(
name='{@metadata.gapicPackageName}',
version='{@metadata.packageVersionBound.lower}',
author='{@metadata.author}',
author_email='{@metadata.email}',
classifiers=[
'Intended Audience :: Developers',
'Development Status :: {@metadata.developmentStatus}',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
description='GAPIC library for the {@metadata.fullName}',
include_package_data=True,
long_description=long_description,
install_requires=install_requires,
license='{@metadata.licenseName}',
packages=find_packages(exclude=('tests*',)),
namespace_packages=[{@quotedList(metadata.namespacePackages)}],
url='{@metadata.homepage}',
zip_safe=False,
)
{@licenseSection(metadata.fileHeader)}

import io
import os

import setuptools


# Package metadata.

name = '{@metadata.gapicPackageName}'
description = '{@metadata.fullName} API client library'
version = '{@metadata.packageVersionBound.lower}'
# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
# 'Development Status :: 5 - Stable'
release_status = '{@metadata.developmentStatus}'
dependencies = [
@join packageDep : metadata.dependencies
@if packageDep.name != "googleapis-common-protos[grpc]"
'{@packageDep.name} >= {@packageDep.versionBound.lower}, < {@packageDep.versionBound.upper}',
@end
@end
]


# Setup boilerplate below this line.

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

readme_filename = os.path.join(package_root, 'README.rst')
with io.open(readme_filename, encoding='utf-8') as readme_file:
readme = readme_file.read()

# Only include packages under the 'google' namespace. Do not include tests,
# benchmarks, etc.
packages = [
package for package in setuptools.find_packages()
if package.startswith('google')]

# Determine which namespaces are needed.
namespaces = ['google']
if 'google.cloud' in packages:
namespaces.append('google.cloud')


setuptools.setup(
name=name,
version=version,
description=description,
long_description=readme,
author='Google LLC',
author_email='googleapis-packages@google.com',
license='Apache 2.0',
url='https://github.com/GoogleCloudPlatform/google-cloud-python',
classifiers=[
release_status,
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Operating System :: OS Independent',
'Topic :: Internet',
],
platforms='Posix; MacOS X; Windows',
packages=packages,
namespace_packages=namespaces,
install_requires=dependencies,
extras_require=extras,
include_package_data=True,
zip_safe=False,
)
@end
Original file line number Diff line number Diff line change
Expand Up @@ -3427,34 +3427,51 @@ universal = 1
# See the License for the specific language governing permissions and
# limitations under the License.

"""A setup module for the GAPIC Google Example Library API library.
import io
import os

See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
import setuptools

from setuptools import setup, find_packages
import io
import sys

install_requires = [
'google-api-core >= 0.1.0, < 0.2.0dev',
'googleapis-common-protos[grpc] >= 1.5.0, < 2.0dev',
'python-other-package >= 12.1.0, < 13.5.1',

name = 'google-cloud-library'
description = 'Google Example Library API API client library'
version = '0.15.0'
release_status = '3 - Alpha'
dependencies = [
'google-api-core[grpc] >= 1.1.0, < 2.0.0dev',

'python-other-package >= 12.1.0, < 13.5.1',
]

with io.open('README.rst', 'r', encoding='utf-8') as readme_file:
long_description = readme_file.read()

setup(
name='google-cloud-library',
version='0.15.0',

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

readme_filename = os.path.join(package_root, 'README.rst')
with io.open(readme_filename, encoding='utf-8') as readme_file:
readme = readme_file.read()

packages = [
package for package in setuptools.find_packages()
if package.startswith('google')]

namespaces = ['google']
if 'google.cloud' in packages:
namespaces.append('google.cloud')


setuptools.setup(
name=name,
version=version,
description=description,
long_description=readme,
author='Google LLC',
author_email='googleapis-packages@google.com',
author_email='googleapis-packages@oogle.com',
license='Apache 2.0',
url='https://github.com/GoogleCloudPlatform/google-cloud-python',
classifiers=[
'Intended Audience :: Developers',
'Development Status :: 3 - Alpha',
release_status,
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
Expand All @@ -3464,18 +3481,17 @@ setup(
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Operating System :: OS Independent',
'Topic :: Internet',
],
description='GAPIC library for the Google Example Library API',
platforms='Posix; MacOS X; Windows',
packages=packages,
namespace_packages=namespaces,
install_requires=dependencies,
extras_require=extras,
include_package_data=True,
long_description=long_description,
install_requires=install_requires,
license='Apache 2.0',
packages=find_packages(exclude=('tests*',)),
namespace_packages=['google', 'google.cloud'],
url='https://github.com/googleapis/googleapis',
zip_safe=False,
)

============== file: tests/system/gapic/v1/test_system_library_service_v1.py ==============
# Copyright 2018 Google LLC
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,34 +1042,51 @@ universal = 1
# See the License for the specific language governing permissions and
# limitations under the License.

"""A setup module for the GAPIC Google Fake API library.
import io
import os

See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
import setuptools

from setuptools import setup, find_packages
import io
import sys

install_requires = [
'google-api-core >= 0.1.0, < 0.2.0dev',
'googleapis-common-protos[grpc] >= 1.5.0, < 2.0dev',
'python-other-package >= 12.1.0, < 13.5.1',

name = 'google-cloud-library'
description = 'Google Fake API API client library'
version = '0.15.0'
release_status = '4 - Beta'
dependencies = [
'google-api-core[grpc] >= 1.1.0, < 2.0.0dev',

'python-other-package >= 12.1.0, < 13.5.1',
]

with io.open('README.rst', 'r', encoding='utf-8') as readme_file:
long_description = readme_file.read()

setup(
name='google-cloud-library',
version='0.15.0',

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

readme_filename = os.path.join(package_root, 'README.rst')
with io.open(readme_filename, encoding='utf-8') as readme_file:
readme = readme_file.read()

packages = [
package for package in setuptools.find_packages()
if package.startswith('google')]

namespaces = ['google']
if 'google.cloud' in packages:
namespaces.append('google.cloud')


setuptools.setup(
name=name,
version=version,
description=description,
long_description=readme,
author='Google LLC',
author_email='googleapis-packages@google.com',
author_email='googleapis-packages@oogle.com',
license='Apache 2.0',
url='https://github.com/GoogleCloudPlatform/google-cloud-python',
classifiers=[
'Intended Audience :: Developers',
'Development Status :: 4 - Beta',
release_status,
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
Expand All @@ -1079,18 +1096,17 @@ setup(
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Operating System :: OS Independent',
'Topic :: Internet',
],
description='GAPIC library for the Google Fake API',
platforms='Posix; MacOS X; Windows',
packages=packages,
namespace_packages=namespaces,
install_requires=dependencies,
extras_require=extras,
include_package_data=True,
long_description=long_description,
install_requires=install_requires,
license='Apache 2.0',
packages=find_packages(exclude=('tests*',)),
namespace_packages=[],
url='https://github.com/googleapis/googleapis',
zip_safe=False,
)

============== file: tests/unit/gapic/v1/test_no_templates_api_service_client_v1.py ==============
# Copyright 2018 Google LLC
#
Expand Down

0 comments on commit c5fc177

Please sign in to comment.