diff --git a/dwave/__init__.py b/dwave/__init__.py new file mode 100644 index 00000000..64083cc8 --- /dev/null +++ b/dwave/__init__.py @@ -0,0 +1,17 @@ +# Copyright 2018 D-Wave Systems Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ================================================================================================ +import pkgutil +__path__ = pkgutil.extend_path(__path__, __name__) diff --git a/dwave/composites/__init__.py b/dwave/composites/__init__.py new file mode 100644 index 00000000..84774a81 --- /dev/null +++ b/dwave/composites/__init__.py @@ -0,0 +1,20 @@ +# Copyright 2018 D-Wave Systems Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ================================================================================================ +from pkg_resources import iter_entry_points + +# add the composites to the module from entrypoints, name conflicts override +globals().update((ep.name, ep.load()) for ep in iter_entry_points('dwave.composites')) +del iter_entry_points # remove from namespace diff --git a/dwave/samplers/__init__.py b/dwave/samplers/__init__.py new file mode 100644 index 00000000..bf0642aa --- /dev/null +++ b/dwave/samplers/__init__.py @@ -0,0 +1,20 @@ +# Copyright 2018 D-Wave Systems Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ================================================================================================ +from pkg_resources import iter_entry_points + +# add the samplers to the module from entrypoints, name conflicts override +globals().update((ep.name, ep.load()) for ep in iter_entry_points('dwave.samplers')) +del iter_entry_points # remove from namespace diff --git a/dwaveoceansdk/__init__.py b/dwaveoceansdk/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/dwaveoceansdk/package_info.py b/dwaveoceansdk/package_info.py deleted file mode 100644 index e24e8efc..00000000 --- a/dwaveoceansdk/package_info.py +++ /dev/null @@ -1,4 +0,0 @@ -__version__ = '1.0.3' -__author__ = 'D-Wave Systems Inc.' -__authoremail__ = 'tools@dwavesys.com' -__description__ = 'Software development kit for open source D-Wave tools' diff --git a/setup.py b/setup.py index b0603690..ae9538b8 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,9 @@ from __future__ import absolute_import -import sys +import os from setuptools import setup -_PY2 = sys.version_info.major == 2 - -# add __version__, __author__, __authoremail__, __description__ to this namespace -# equivalent to: -if _PY2: - execfile("./dwaveoceansdk/package_info.py") -else: - exec(open("./dwaveoceansdk/package_info.py").read()) +os.chdir(os.path.dirname(os.path.abspath(__file__))) install_requires = [ 'dwave-networkx>=0.6.1,<0.7.0', @@ -28,7 +21,10 @@ ] } -packages = ['dwaveoceansdk'] +packages = ['dwave', + 'dwave.samplers', + 'dwave.composites', + ] classifiers = [ 'License :: OSI Approved :: Apache Software License', @@ -44,6 +40,12 @@ python_requires = '>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*' +__version__ = '1.0.3' +__author__ = 'D-Wave Systems Inc.' +__authoremail__ = 'tools@dwavesys.com' +__description__ = 'Software development kit for open source D-Wave tools' + + setup( name='dwave-ocean-sdk', version=__version__, diff --git a/tests/test_entry_points.py b/tests/test_entry_points.py new file mode 100644 index 00000000..d61c3ada --- /dev/null +++ b/tests/test_entry_points.py @@ -0,0 +1,9 @@ +import unittest + + +class Test_dwave_samplers(unittest.TestCase): + pass + + +class Test_dwave_composites(unittest.TestCase): + pass