Unverified Commit 39c8d58a by Chris Jones Committed by GitHub

Rename python bindings package to `google_benchmark`. (#999)

A few people have complained that `benchmark` is too generic. Also, add Python 3.8.
parent 7f27afe8
load("//bindings/python:build_defs.bzl", "py_extension") load("//bindings/python:build_defs.bzl", "py_extension")
py_library( py_library(
name = "benchmark", name = "google_benchmark",
srcs = ["__init__.py"], srcs = ["__init__.py"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
...@@ -32,7 +32,7 @@ py_test( ...@@ -32,7 +32,7 @@ py_test(
srcs_version = "PY3", srcs_version = "PY3",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":benchmark", ":google_benchmark",
], ],
) )
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
# limitations under the License. # limitations under the License.
"""Example of Python using C++ benchmark framework. """Example of Python using C++ benchmark framework.
To run this example, you must first install the `benchmark` Python package. To run this example, you must first install the `google_benchmark` Python package.
To install using `setup.py`, download and extract the `benchmark` source. To install using `setup.py`, download and extract the `google_benchmark` source.
In the extracted directory, execute: In the extracted directory, execute:
python setup.py install python setup.py install
""" """
import benchmark import google_benchmark as benchmark
@benchmark.register @benchmark.register
......
...@@ -17,7 +17,7 @@ IS_WINDOWS = sys.platform.startswith('win') ...@@ -17,7 +17,7 @@ IS_WINDOWS = sys.platform.startswith('win')
def _get_version(): def _get_version():
"""Parse the version string from __init__.py.""" """Parse the version string from __init__.py."""
with open(os.path.join(here, 'bindings', 'python', 'benchmark', '__init__.py')) as f: with open(os.path.join(here, 'bindings', 'python', 'google_benchmark', '__init__.py')) as f:
try: try:
version_line = next( version_line = next(
line for line in f if line.startswith('__version__')) line for line in f if line.startswith('__version__'))
...@@ -95,7 +95,7 @@ class BuildBazelExtension(build_ext.build_ext): ...@@ -95,7 +95,7 @@ class BuildBazelExtension(build_ext.build_ext):
setuptools.setup( setuptools.setup(
name='google-benchmark', name='google_benchmark',
version=_get_version(), version=_get_version(),
url='https://github.com/google/benchmark', url='https://github.com/google/benchmark',
description='A library to benchmark code snippets.', description='A library to benchmark code snippets.',
...@@ -106,7 +106,7 @@ setuptools.setup( ...@@ -106,7 +106,7 @@ setuptools.setup(
packages=setuptools.find_packages('bindings/python'), packages=setuptools.find_packages('bindings/python'),
install_requires=_parse_requirements('bindings/python/requirements.txt'), install_requires=_parse_requirements('bindings/python/requirements.txt'),
cmdclass=dict(build_ext=BuildBazelExtension), cmdclass=dict(build_ext=BuildBazelExtension),
ext_modules=[BazelExtension('benchmark._benchmark', '//bindings/python/benchmark:_benchmark')], ext_modules=[BazelExtension('google_benchmark._benchmark', '//bindings/python/google_benchmark:_benchmark')],
zip_safe=False, zip_safe=False,
# PyPI package information. # PyPI package information.
classifiers=[ classifiers=[
...@@ -116,6 +116,7 @@ setuptools.setup( ...@@ -116,6 +116,7 @@ setuptools.setup(
'License :: OSI Approved :: Apache Software License', 'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Software Development :: Testing', 'Topic :: Software Development :: Testing',
'Topic :: System :: Benchmark', 'Topic :: System :: Benchmark',
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment