microsoft/qdk
Publicmirrored from https://github.com/microsoft/qdkAvailable
source/pip/qsharp/__init__.py
84lines · modecode
| 1 | # Copyright (c) Microsoft Corporation. |
| 2 | # Licensed under the MIT License. |
| 3 | |
| 4 | """Deprecated: The ``qsharp`` package has been replaced by ``qdk``. |
| 5 | |
| 6 | All functionality previously available in ``qsharp`` is now provided by the |
| 7 | ``qdk`` package. This package is a thin compatibility shim that re-exports the |
| 8 | ``qdk`` public API so that existing code continues to work. |
| 9 | |
| 10 | To migrate, replace ``import qsharp`` with ``from qdk import qsharp`` or |
| 11 | ``import qdk`` and use the ``qdk.*`` namespace directly. |
| 12 | """ |
| 13 | |
| 14 | import warnings as _warnings |
| 15 | |
| 16 | _warnings.warn( |
| 17 | "The 'qsharp' package is deprecated and will be removed in a future release. " |
| 18 | "Please use the 'qdk' package instead. " |
| 19 | "See https://github.com/microsoft/qdk/wiki/Migrating-from-qsharp-to-qdk for migration guidance.", |
| 20 | DeprecationWarning, |
| 21 | stacklevel=2, |
| 22 | ) |
| 23 | |
| 24 | # Re-export the public API from qdk.qsharp so that existing code keeps working. |
| 25 | from qdk.qsharp import ( # noqa: F401 |
| 26 | StateDump, |
| 27 | ShotResult, |
| 28 | PauliNoise, |
| 29 | DepolarizingNoise, |
| 30 | BitFlipNoise, |
| 31 | PhaseFlipNoise, |
| 32 | init, |
| 33 | eval, |
| 34 | run, |
| 35 | compile, |
| 36 | circuit, |
| 37 | estimate, |
| 38 | logical_counts, |
| 39 | set_quantum_seed, |
| 40 | set_classical_seed, |
| 41 | dump_machine, |
| 42 | dump_circuit, |
| 43 | Result, |
| 44 | Pauli, |
| 45 | QSharpError, |
| 46 | TargetProfile, |
| 47 | estimate_custom, |
| 48 | CircuitGenerationMethod, |
| 49 | ) |
| 50 | |
| 51 | # Re-export submodules that were previously loaded as side effects |
| 52 | # (e.g. ``_qsharp.py`` did ``from . import code``) so that attribute |
| 53 | # access like ``qsharp.code`` keeps working after a bare ``import qsharp``. |
| 54 | from . import code, estimator # noqa: F401 |
| 55 | |
| 56 | from qdk import telemetry_events |
| 57 | |
| 58 | telemetry_events.on_import() |
| 59 | |
| 60 | __all__ = [ |
| 61 | "init", |
| 62 | "eval", |
| 63 | "run", |
| 64 | "set_quantum_seed", |
| 65 | "set_classical_seed", |
| 66 | "dump_machine", |
| 67 | "dump_circuit", |
| 68 | "compile", |
| 69 | "circuit", |
| 70 | "estimate", |
| 71 | "estimate_custom", |
| 72 | "logical_counts", |
| 73 | "Result", |
| 74 | "Pauli", |
| 75 | "QSharpError", |
| 76 | "TargetProfile", |
| 77 | "StateDump", |
| 78 | "ShotResult", |
| 79 | "PauliNoise", |
| 80 | "DepolarizingNoise", |
| 81 | "BitFlipNoise", |
| 82 | "PhaseFlipNoise", |
| 83 | "CircuitGenerationMethod", |
| 84 | ] |
| 85 | |