Skip to content

Commit

Permalink
Add dwave.samplers and dwave.composite namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
arcondello committed Dec 27, 2018
1 parent 1184245 commit c2ccfd4
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 1 deletion.
17 changes: 17 additions & 0 deletions dwave/__init__.py
Original file line number Diff line number Diff line change
@@ -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__)
20 changes: 20 additions & 0 deletions dwave/composites/__init__.py
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions dwave/samplers/__init__.py
Original file line number Diff line number Diff line change
@@ -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
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
# ================================================================================================
from __future__ import absolute_import

import os
import sys

from setuptools import setup

_PY2 = sys.version_info.major == 2
Expand All @@ -27,6 +29,8 @@
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',
'dwave-system>=0.5.0,<0.6.0',
Expand All @@ -43,7 +47,11 @@
]
}

packages = ['dwaveoceansdk']
packages = ['dwaveoceansdk',
'dwave',
'dwave.samplers',
'dwave.composites',
]

classifiers = [
'License :: OSI Approved :: Apache Software License',
Expand Down
9 changes: 9 additions & 0 deletions tests/test_entry_points.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import unittest


class Test_dwave_samplers(unittest.TestCase):
pass


class Test_dwave_composites(unittest.TestCase):
pass

0 comments on commit c2ccfd4

Please sign in to comment.