Skip to content

Commit 72b4a55

Browse files
committed
Add dwave.samplers and dwave.composite namespace
1 parent 2eb6dc8 commit 72b4a55

File tree

7 files changed

+78
-14
lines changed

7 files changed

+78
-14
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

dwaveoceansdk/__init__.py

Whitespace-only changes.

dwaveoceansdk/package_info.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

setup.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
from __future__ import absolute_import
22

3-
import sys
3+
import os
44
from setuptools import setup
55

6-
_PY2 = sys.version_info.major == 2
7-
8-
# add __version__, __author__, __authoremail__, __description__ to this namespace
9-
# equivalent to:
10-
if _PY2:
11-
execfile("./dwaveoceansdk/package_info.py")
12-
else:
13-
exec(open("./dwaveoceansdk/package_info.py").read())
6+
os.chdir(os.path.dirname(os.path.abspath(__file__)))
147

158
install_requires = [
169
'dwave-networkx>=0.6.1,<0.7.0',
@@ -28,7 +21,10 @@
2821
]
2922
}
3023

31-
packages = ['dwaveoceansdk']
24+
packages = ['dwave',
25+
'dwave.samplers',
26+
'dwave.composites',
27+
]
3228

3329
classifiers = [
3430
'License :: OSI Approved :: Apache Software License',
@@ -44,6 +40,12 @@
4440

4541
python_requires = '>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*'
4642

43+
__version__ = '1.0.3'
44+
__author__ = 'D-Wave Systems Inc.'
45+
__authoremail__ = '[email protected]'
46+
__description__ = 'Software development kit for open source D-Wave tools'
47+
48+
4749
setup(
4850
name='dwave-ocean-sdk',
4951
version=__version__,

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)