From cd1db608912b817228aebb55bd492a49f0c54a29 Mon Sep 17 00:00:00 2001 From: Radomir Stevanovic Date: Fri, 25 Jun 2021 13:26:35 -0700 Subject: [PATCH] Move package metadata to setup.cfg Note the setup() includes only dynamically generated options. GitHub seems to have recently fixed their dependency scanning to look at setup.cfg (dependabot/dependabot-core#3423). Possibly not deployed to GitHub yet. --- setup.cfg | 38 ++++++++++++++++++++++++++++++++++++++ setup.py | 41 ----------------------------------------- tabu/__init__.py | 3 +++ tabu/package_info.py | 8 +++----- 4 files changed, 44 insertions(+), 46 deletions(-) create mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..53f6cb9 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,38 @@ +[metadata] +name = dwave-tabu +version = attr: tabu.__version__ +description = Optimized Tabu solver for QUBOs +long_description = file: README.rst +long_description_content_type = text/x-rst +license = Apache 2.0 +license_file = LICENSE +author = D-Wave Systems Inc. +author_email = tools@dwavesys.com +url = https://github.com/dwavesystems/dwave-tabu +project_urls = + Documentation = https://docs.ocean.dwavesys.com/en/stable/docs_tabu/sdk_index.html + Issue Tracker = https://github.com/dwavesystems/dwave-tabu/issues/ + Source Code = https://github.com/dwavesystems/dwave-tabu/ +classifiers = + License :: OSI Approved :: Apache Software License + Operating System :: OS Independent + Development Status :: 4 - Beta + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: Implementation :: CPython + +[options] +packages = tabu +zip_safe = false +include_package_data = true +python_requires = >=3.6 +install_requires = + numpy>=1.16.0,<2.0.0 + dimod>=0.9.0,<0.10.0 + +[aliases] +dists = clean --all sdist bdist_wheel diff --git a/setup.py b/setup.py index d8b77d1..5e503aa 100644 --- a/setup.py +++ b/setup.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os - from setuptools import setup, Extension from setuptools.command.build_ext import build_ext from Cython.Build import cythonize @@ -47,52 +45,13 @@ def build_extensions(self): super().build_extensions() -# Load package info, without importing the package -basedir = os.path.dirname(os.path.abspath(__file__)) -package_info_path = os.path.join(basedir, "tabu", "package_info.py") -package_info = {} -with open(package_info_path, encoding='utf-8') as f: - exec(f.read(), package_info) - -packages = ['tabu'] - -# Package requirements, minimal pinning -install_requires = ['numpy>=1.16.0', 'dimod>=0.9.0'] - extensions = [Extension( name='tabu.tabu_search', sources=['tabu/tabu_search.pyx', 'tabu/src/utils.cpp', 'tabu/src/bqp.cpp'], include_dirs=[numpy.get_include()] )] - -classifiers = [ - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: OS Independent', - 'Development Status :: 3 - Alpha', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', -] - -python_requires = '>=3.6' - setup( - name=package_info['__packagename__'], - version=package_info['__version__'], - author=package_info['__author__'], - author_email=package_info['__authoremail__'], - description=package_info['__description__'], - long_description=open('README.rst', encoding='utf-8').read(), - url=package_info['__url__'], - license=package_info['__license__'], - classifiers=classifiers, cmdclass={'build_ext': build_ext_with_args}, ext_modules=cythonize(extensions), - packages=packages, - python_requires=python_requires, - install_requires=install_requires, - zip_safe=False, ) diff --git a/tabu/__init__.py b/tabu/__init__.py index c9c7a2a..afdd767 100644 --- a/tabu/__init__.py +++ b/tabu/__init__.py @@ -12,6 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +__package_name__ = 'dwave-tabu' +__version__ = '0.4.0' + __all__ = ['TabuSearch', 'TabuSampler'] from tabu.tabu_search import TabuSearch diff --git a/tabu/package_info.py b/tabu/package_info.py index d56ee49..ac3175d 100644 --- a/tabu/package_info.py +++ b/tabu/package_info.py @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -__packagename__ = 'dwave-tabu' -__title__ = 'D-Wave Tabu' -__version__ = '0.4.0' +from tabu import __version__, __package_name__ + __author__ = 'D-Wave Systems Inc.' -__authoremail__ = 'tools@dwavesys.com' +__author_email__ = 'tools@dwavesys.com' __description__ = 'Optimized Tabu solver for QUBOs' __url__ = 'https://github.com/dwavesystems/dwave-tabu' __license__ = 'Apache 2.0' -__copyright__ = '2018, D-Wave Systems Inc.'