Skip to content

Commit 8149fa1

Browse files
committed
Add dwave.samplers and dwave.composite namespace
1 parent 2eb6dc8 commit 8149fa1

File tree

5 files changed

+75
-1
lines changed

5 files changed

+75
-1
lines changed

dwave/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2018 D-Wave Systems Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# ================================================================================================
16+
import pkgutil
17+
__path__ = pkgutil.extend_path(__path__, __name__)

dwave/composites/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2018 D-Wave Systems Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# ================================================================================================
16+
from pkg_resources import iter_entry_points
17+
18+
# add the composites to the module from entrypoints, name conflicts override
19+
globals().update((ep.name, ep.load()) for ep in iter_entry_points('dwave.composites'))
20+
del iter_entry_points # remove from namespace

dwave/samplers/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2018 D-Wave Systems Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# ================================================================================================
16+
from pkg_resources import iter_entry_points
17+
18+
# add the samplers to the module from entrypoints, name conflicts override
19+
globals().update((ep.name, ep.load()) for ep in iter_entry_points('dwave.samplers'))
20+
del iter_entry_points # remove from namespace

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from __future__ import absolute_import
22

3+
import os
34
import sys
5+
46
from setuptools import setup
57

68
_PY2 = sys.version_info.major == 2
@@ -12,6 +14,8 @@
1214
else:
1315
exec(open("./dwaveoceansdk/package_info.py").read())
1416

17+
os.chdir(os.path.dirname(os.path.abspath(__file__)))
18+
1519
install_requires = [
1620
'dwave-networkx>=0.6.1,<0.7.0',
1721
'dwave-system>=0.5.0,<0.6.0',
@@ -28,7 +32,11 @@
2832
]
2933
}
3034

31-
packages = ['dwaveoceansdk']
35+
packages = ['dwaveoceansdk',
36+
'dwave',
37+
'dwave.samplers',
38+
'dwave.composites',
39+
]
3240

3341
classifiers = [
3442
'License :: OSI Approved :: Apache Software License',

tests/test_entry_points.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import unittest
2+
3+
4+
class Test_dwave_samplers(unittest.TestCase):
5+
pass
6+
7+
8+
class Test_dwave_composites(unittest.TestCase):
9+
pass

0 commit comments

Comments
 (0)