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 24, 2018
1 parent 2eb6dc8 commit 72b4a55
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 14 deletions.
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
Empty file removed dwaveoceansdk/__init__.py
Empty file.
4 changes: 0 additions & 4 deletions dwaveoceansdk/package_info.py

This file was deleted.

22 changes: 12 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -28,7 +21,10 @@
]
}

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

classifiers = [
'License :: OSI Approved :: Apache Software License',
Expand All @@ -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__ = '[email protected]'
__description__ = 'Software development kit for open source D-Wave tools'


setup(
name='dwave-ocean-sdk',
version=__version__,
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 72b4a55

Please sign in to comment.