-
Notifications
You must be signed in to change notification settings - Fork 398
Move Aer to it's own package #840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
21ae8ac
to
f56f7b2
Compare
This is failing unittests because of a weird circular import error. I originally never encountered this locally prior to merging Qiskit/qiskit#4767 but by switching to |
|
||
|
||
class SnapshotDensityMatrix(Snapshot): | ||
class SnapshotDensityMatrix(snapshot.Snapshot): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Snapshot is used in the code below, which is why the CI is giving an import error.
6aa1064
to
9fae0dd
Compare
Namespace packages are constant source of problems for users. The python packaging ecosystem around splitting packages across namespaces is fragile at the best of times and can often leave a you with an environment that isn't recoverable (especially when mixing install methods). There is also a performance hit whenever there is a piece of the namespace we allow external packages to extend since it requires doing a full python path search which can be slow depending on the backing I/O and the number of paths in sys.path for an environment. This commit addresses the piece from the aer perspective by moving qiskit.providers.aer to it's own package and namespace 'qiskit_aer'. This will be coupled with a change in terra that removes the arbitrary namespace hook points and hard coding the element namespace maps via a custom import loader at the root of the namespace. This has 2 advantages it removes the use of namespace packages so the fragility and performance impact are fixed since every element will be renamed to use 'qiskit_*' instead of 'qiskit.*', but it also makes it explicit where we extend the namespace. The previous method allowed any package to extend qiskit.* and qiskit.providers.* with whatever they wanted. This commit will need to be coordinated with the terra change to ensure we don't block development, because while it's not breaking for end users as a coordinated code release piecewise it's a breaking change for each element, including Aer. Depends-On: Qiskit/qiskit#4767 Fixes Qiskit/qiskit#559
9fae0dd
to
45d4084
Compare
Fix snapshot imports Remove imports of Aer in tests Replace relative imports in parent directors with imports using the full path Remove `from qiskit` imports
make GHA tutorial test run earlier Revert this commit when tests are passing
Except for the qutip_extra_lite dir
Update qiskit_aer module imports
…nto namespace-no-more
Namespace packages are constant source of problems for users. The python packaging ecosystem around splitting packages across namespaces is fragile at the best of times and can often leave a you with an environment that isn't recoverable (especially when mixing install methods). There is also a performance hit whenever there is a piece of the namespace we allow external packages to extend since it requires doing a full python path search which can be slow depending on the backing I/O and the number of paths in sys.path for an environment. This commit addresses the piece from the aer perspective by moving qiskit.providers.aer to it's own package and namespace 'qiskit_aer'. This is coupled with a custom namespace module that implements a custom import loader at the root of the namespace. This has 2 advantages it removes the use of namespace packages so the fragility and performance impact are fixed since every element will be renamed to use 'qiskit_' instead of 'qiskit.' (aer being the only one remaining). This is the second attempt at doing this namespace rename, the first failed attempt in Qiskit#840 was trying to migrate all the former qiskit elements at the same time and was too difficult to migrate everything at once without causing breaking api changes. This commit is mechanically the same (renaming qiskit.providers.aer -> qiskit_aer), but how it integrates with qiskit-terra is changed. With Qiskit/qiskit#5089 qiskit-terra, the package which owns the 'qiskit.*' namespace, adds a metaimporter that will redirect imports from qiskit.providers.aer to qiskit_aer. This means before we can merge this commit Qiskit/qiskit#5089 will need to be released first to ensure that for backwards compatibility existing users will be able to access aer from the old namespace. Fixes Qiskit/qiskit#559
Superseded by #1526 |
Namespace packages are constant source of problems for users. The python packaging ecosystem around splitting packages across namespaces is fragile at the best of times and can often leave a you with an environment that isn't recoverable (especially when mixing install methods). There is also a performance hit whenever there is a piece of the namespace we allow external packages to extend since it requires doing a full python path search which can be slow depending on the backing I/O and the number of paths in sys.path for an environment. This commit addresses the piece from the aer perspective by moving qiskit.providers.aer to it's own package and namespace 'qiskit_aer'. This is coupled with a custom namespace module that implements a custom import loader at the root of the namespace. This has 2 advantages it removes the use of namespace packages so the fragility and performance impact are fixed since every element will be renamed to use 'qiskit_' instead of 'qiskit.' (aer being the only one remaining). This is the second attempt at doing this namespace rename, the first failed attempt in Qiskit#840 was trying to migrate all the former qiskit elements at the same time and was too difficult to migrate everything at once without causing breaking api changes. This commit is mechanically the same (renaming qiskit.providers.aer -> qiskit_aer), but how it integrates with qiskit-terra is changed. With Qiskit/qiskit#5089 qiskit-terra, the package which owns the 'qiskit.*' namespace, adds a metaimporter that will redirect imports from qiskit.providers.aer to qiskit_aer. This means before we can merge this commit Qiskit/qiskit#5089 will need to be released first to ensure that for backwards compatibility existing users will be able to access aer from the old namespace. Fixes Qiskit/qiskit#559
Namespace packages are constant source of problems for users. The python packaging ecosystem around splitting packages across namespaces is fragile at the best of times and can often leave a you with an environment that isn't recoverable (especially when mixing install methods). There is also a performance hit whenever there is a piece of the namespace we allow external packages to extend since it requires doing a full python path search which can be slow depending on the backing I/O and the number of paths in sys.path for an environment. This commit addresses the piece from the aer perspective by moving qiskit.providers.aer to it's own package and namespace 'qiskit_aer'. This is coupled with a custom namespace module that implements a custom import loader at the root of the namespace. This has 2 advantages it removes the use of namespace packages so the fragility and performance impact are fixed since every element will be renamed to use 'qiskit_' instead of 'qiskit.' (aer being the only one remaining). This is the second attempt at doing this namespace rename, the first failed attempt in Qiskit#840 was trying to migrate all the former qiskit elements at the same time and was too difficult to migrate everything at once without causing breaking api changes. This commit is mechanically the same (renaming qiskit.providers.aer -> qiskit_aer), but how it integrates with qiskit-terra is changed. With Qiskit/qiskit#5089 qiskit-terra, the package which owns the 'qiskit.*' namespace, adds a metaimporter that will redirect imports from qiskit.providers.aer to qiskit_aer. This means before we can merge this commit Qiskit/qiskit#5089 will need to be released first to ensure that for backwards compatibility existing users will be able to access aer from the old namespace. Fixes Qiskit/qiskit#559
Summary
Namespace packages are constant source of problems for users. The python
packaging ecosystem around splitting packages across namespaces is
fragile at the best of times and can often leave a you with an
environment that isn't recoverable (especially when mixing install
methods). There is also a performance hit whenever there is a piece of
the namespace we allow external packages to extend since it requires
doing a full python path search which can be slow depending on the
backing I/O and the number of paths in sys.path for an environment. This
commit addresses the piece from the aer perspective by moving
qiskit.providers.aer to it's own package and namespace 'qiskit_aer'.
This will be coupled with a change in terra that removes the arbitrary
namespace hook points and hard coding the element namespace maps via a
custom import loader at the root of the namespace. This has 2 advantages
it removes the use of namespace packages so the fragility and
performance impact are fixed since every element will be renamed to use
'qiskit_' instead of 'qiskit.', but it also makes it explicit where we
extend the namespace. The previous method allowed any package to extend
qiskit.* and qiskit.providers.* with whatever they wanted. This commit
will need to be coordinated with the terra change to ensure we don't
block development, because while it's not breaking for end users as a
coordinated code release piecewise it's a breaking change for each
element, including Aer.
Details and comments
Depends-On: Qiskit/qiskit#4767
Fixes Qiskit/qiskit#559