Skip to content

Commit c2ccfd4

Browse files
committed
Add dwave.samplers and dwave.composite namespace
1 parent 1184245 commit c2ccfd4

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
@@ -15,7 +15,9 @@
1515
# ================================================================================================
1616
from __future__ import absolute_import
1717

18+
import os
1819
import sys
20+
1921
from setuptools import setup
2022

2123
_PY2 = sys.version_info.major == 2
@@ -27,6 +29,8 @@
2729
else:
2830
exec(open("./dwaveoceansdk/package_info.py").read())
2931

32+
os.chdir(os.path.dirname(os.path.abspath(__file__)))
33+
3034
install_requires = [
3135
'dwave-networkx>=0.6.1,<0.7.0',
3236
'dwave-system>=0.5.0,<0.6.0',
@@ -43,7 +47,11 @@
4347
]
4448
}
4549

46-
packages = ['dwaveoceansdk']
50+
packages = ['dwaveoceansdk',
51+
'dwave',
52+
'dwave.samplers',
53+
'dwave.composites',
54+
]
4755

4856
classifiers = [
4957
'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)