diff --git a/changes.d/841.removal b/changes.d/841.removal new file mode 100644 index 00000000..9ae7d7ac --- /dev/null +++ b/changes.d/841.removal @@ -0,0 +1 @@ +Remove qctoolkit alias for qupulse. \ No newline at end of file diff --git a/qctoolkit/__init__.py b/qctoolkit/__init__.py deleted file mode 100644 index 208c2083..00000000 --- a/qctoolkit/__init__.py +++ /dev/null @@ -1,34 +0,0 @@ -# SPDX-FileCopyrightText: 2014-2024 Quantum Technology Group and Chair of Software Engineering, RWTH Aachen University -# -# SPDX-License-Identifier: GPL-3.0-or-later - -"""This is a (hopefully temporary) alias package to not break existing code. If you know a better way please change""" -import sys -import re -import pkgutil -import importlib -import warnings -import logging - -qupulse = importlib.import_module('qupulse') -sys.modules[__name__] = qupulse - -aliased = {} - -""" import all subpackages and submodules to assert that -from qupulse.pulse import TablePT as T1 -from qctoolkit.pulse import TablePT as T2 -assert T1 is T2 -""" -for _, name, ispkg in pkgutil.walk_packages(qupulse.__path__, 'qupulse.'): - alias = re.sub('^qupulse.', '%s.' % __name__, name) - - try: - imported = importlib.import_module(name) - except ImportError: - warnings.warn('Could not import %s. The alias %s was NOT created.' % (name, alias)) - continue - sys.modules[alias] = imported - aliased[alias] = name - -logging.info('Created module aliases:', aliased) diff --git a/tests/qctoolkit_alias_tests.py b/tests/qctoolkit_alias_tests.py deleted file mode 100644 index 1ae44677..00000000 --- a/tests/qctoolkit_alias_tests.py +++ /dev/null @@ -1,16 +0,0 @@ -import unittest - - -class QctoolkitAliasTest(unittest.TestCase): - def test_alias(self): - import qctoolkit.pulses - import qupulse.pulses - - self.assertIs(qctoolkit.pulses, qupulse.pulses) - self.assertIs(qctoolkit.pulses.TablePT, qupulse.pulses.TablePT) - - def test_class_identity(self): - from qupulse.program.loop import Loop as Loop_qu - from qctoolkit.program.loop import Loop as Loop_qc - - self.assertIs(Loop_qc, Loop_qu)