Skip to content

Commit

Permalink
Move package metadata to setup.cfg
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
randomir committed May 19, 2021
1 parent 50013b7 commit 6b56574
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 52 deletions.
3 changes: 2 additions & 1 deletion greedy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.1.2'

from greedy.sampler import *
import greedy.sampler

from greedy.composite import *
import greedy.composite

from greedy.package_info import __version__
import greedy.package_info
6 changes: 4 additions & 2 deletions greedy/package_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from greedy import __version__

# keep in sync with setup.cfg
__package_name__ = 'dwave-greedy'
__title__ = 'D-Wave Greedy'
__version__ = '0.1.2'
__author__ = 'D-Wave Systems Inc.'
__author_email__ = 'radomir@dwavesys.com'
__author_email__ = 'tools@dwavesys.com'
__description__ = 'Ocean-compatible collection of greedy/brute-force solvers/samplers'
__url__ = 'https://github.com/dwavesystems/dwave-greedy'
__license__ = 'Apache 2.0'
Expand Down
52 changes: 50 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
[metadata]
license-file = LICENSE
description-file = README.rst
name = dwave-greedy
version = attr: greedy.__version__
description = Ocean-compatible collection of greedy/brute-force solvers/samplers
long_description = file: README.rst
long_description_content_type = text/x-rst
license = Apache 2.0
license_file = LICENSE
copyright = 2019, D-Wave Systems Inc.
author = D-Wave Systems Inc.
author_email = [email protected]
url = https://github.com/dwavesystems/dwave-greedy
project_urls =
Documentation = https://docs.ocean.dwavesys.com/en/stable/docs_greedy/sdk_index.html
Issue Tracker = https://github.com/dwavesystems/dwave-greedy/issues/
Source Code = https://github.com/dwavesystems/dwave-greedy/
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 = greedy
zip_safe = false
include_package_data = true
python_requires = >=3.6
install_requires =
numpy>=1.16.0,<2.0.0
dimod>=0.9.2,<0.10.0

# keep in sync with {tests,docs}/requirements.txt
[options.extras_require]
test =
coverage
codecov
parameterized
dwave-system>=1.0.0
docs =
sphinx>=4.0.0,<5.0.0
sphinx_rtd_theme
recommonmark

[aliases]
dists = clean --all sdist bdist_wheel
46 changes: 0 additions & 46 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -48,57 +46,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, "greedy", "package_info.py")
package_info = {}
with open(package_info_path, encoding='utf-8') as f:
exec(f.read(), package_info)

packages = ['greedy']

# Package requirements, minimal pinning
install_requires = ['numpy>=1.16.0,<2.0.0', 'dimod>=0.9.2,<0.10.0']

# Package extras requirements
extras_require = {
'test': ['coverage', 'mock', 'parameterized', 'dwave-system>=1.0.0'],
}

extensions = [Extension(
name='greedy.descent',
sources=['greedy/descent.pyx'],
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['__package_name__'],
version=package_info['__version__'],
author=package_info['__author__'],
author_email=package_info['__author_email__'],
description=package_info['__description__'],
long_description=open('README.rst', encoding='utf-8').read(),
url=package_info['__url__'],
license=package_info['__license__'],
packages=packages,
python_requires=python_requires,
install_requires=install_requires,
extras_require=extras_require,
ext_modules=cythonize(extensions),
cmdclass={'build_ext': build_ext_with_args},
classifiers=classifiers,
zip_safe=False,
)
1 change: 0 additions & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
mock
coverage
codecov
parameterized
Expand Down

0 comments on commit 6b56574

Please sign in to comment.