qsharp 1.29.2.dev0__py3-none-any.whl → 1.29.3.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qsharp/__init__.py +5 -0
- {qsharp-1.29.2.dev0.dist-info → qsharp-1.29.3.dev0.dist-info}/METADATA +2 -2
- {qsharp-1.29.2.dev0.dist-info → qsharp-1.29.3.dev0.dist-info}/RECORD +6 -5
- {qsharp-1.29.2.dev0.dist-info → qsharp-1.29.3.dev0.dist-info}/top_level.txt +1 -0
- tests/test_qsharp_shim.py +93 -0
- {qsharp-1.29.2.dev0.dist-info → qsharp-1.29.3.dev0.dist-info}/WHEEL +0 -0
qsharp/__init__.py
CHANGED
|
@@ -48,6 +48,11 @@ from qdk.qsharp import ( # noqa: F401
|
|
|
48
48
|
CircuitGenerationMethod,
|
|
49
49
|
)
|
|
50
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
|
+
|
|
51
56
|
from qdk import telemetry_events
|
|
52
57
|
|
|
53
58
|
telemetry_events.on_import()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qsharp
|
|
3
|
-
Version: 1.29.
|
|
3
|
+
Version: 1.29.3.dev0
|
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
|
5
5
|
Classifier: Development Status :: 5 - Production/Stable
|
|
6
6
|
Classifier: Intended Audience :: Developers
|
|
@@ -15,7 +15,7 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
15
15
|
Classifier: Operating System :: POSIX :: Linux
|
|
16
16
|
Requires-Python: >=3.10
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
|
-
Requires-Dist: qdk>=1.29.
|
|
18
|
+
Requires-Dist: qdk>=1.29.3.dev0
|
|
19
19
|
Provides-Extra: jupyterlab
|
|
20
20
|
Requires-Dist: qdk[jupyter]; extra == "jupyterlab"
|
|
21
21
|
Provides-Extra: widgets
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
qsharp/__init__.py,sha256=
|
|
1
|
+
qsharp/__init__.py,sha256=D78ot0Mijhs7d-YiY0ZrhVlhldvCiNdg6EUjYWOCbpQ,2094
|
|
2
2
|
qsharp/_adaptive_bytecode.py,sha256=8LeRWnSWR4LjRhjUbU8TvEb-qStJcaQrF9AJj6jd_dc,169
|
|
3
3
|
qsharp/_adaptive_pass.py,sha256=r11sKeWLCVbyXGF8NHZmsvkBqdFPXmiJjbmuwKSrgOw,161
|
|
4
4
|
qsharp/_fs.py,sha256=lh2N59_0MKks8Co2p1XEsBU_90r8XOFWJCZ4FSI8xNI,150
|
|
@@ -36,7 +36,8 @@ qsharp/qre/interop/__init__.py,sha256=q6rl2D5gQyCxsO2lAYxdScPK21jUBo6IC1QJF5qLLC
|
|
|
36
36
|
qsharp/qre/interop/_cirq.py,sha256=4c7lbL4sCMTOOwr4CtqD8SoXYvqjIt7Y5kDl6R7fOZU,167
|
|
37
37
|
qsharp/qre/models/__init__.py,sha256=kTs75wZbm8-KuMssiSJ_3TnaEWIE5Tgpd4_Kt3ZuRpk,157
|
|
38
38
|
qsharp/utils/__init__.py,sha256=d5a1-QLXPBhR_44ASwYNXbN9U9Elfyj-y2EsTMetl8g,229
|
|
39
|
-
|
|
40
|
-
qsharp-1.29.
|
|
41
|
-
qsharp-1.29.
|
|
42
|
-
qsharp-1.29.
|
|
39
|
+
tests/test_qsharp_shim.py,sha256=-DflZOxY08B0Ba5RIo3yUkd9zZgGkAJGKjgRoRxmKMI,2763
|
|
40
|
+
qsharp-1.29.3.dev0.dist-info/METADATA,sha256=kcmg7pPzh8eoS7b3OHuqF0sBQE_Rie8pCWrAdltt7Eo,3118
|
|
41
|
+
qsharp-1.29.3.dev0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
42
|
+
qsharp-1.29.3.dev0.dist-info/top_level.txt,sha256=xmiwgJ8Zg6yJ7dll8hGJgXgSyRdUnMFvMWvoyHxHZO8,13
|
|
43
|
+
qsharp-1.29.3.dev0.dist-info/RECORD,,
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
"""Tests for the ``qsharp`` compatibility shim.
|
|
5
|
+
|
|
6
|
+
The ``qsharp`` package is a thin deprecation wrapper that re-exports the
|
|
7
|
+
public API from ``qdk``. These tests verify that the expected symbols and
|
|
8
|
+
submodules are accessible via ``import qsharp``.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import importlib
|
|
12
|
+
import warnings
|
|
13
|
+
|
|
14
|
+
import pytest
|
|
15
|
+
|
|
16
|
+
# ---- Symbols that must be directly accessible on ``qsharp`` ----
|
|
17
|
+
|
|
18
|
+
_EXPECTED_SYMBOLS = [
|
|
19
|
+
# functions
|
|
20
|
+
"init",
|
|
21
|
+
"eval",
|
|
22
|
+
"run",
|
|
23
|
+
"compile",
|
|
24
|
+
"circuit",
|
|
25
|
+
"estimate",
|
|
26
|
+
"estimate_custom",
|
|
27
|
+
"logical_counts",
|
|
28
|
+
"set_quantum_seed",
|
|
29
|
+
"set_classical_seed",
|
|
30
|
+
"dump_machine",
|
|
31
|
+
"dump_circuit",
|
|
32
|
+
# types / classes
|
|
33
|
+
"Result",
|
|
34
|
+
"Pauli",
|
|
35
|
+
"QSharpError",
|
|
36
|
+
"TargetProfile",
|
|
37
|
+
"StateDump",
|
|
38
|
+
"ShotResult",
|
|
39
|
+
"PauliNoise",
|
|
40
|
+
"DepolarizingNoise",
|
|
41
|
+
"BitFlipNoise",
|
|
42
|
+
"PhaseFlipNoise",
|
|
43
|
+
"CircuitGenerationMethod",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
# Submodules that must be importable *and* accessible as attributes
|
|
47
|
+
# on the ``qsharp`` module after a bare ``import qsharp``.
|
|
48
|
+
_EXPECTED_SUBMODULES = [
|
|
49
|
+
"code",
|
|
50
|
+
"estimator",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@pytest.fixture()
|
|
55
|
+
def qsharp_module():
|
|
56
|
+
"""Import the ``qsharp`` shim while suppressing the deprecation warning."""
|
|
57
|
+
with warnings.catch_warnings():
|
|
58
|
+
warnings.simplefilter("ignore", DeprecationWarning)
|
|
59
|
+
mod = importlib.import_module("qsharp")
|
|
60
|
+
return mod
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_deprecation_warning_on_import():
|
|
64
|
+
"""Importing ``qsharp`` must emit a DeprecationWarning."""
|
|
65
|
+
with warnings.catch_warnings(record=True) as caught:
|
|
66
|
+
warnings.simplefilter("always")
|
|
67
|
+
importlib.reload(importlib.import_module("qsharp"))
|
|
68
|
+
|
|
69
|
+
deprecations = [w for w in caught if issubclass(w.category, DeprecationWarning)]
|
|
70
|
+
assert any("qsharp" in str(w.message) for w in deprecations)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@pytest.mark.parametrize("name", _EXPECTED_SYMBOLS)
|
|
74
|
+
def test_symbol_accessible(qsharp_module, name):
|
|
75
|
+
"""Every expected symbol must be an attribute of ``qsharp``."""
|
|
76
|
+
assert hasattr(qsharp_module, name), f"qsharp.{name} is missing"
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@pytest.mark.parametrize("name", _EXPECTED_SUBMODULES)
|
|
80
|
+
def test_submodule_accessible_as_attribute(qsharp_module, name):
|
|
81
|
+
"""Submodules like ``code`` must be reachable via ``qsharp.<name>``
|
|
82
|
+
without a separate ``from qsharp import <name>``."""
|
|
83
|
+
attr = getattr(qsharp_module, name, None)
|
|
84
|
+
assert attr is not None, f"qsharp.{name} is not accessible as an attribute"
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@pytest.mark.parametrize("name", _EXPECTED_SUBMODULES)
|
|
88
|
+
def test_submodule_importable(name):
|
|
89
|
+
"""``from qsharp import <submodule>`` must work."""
|
|
90
|
+
with warnings.catch_warnings():
|
|
91
|
+
warnings.simplefilter("ignore", DeprecationWarning)
|
|
92
|
+
mod = importlib.import_module(f"qsharp.{name}")
|
|
93
|
+
assert mod is not None
|
|
File without changes
|