classiq 0.51.1__py3-none-any.whl → 0.52.0__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.
- classiq/_internals/api_wrapper.py +41 -15
- classiq/_internals/authentication/auth0.py +20 -4
- classiq/_internals/authentication/password_manager.py +16 -4
- classiq/_internals/client.py +2 -2
- classiq/_internals/host_checker.py +5 -3
- classiq/_internals/jobs.py +3 -3
- classiq/analyzer/analyzer_utilities.py +1 -1
- classiq/applications/chemistry/ground_state_problem.py +1 -1
- classiq/applications/combinatorial_helpers/pyomo_utils.py +3 -1
- classiq/applications/qnn/gradients/quantum_gradient.py +1 -1
- classiq/applications/qnn/qlayer.py +2 -2
- classiq/execution/__init__.py +3 -0
- classiq/execution/execution_session.py +2 -2
- classiq/execution/iqcc.py +63 -0
- classiq/execution/jobs.py +2 -2
- classiq/executor.py +2 -2
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/analysis_params.py +19 -9
- classiq/interface/analyzer/cytoscape_graph.py +10 -3
- classiq/interface/analyzer/result.py +6 -5
- classiq/interface/applications/qsvm.py +13 -12
- classiq/interface/backend/backend_preferences.py +78 -105
- classiq/interface/backend/ionq/ionq_quantum_program.py +12 -19
- classiq/interface/backend/pydantic_backend.py +24 -12
- classiq/interface/backend/quantum_backend_providers.py +2 -0
- classiq/interface/chemistry/fermionic_operator.py +7 -7
- classiq/interface/chemistry/ground_state_problem.py +23 -18
- classiq/interface/chemistry/molecule.py +10 -5
- classiq/interface/chemistry/operator.py +71 -44
- classiq/interface/combinatorial_optimization/mht_qaoa_input.py +2 -1
- classiq/interface/debug_info/debug_info.py +3 -4
- classiq/interface/execution/iqcc.py +21 -0
- classiq/interface/execution/jobs.py +10 -10
- classiq/interface/executor/aws_execution_cost.py +37 -20
- classiq/interface/executor/execution_preferences.py +1 -2
- classiq/interface/executor/execution_request.py +2 -2
- classiq/interface/executor/execution_result.py +4 -2
- classiq/interface/executor/iqae_result.py +1 -1
- classiq/interface/executor/optimizer_preferences.py +14 -10
- classiq/interface/executor/quantum_code.py +21 -16
- classiq/interface/executor/register_initialization.py +10 -10
- classiq/interface/executor/result.py +19 -16
- classiq/interface/executor/vqe_result.py +1 -1
- classiq/interface/finance/function_input.py +27 -18
- classiq/interface/finance/log_normal_model_input.py +2 -2
- classiq/interface/finance/model_input.py +3 -2
- classiq/interface/generator/amplitude_loading.py +8 -6
- classiq/interface/generator/arith/argument_utils.py +24 -0
- classiq/interface/generator/arith/arithmetic.py +5 -3
- classiq/interface/generator/arith/arithmetic_expression_abc.py +36 -14
- classiq/interface/generator/arith/arithmetic_operations.py +6 -3
- classiq/interface/generator/arith/binary_ops.py +88 -63
- classiq/interface/generator/arith/extremum_operations.py +22 -13
- classiq/interface/generator/arith/logical_ops.py +6 -4
- classiq/interface/generator/arith/number_utils.py +3 -3
- classiq/interface/generator/arith/register_user_input.py +32 -17
- classiq/interface/generator/arith/unary_ops.py +5 -4
- classiq/interface/generator/chemistry_function_params.py +2 -1
- classiq/interface/generator/circuit_code/circuit_code.py +2 -1
- classiq/interface/generator/commuting_pauli_exponentiation.py +6 -5
- classiq/interface/generator/complex_type.py +14 -18
- classiq/interface/generator/control_state.py +32 -26
- classiq/interface/generator/expressions/expression.py +6 -5
- classiq/interface/generator/function_params.py +22 -39
- classiq/interface/generator/functions/classical_function_declaration.py +1 -1
- classiq/interface/generator/functions/classical_type.py +32 -23
- classiq/interface/generator/functions/concrete_types.py +8 -7
- classiq/interface/generator/functions/function_declaration.py +4 -5
- classiq/interface/generator/functions/type_name.py +5 -4
- classiq/interface/generator/generated_circuit_data.py +9 -6
- classiq/interface/generator/grover_diffuser.py +26 -18
- classiq/interface/generator/grover_operator.py +32 -22
- classiq/interface/generator/hamiltonian_evolution/exponentiation.py +3 -4
- classiq/interface/generator/hamiltonian_evolution/qdrift.py +4 -4
- classiq/interface/generator/hamiltonian_evolution/suzuki_trotter.py +8 -7
- classiq/interface/generator/hardware/hardware_data.py +27 -26
- classiq/interface/generator/hardware_efficient_ansatz.py +11 -6
- classiq/interface/generator/hartree_fock.py +2 -1
- classiq/interface/generator/identity.py +7 -2
- classiq/interface/generator/linear_pauli_rotations.py +27 -14
- classiq/interface/generator/mcu.py +15 -12
- classiq/interface/generator/mcx.py +18 -10
- classiq/interface/generator/model/constraints.py +4 -2
- classiq/interface/generator/model/model.py +2 -1
- classiq/interface/generator/model/preferences/preferences.py +30 -32
- classiq/interface/generator/oracles/custom_oracle.py +13 -10
- classiq/interface/generator/piecewise_linear_amplitude_loading.py +37 -21
- classiq/interface/generator/qpe.py +38 -26
- classiq/interface/generator/qsvm.py +4 -4
- classiq/interface/generator/quantum_function_call.py +57 -44
- classiq/interface/generator/quantum_program.py +8 -6
- classiq/interface/generator/range_types.py +10 -11
- classiq/interface/generator/standard_gates/controlled_standard_gates.py +9 -5
- classiq/interface/generator/standard_gates/standard_angle_metaclass.py +2 -6
- classiq/interface/generator/standard_gates/u_gate.py +7 -10
- classiq/interface/generator/state_preparation/computational_basis_state_preparation.py +2 -1
- classiq/interface/generator/state_preparation/distributions.py +12 -12
- classiq/interface/generator/state_preparation/state_preparation.py +22 -16
- classiq/interface/generator/types/enum_declaration.py +2 -1
- classiq/interface/generator/ucc.py +2 -1
- classiq/interface/generator/unitary_gate.py +2 -1
- classiq/interface/generator/user_defined_function_params.py +3 -0
- classiq/interface/generator/visitor.py +1 -1
- classiq/interface/hardware.py +18 -3
- classiq/interface/helpers/custom_pydantic_types.py +38 -47
- classiq/interface/helpers/pydantic_model_helpers.py +3 -2
- classiq/interface/helpers/versioned_model.py +1 -4
- classiq/interface/ide/ide_data.py +5 -5
- classiq/interface/ide/visual_model.py +5 -5
- classiq/interface/interface_version.py +1 -1
- classiq/interface/jobs.py +12 -22
- classiq/interface/model/bind_operation.py +2 -1
- classiq/interface/model/classical_parameter_declaration.py +10 -4
- classiq/interface/model/handle_binding.py +20 -24
- classiq/interface/model/inplace_binary_operation.py +16 -9
- classiq/interface/model/model.py +21 -11
- classiq/interface/model/port_declaration.py +10 -7
- classiq/interface/model/quantum_expressions/arithmetic_operation.py +6 -4
- classiq/interface/model/quantum_function_declaration.py +22 -11
- classiq/interface/model/quantum_statement.py +6 -7
- classiq/interface/model/quantum_type.py +22 -19
- classiq/interface/model/statement_block.py +9 -9
- classiq/interface/server/global_versions.py +4 -5
- classiq/interface/server/routes.py +8 -0
- classiq/model_expansions/evaluators/parameter_types.py +3 -3
- classiq/model_expansions/expression_renamer.py +1 -1
- classiq/model_expansions/quantum_operations/control.py +11 -12
- classiq/model_expansions/quantum_operations/emitter.py +22 -0
- classiq/model_expansions/quantum_operations/expression_operation.py +2 -20
- classiq/model_expansions/quantum_operations/inplace_binary_operation.py +38 -9
- classiq/model_expansions/quantum_operations/invert.py +1 -1
- classiq/model_expansions/quantum_operations/phase.py +4 -5
- classiq/model_expansions/quantum_operations/power.py +1 -1
- classiq/model_expansions/quantum_operations/quantum_assignment_operation.py +50 -9
- classiq/model_expansions/quantum_operations/variable_decleration.py +2 -2
- classiq/model_expansions/quantum_operations/within_apply.py +1 -1
- classiq/qmod/builtins/__init__.py +1 -3
- classiq/qmod/builtins/functions/__init__.py +4 -0
- classiq/qmod/builtins/functions/arithmetic.py +10 -0
- classiq/qmod/create_model_function.py +4 -4
- classiq/qmod/quantum_expandable.py +22 -9
- classiq/qmod/quantum_function.py +1 -1
- classiq/qmod/semantics/static_semantics_visitor.py +3 -1
- classiq/qmod/type_attribute_remover.py +1 -1
- classiq/qmod/write_qmod.py +2 -4
- classiq/synthesis.py +11 -13
- {classiq-0.51.1.dist-info → classiq-0.52.0.dist-info}/METADATA +3 -2
- {classiq-0.51.1.dist-info → classiq-0.52.0.dist-info}/RECORD +149 -147
- {classiq-0.51.1.dist-info → classiq-0.52.0.dist-info}/WHEEL +0 -0
classiq/qmod/write_qmod.py
CHANGED
@@ -31,14 +31,12 @@ def write_qmod(
|
|
31
31
|
None
|
32
32
|
"""
|
33
33
|
|
34
|
-
model = Model.
|
34
|
+
model = Model.model_validate_json(serialized_model)
|
35
35
|
pretty_printed_model = DSLPrettyPrinter(decimal_precision=decimal_precision).visit(
|
36
36
|
model
|
37
37
|
)
|
38
38
|
|
39
|
-
synthesis_options = model.
|
40
|
-
include={"constraints", "preferences"}, exclude_unset=True
|
41
|
-
)
|
39
|
+
synthesis_options = model.model_dump(include={"constraints", "preferences"})
|
42
40
|
|
43
41
|
synthesis_options_path = Path(f"{name}.{_SYNTHESIS_OPTIONS_SUFFIX}")
|
44
42
|
if directory is not None:
|
classiq/synthesis.py
CHANGED
@@ -32,8 +32,8 @@ def show(quantum_program: SerializedQuantumProgram) -> None:
|
|
32
32
|
[Visualization tool](https://docs.classiq.io/latest/reference-manual/analyzer/quantum-program-visualization-tool/)
|
33
33
|
"""
|
34
34
|
try:
|
35
|
-
circuit = QuantumProgram.
|
36
|
-
except pydantic.
|
35
|
+
circuit = QuantumProgram.model_validate_json(quantum_program)
|
36
|
+
except pydantic.ValidationError as exc:
|
37
37
|
raise ClassiqValueError(CANT_PARSE_QUANTUM_PROGRAM_MSG) from exc
|
38
38
|
circuit.show() # type: ignore[attr-defined]
|
39
39
|
|
@@ -42,7 +42,7 @@ async def quantum_program_from_qasm_async(qasm: str) -> SerializedQuantumProgram
|
|
42
42
|
quantum_program = await ApiWrapper.get_generated_circuit_from_qasm(
|
43
43
|
QasmCode(code=qasm)
|
44
44
|
)
|
45
|
-
return SerializedQuantumProgram(quantum_program.
|
45
|
+
return SerializedQuantumProgram(quantum_program.model_dump_json())
|
46
46
|
|
47
47
|
|
48
48
|
def quantum_program_from_qasm(qasm: str) -> SerializedQuantumProgram:
|
@@ -61,9 +61,9 @@ def quantum_program_from_qasm(qasm: str) -> SerializedQuantumProgram:
|
|
61
61
|
async def synthesize_async(
|
62
62
|
serialized_model: SerializedModel,
|
63
63
|
) -> SerializedQuantumProgram:
|
64
|
-
model =
|
64
|
+
model = Model.model_validate_json(serialized_model)
|
65
65
|
quantum_program = await ApiWrapper.call_generation_task(model)
|
66
|
-
return SerializedQuantumProgram(quantum_program.
|
66
|
+
return SerializedQuantumProgram(quantum_program.model_dump_json(indent=2))
|
67
67
|
|
68
68
|
|
69
69
|
def synthesize(
|
@@ -109,7 +109,7 @@ def set_preferences(
|
|
109
109
|
"Missing preferences. Either pass `Preferences` object or pass keywords"
|
110
110
|
)
|
111
111
|
|
112
|
-
model =
|
112
|
+
model = Model.model_validate_json(serialized_model)
|
113
113
|
model.preferences = preferences
|
114
114
|
return model.get_model()
|
115
115
|
|
@@ -127,11 +127,10 @@ def update_preferences(
|
|
127
127
|
Returns:
|
128
128
|
SerializedModel: The updated model with the new preferences applied.
|
129
129
|
"""
|
130
|
-
model =
|
130
|
+
model = Model.model_validate_json(serialized_model)
|
131
131
|
|
132
132
|
for key, value in kwargs.items():
|
133
133
|
setattr(model.preferences, key, value)
|
134
|
-
|
135
134
|
return model.get_model()
|
136
135
|
|
137
136
|
|
@@ -158,7 +157,7 @@ def set_constraints(
|
|
158
157
|
"Missing constraints. Either pass `Constraints` object or pass keywords"
|
159
158
|
)
|
160
159
|
|
161
|
-
model =
|
160
|
+
model = Model.model_validate_json(serialized_model)
|
162
161
|
model.constraints = constraints
|
163
162
|
return model.get_model()
|
164
163
|
|
@@ -176,11 +175,10 @@ def update_constraints(
|
|
176
175
|
Returns:
|
177
176
|
SerializedModel: The updated model with the new constraints applied.
|
178
177
|
"""
|
179
|
-
model =
|
178
|
+
model = Model.model_validate_json(serialized_model)
|
180
179
|
|
181
180
|
for key, value in kwargs.items():
|
182
181
|
setattr(model.constraints, key, value)
|
183
|
-
|
184
182
|
return model.get_model()
|
185
183
|
|
186
184
|
|
@@ -208,7 +206,7 @@ def set_execution_preferences(
|
|
208
206
|
"Missing execution_preferences. Either pass `ExecutionPreferences` object or pass keywords"
|
209
207
|
)
|
210
208
|
|
211
|
-
model =
|
209
|
+
model = Model.model_validate_json(serialized_model)
|
212
210
|
model.execution_preferences = execution_preferences
|
213
211
|
return model.get_model()
|
214
212
|
|
@@ -226,7 +224,7 @@ def update_execution_preferences(
|
|
226
224
|
Returns:
|
227
225
|
SerializedModel: The updated model with the new execution_preferences applied.
|
228
226
|
"""
|
229
|
-
model =
|
227
|
+
model = Model.model_validate_json(serialized_model)
|
230
228
|
|
231
229
|
for key, value in kwargs.items():
|
232
230
|
setattr(model.execution_preferences, key, value)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: classiq
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.52.0
|
4
4
|
Summary: Classiq's Python SDK for quantum computing
|
5
5
|
Home-page: https://classiq.io
|
6
6
|
License: Proprietary
|
@@ -46,7 +46,8 @@ Requires-Dist: numpy (>=1.26.0,<2.0.0) ; python_version >= "3.12"
|
|
46
46
|
Requires-Dist: packaging (>=23.2,<24.0)
|
47
47
|
Requires-Dist: pandas (>=1.4.0,<3.0.0)
|
48
48
|
Requires-Dist: plotly (>=5.7.0,<6.0.0)
|
49
|
-
Requires-Dist: pydantic (>=
|
49
|
+
Requires-Dist: pydantic (>=2.9.0,<3.0.0)
|
50
|
+
Requires-Dist: pydantic-settings (>=2.4.0,<3.0.0)
|
50
51
|
Requires-Dist: scipy (>=1.10.0,<2.0.0) ; python_version < "3.12"
|
51
52
|
Requires-Dist: scipy (>=1.11.0,<2.0.0) ; python_version >= "3.12"
|
52
53
|
Requires-Dist: sympy (>=1.13.0,<2.0.0)
|