Repository: Qiskit/qiskit
Pull request #14423: Added support for querying version information in the Qiskit C API.
Author: login: velocityraptor7085
Labels: name: Changelog: Added
description: Add an "Added" entry in the GitHub Release changelog.
name: Intern PR
description: PR submitted by IBM Quantum interns
name: C API
description: Related to the C API
Created: 2025-05-21T13:37:08Z | Merged: 2025-05-30T16:48:10Z

<!--
⚠️ If you do not respect this template, your pull request will be closed.
⚠️ Your pull request title should be short detailed and understandable for all.
⚠️ Also, please add a release note file using reno if the change needs to be
  documented in the release notes.
⚠️ If your pull request fixes an open issue, please link to the issue.

- [ ] I have added the tests to cover my changes.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the CONTRIBUTING document.
-->

### Summary

- Updated the Qiskit C extension to enable querying the Qiskit major, minor and patch version information.
- This fixes the following open issue: https://github.com/Qiskit/qiskit/issues/14280


### Details and comments

The approach used includes the following changes:
1) Adds a file called `version.h` in the directory `crates/cext` having macros for the version information.
2) Includes the `version.h` macros in the `qiskit.h` file generated for the C API calls (added through the `cbindgen.toml` file within `crates/cext`).
3) The version information is populated into the `version.h` file by reading the `VERSION.txt` file (within the `qiskit` subdirectory) by the `build.rs` code via regex matching and replacement at compile time (for this an additional build dependency `regex = "1"` was added to the `Cargo.toml` file in the `cext` crate). The removes the need to update the header for every new release.

- All code was formatted via `cargo fmt` and passed the `tox -elint` test.
- The modified branch was tested and validated via the `test_version_info.c` file in the test/c directory.



Diff:
diff --git a/crates/cext/cbindgen.toml b/crates/cext/cbindgen.toml
index 181e04c379ad..7e405a7472a4 100644
--- a/crates/cext/cbindgen.toml
+++ b/crates/cext/cbindgen.toml
@@ -11,6 +11,13 @@ after_includes = """
 
 #include <qiskit/complex.h>
 
+#define QISKIT_VERSION_MAJOR 2
+#define QISKIT_VERSION_MINOR 1
+#define QISKIT_VERSION_PATCH 0
+
+#define QISKIT_VERSION_NUMERIC(M,m,p) ((M)<<16|(m)<<8|(p))
+#define QISKIT_VERSION (QISKIT_VERSION_MAJOR<<16 | QISKIT_VERSION_MINOR<<8 | QISKIT_VERSION_PATCH)
+
 // Always expose [cfg(feature = "cbinding")] -- workaround for
 // https://github.com/mozilla/cbindgen/issues/995
 #define QISKIT_WITH_CBINDINGS
diff --git a/releasenotes/notes/c-api-version-support-55b018bf9552db1f.yaml b/releasenotes/notes/c-api-version-support-55b018bf9552db1f.yaml
new file mode 100644
index 000000000000..eb598834f042
--- /dev/null
+++ b/releasenotes/notes/c-api-version-support-55b018bf9552db1f.yaml
@@ -0,0 +1,18 @@
+---
+features_c:
+  - |
+    Added support for querying the Qiskit version information from the C API via the following macros:
+    
+    * ``QISKIT_VERSION_MAJOR`` : Contains the major version number.
+    * ``QISKIT_VERSION_MINOR`` : Contains the minor version number.
+    * ``QISKIT_VERSION_PATCH`` : Contains the patch version number.
+    * ``QISKIT_VERSION`` : Contains a numeric representation of the version information, which can be used for comparisons.
+    * ``QISKIT_VERSION_NUMERIC(M,m,p)`` : Function-like Macro that returns the version "M.m.p" as a numeric value, which can be used for comparisons.
+
+    For example, to check if the current version is at least 2.1.0, you can use:
+
+    .. code-block: c
+
+        if (QISKIT_VERSION >= QISKIT_VERSION_NUMERIC(2, 1, 0)) {
+            // Code for version 2.1.0 or later
+        }
\ No newline at end of file
diff --git a/test/c/test_version_info.c b/test/c/test_version_info.c
new file mode 100644
index 000000000000..7b71650eb6fc
--- /dev/null
+++ b/test/c/test_version_info.c
@@ -0,0 +1,36 @@
+// This code is part of Qiskit.
+//
+// (C) Copyright IBM 2025.
+//
+// This code is licensed under the Apache License, Version 2.0. You may
+// obtain a copy of this license in the LICENSE.txt file in the root directory
+// of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
+//
+// Any modifications or derivative works of this code must retain this
+// copyright notice, and modified files need to carry a notice indicating
+// that they have been altered from the originals.
+
+#include "common.h"
+
+// Test that QISKIT_VERSION_MAJOR, _MINOR, _PATCH are defined and print them
+int test_version_macros() {
+    if (QISKIT_VERSION_MAJOR < 0 || QISKIT_VERSION_MINOR < 0 || QISKIT_VERSION_PATCH < 0) {
+        return EqualityError;
+    }
+    if (QISKIT_VERSION_NUMERIC(QISKIT_VERSION_MAJOR, QISKIT_VERSION_MINOR, QISKIT_VERSION_PATCH) !=
+        QISKIT_VERSION) {
+        fprintf(stderr, "QISKIT_VERSION_NUMERIC does not match QISKIT_VERSION\n");
+        return EqualityError;
+    }
+    return Ok;
+}
+
+// Main test function
+int test_version_info() {
+    int num_failed = 0;
+    num_failed += RUN_TEST(test_version_macros);
+
+    fprintf(stderr, "=== Number of failed subtests: %i\n", num_failed);
+    fflush(stderr);
+    return num_failed;
+}
\ No newline at end of file


Reviews:
user: login: mtreinish
body: Thanks for doing this, I think the approach you're using here is a bit more complicated than it needs to be. Couldn't we just define a couple of pub constants in the cext rust code and then tell cbindgen to include them in the header? If so then we can just use the cargo env variables to populate the version numbers appropriately.
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-21T17:13:02Z
user: login: Cryoris
body: Thanks for the updates, this generally looks good to me now. I left some small comments below.
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-28T13:01:23Z
user: login: Cryoris
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-28T13:38:42Z
user: login: velocityraptor7085
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-28T13:41:10Z
user: login: Cryoris
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-29T13:06:27Z
user: login: mtreinish
body: Thanks for doing this, I think it mostly looks good. Just one small inline question. Besides that can you add a release note to document the addition to the C API. The documentation around this is here: https://github.com/Qiskit/qiskit/blob/main/CONTRIBUTING.md#release-notes
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-29T16:29:05Z
user: login: velocityraptor7085
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-30T04:12:04Z
user: login: mtreinish
body: Just some comments on the release notes, thanks for adding them.
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-30T12:25:15Z
user: login: mtreinish
body: This LGTM now thanks for the updates. I left a small comment inline about a missing copyright header. I'll apply that and then approve this for merge.
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-30T16:03:34Z
user: login: mtreinish
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-30T16:04:12Z

Review comments:
diff_hunk: @@ -10,6 +10,13 @@ after_includes = """
     #include <Python.h>
 #endif
 
+#define QISKIT_VERSION_MAJOR 2
+#define QISKIT_VERSION_MINOR 0
+#define QISKIT_VERSION_PATCH 2
path: crates/cext/cbindgen.toml
user: login: Cryoris
body: This will be included in the 2.1.0 release 🙂 2.0.2 is just a bugfix release without any new features (like this one)
```suggestion
#define QISKIT_VERSION_MINOR 1
#define QISKIT_VERSION_PATCH 0
```
created_at: 2025-05-28T12:59:53Z
author_association: COLLABORATOR
diff_hunk: @@ -56,4 +63,4 @@ prefix_with_name = true
 "OpCounts" = "QkOpCounts"
 "OpCount" = "QkOpCount"
 "CInstruction" = "QkCircuitInstruction"
-"ExitCode" = "QkExitCode"
+"ExitCode" = "QkExitCode"
path: crates/cext/cbindgen.toml
user: login: Cryoris
body: Very minor nit: could you keep the final linebreaks inplace?
created_at: 2025-05-28T13:00:10Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,21 @@
+#include "common.h"
+
+// Test that QISKIT_VERSION_MAJOR, _MINOR, _PATCH are defined and print them
+int test_version_macros() {
path: test/c/test_version_info.c
user: login: Cryoris
body: Could you add a test for the `QISKIT_VERSION` and `QISKIT_VERSION_NUMERIC` macros?
created_at: 2025-05-28T13:01:04Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,26 @@
+#include "common.h"
+
+// Test that QISKIT_VERSION_MAJOR, _MINOR, _PATCH are defined and print them
+int test_version_macros() {
+    printf("Qiskit version: %d.%d.%d\n", QISKIT_VERSION_MAJOR, QISKIT_VERSION_MINOR,
+           QISKIT_VERSION_PATCH);
+    if (QISKIT_VERSION_MAJOR < 0 || QISKIT_VERSION_MINOR < 0 || QISKIT_VERSION_PATCH < 0) {
+        return EqualityError;
+    }
+    if (QISKIT_VERSION_NUMERIC(QISKIT_VERSION_MAJOR, QISKIT_VERSION_MINOR, QISKIT_VERSION_PATCH) !=
path: test/c/test_version_info.c
user: login: Cryoris
body: Hang on, if these are the same, why do we need the `QISKIT_VERSION_NUMERIC` macro? 🤔 
created_at: 2025-05-28T13:38:42Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,26 @@
+#include "common.h"
+
+// Test that QISKIT_VERSION_MAJOR, _MINOR, _PATCH are defined and print them
+int test_version_macros() {
+    printf("Qiskit version: %d.%d.%d\n", QISKIT_VERSION_MAJOR, QISKIT_VERSION_MINOR,
+           QISKIT_VERSION_PATCH);
+    if (QISKIT_VERSION_MAJOR < 0 || QISKIT_VERSION_MINOR < 0 || QISKIT_VERSION_PATCH < 0) {
+        return EqualityError;
+    }
+    if (QISKIT_VERSION_NUMERIC(QISKIT_VERSION_MAJOR, QISKIT_VERSION_MINOR, QISKIT_VERSION_PATCH) !=
path: test/c/test_version_info.c
user: login: velocityraptor7085
body: An application developer may use it in his code in the following manner to check for version safeness:
if (QISKIT_VERSION >= QISKIT_VERSION_NUMERIC(2,1,0)) { ... }
created_at: 2025-05-28T13:41:09Z
author_association: CONTRIBUTOR
diff_hunk: @@ -9,6 +9,33 @@ after_includes = """
     #include <Python.h>
 #endif
 
+#define QISKIT_VERSION_MAJOR 2
+#define QISKIT_VERSION_MINOR 1
+#define QISKIT_VERSION_PATCH 0
+
+#define QISKIT_VERSION_NUMERIC(M,m,p) ((M)<<16|(m)<<8|(p))
+#define QISKIT_VERSION (QISKIT_VERSION_MAJOR<<16 | QISKIT_VERSION_MINOR<<8 | QISKIT_VERSION_PATCH)
+
+// Complex number typedefs -- note these are memory aligned but
+// not calling convention compatible.
+#ifdef __cplusplus
+#include <complex>
+
+typedef std::complex<float> QkComplex32;
+typedef std::complex<double> QkComplex64;
+#else  //__cplusplus
+#include "complex.h"
+
+#ifdef _MSC_VER
+typedef _Fcomplex QkComplex32;
+typedef _Dcomplex QkComplex64;
+#else
+typedef float complex QkComplex32;
+typedef double complex QkComplex64;
+#endif
+
+#endif  //__cplusplus
+
path: crates/cext/cbindgen.toml
user: login: Cryoris
body: These don't belong here, that's probably a merge artifact 🙂 
```suggestion
```
created_at: 2025-05-29T13:06:27Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,26 @@
+#include "common.h"
+
+// Test that QISKIT_VERSION_MAJOR, _MINOR, _PATCH are defined and print them
+int test_version_macros() {
+    printf("Qiskit version: %d.%d.%d\n", QISKIT_VERSION_MAJOR, QISKIT_VERSION_MINOR,
+           QISKIT_VERSION_PATCH);
path: test/c/test_version_info.c
user: login: mtreinish
body: Should we be printing this without a condition? I wouldn't expect anything to be written to stdout on success.
created_at: 2025-05-29T16:27:06Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,26 @@
+#include "common.h"
+
+// Test that QISKIT_VERSION_MAJOR, _MINOR, _PATCH are defined and print them
+int test_version_macros() {
+    printf("Qiskit version: %d.%d.%d\n", QISKIT_VERSION_MAJOR, QISKIT_VERSION_MINOR,
+           QISKIT_VERSION_PATCH);
path: test/c/test_version_info.c
user: login: velocityraptor7085
body: Yes that makes sense, I just removed the print statement since they are tested anyways in the next line of code. Thank you.
created_at: 2025-05-30T04:12:04Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,20 @@
+---
+features_c:
+  - |
+    Added support for querying the Qiskit version information from the C API via the following macros:
+    - `QISKIT_VERSION_MAJOR` : Contains the major version number.
+    - `QISKIT_VERSION_MINOR` : Contains the minor version number.
+    - `QISKIT_VERSION_PATCH` : Contains the patch version number.
+    - `QISKIT_VERSION` : Contains a numeric representation of the version information, which can be used for comparisons.
+    - `QISKIT_VERSION_NUMERIC(M,m,p)` : Function-like Macro that returns the version "M.m.p" as a numeric value, which can be used for comparisons.
+
+    for example, to check if the current version is at least 2.1.0, you can use:
+    ```c
+    if (QISKIT_VERSION >= QISKIT_VERSION_NUMERIC(2, 1, 0)) {
+        // Code for version 2.1.0 or later
+    }
+    ```
path: releasenotes/notes/c-api-version-support-55b018bf9552db1f.yaml
user: login: mtreinish
body: The reno release notes use sphinx and restructured text. So the markdown formatting you used here won't render correctly:

```suggestion
features_c:
  - |
    Added support for querying the Qiskit version information from the C API via the following macros:
    
    * ``QISKIT_VERSION_MAJOR`` : Contains the major version number.
    * ``QISKIT_VERSION_MINOR`` : Contains the minor version number.
    * ``QISKIT_VERSION_PATCH`` : Contains the patch version number.
    * ``QISKIT_VERSION`` : Contains a numeric representation of the version information, which can be used for comparisons.
    * ``QISKIT_VERSION_NUMERIC(M,m,p)`` : Function-like Macro that returns the version "M.m.p" as a numeric value, which can be used for comparisons.

    For example, to check if the current version is at least 2.1.0, you can use:

    .. code-block: c

        if (QISKIT_VERSION >= QISKIT_VERSION_NUMERIC(2, 1, 0)) {
            // Code for version 2.1.0 or later
        }
```
created_at: 2025-05-30T12:24:30Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,20 @@
+---
+features_c:
+  - |
+    Added support for querying the Qiskit version information from the C API via the following macros:
+    - `QISKIT_VERSION_MAJOR` : Contains the major version number.
+    - `QISKIT_VERSION_MINOR` : Contains the minor version number.
+    - `QISKIT_VERSION_PATCH` : Contains the patch version number.
+    - `QISKIT_VERSION` : Contains a numeric representation of the version information, which can be used for comparisons.
+    - `QISKIT_VERSION_NUMERIC(M,m,p)` : Function-like Macro that returns the version "M.m.p" as a numeric value, which can be used for comparisons.
+
+    for example, to check if the current version is at least 2.1.0, you can use:
+    ```c
+    if (QISKIT_VERSION >= QISKIT_VERSION_NUMERIC(2, 1, 0)) {
+        // Code for version 2.1.0 or later
+    }
+    ```
+fixes:
+  - |
+    This fixes the issue where there is currently no way to query the Qiskit version information from the C API.
+    Refer to `#14280 <https://github.com/Qiskit/qiskit/issues/14280>` for more details.
path: releasenotes/notes/c-api-version-support-55b018bf9552db1f.yaml
user: login: mtreinish
body: You don't need a fix note here. This is just a new feature.
```suggestion
```
created_at: 2025-05-30T12:25:00Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,24 @@
+#include "common.h"
path: test/c/test_version_info.c
user: login: mtreinish
body: This is missing a copyright and license header. This is pointing out a gap in our CI that we're not enforcing this on the C test files. 

```suggestion
// This code is part of Qiskit.
//
// (C) Copyright IBM 2025.
//
// This code is licensed under the Apache License, Version 2.0. You may
// obtain a copy of this license in the LICENSE.txt file in the root directory
// of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
//
// Any modifications or derivative works of this code must retain this
// copyright notice, and modified files need to carry a notice indicating
// that they have been altered from the originals.

#include "common.h"
```
created_at: 2025-05-30T16:03:03Z
author_association: MEMBER

PR comments:
user: login: qiskit-bot
created_at: 2025-05-21T13:37:13Z
body: Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the following people are relevant to this code:
- `@Qiskit/terra-core`

author_association: COLLABORATOR
user: login: CLAassistant
created_at: 2025-05-21T13:37:14Z
body: [![CLA assistant check](https://cla-assistant.io/pull/badge/signed)](https://cla-assistant.io/Qiskit/qiskit?pullRequest=14423) <br/>All committers have signed the CLA.
author_association: NONE
user: login: CLAassistant
created_at: 2025-05-21T13:37:16Z
body: [![CLA assistant check](https://cla-assistant.io/pull/badge/not_signed)](https://cla-assistant.io/Qiskit/qiskit?pullRequest=14423) <br/>Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our [Contributor License Agreement](https://cla-assistant.io/Qiskit/qiskit?pullRequest=14423) before we can accept your contribution.<br/>**1** out of **2** committers have signed the CLA.<br/><br/>:white_check_mark: velocityraptor7085<br/>:x: Archit Chadalawada<br/><hr/>**Archit Chadalawada** seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please [add the email address used for this commit to your account](https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/#commits-are-not-linked-to-any-user).<br/><sub>You have signed the CLA already but the status is still pending? Let us [recheck](https://cla-assistant.io/check/Qiskit/qiskit?pullRequest=14423) it.</sub>
author_association: NONE
user: login: mtreinish
created_at: 2025-05-21T17:14:48Z
body: Oh also you appear to have authored commits with a different email address not associated with your github account. You'll either need to associate that email account to your github account, or edit the commits on your branch to reset the author metadata to use the correct email address and force push that updated history to your PR's branch on your fork. We won't be able to merge a PR if the CLA bot isn't all green.
author_association: MEMBER
user: login: velocityraptor7085
created_at: 2025-05-22T02:24:24Z
body: Okay, I am working on it. 👍
author_association: CONTRIBUTOR
user: login: velocityraptor7085
created_at: 2025-05-22T04:39:11Z
body: I have updated the code as well as force pushed the correct author information.

### Summary

- Updated the Qiskit C extension to enable querying the Qiskit major, minor and patch version information.
- This fixes the following open issue: https://github.com/Qiskit/qiskit/issues/14280

### Details and comments

The approach used includes the following changes:
1) Added macros for numerical Qiskit versions in the `cbindgen.toml` file (within `crates/cext`).
2) Updated the `build.rs` file in the `crates/cext` directory to fetch version information at compile-time via the `CARGO_PKG_VERSION_...` environment variables.

This enables the `cbindgen.toml` file to directly include the version-related macros in the generated `qiskit.h` header file, thereby making it directly accessible via the Qiskit C API.

Please let me know if this approach is okay.
Thank you.
author_association: CONTRIBUTOR
user: login: Cryoris
created_at: 2025-05-23T07:39:03Z
body: I'm not super sure about this approach, since we effectively end up with some version number committed in `cbindgen.toml` and dynamically overwrite them. So when we update Qiskit, we either (1) end up with an out-of-date version in `cbindgen.toml` or (2) manually update it, but then we wouldn't need the dynamic overwrite in the first place.

I was hoping we could have a solution where we could dynamically add the version numbers to the header, but after scouting the cbindgen docs I couldn't find anything suitable that allows to extend e.g. the `after_includes` (only to replace it completely). 

I'm wondering whether at this point it wouldn't just be easier to hardcode the version number? Or a compromise, if we want to stick with the cargo-generated version, we could maybe have a placeholder comment in the `after_includes` of `cbindgen.toml` that doesn't hardcode version numbers. (@velocityraptor7085 nothing you have to change yet, this is to discuss with @mtreinish first 🙂)
author_association: COLLABORATOR
user: login: velocityraptor7085
created_at: 2025-05-23T08:31:42Z
body: Sure @Cryoris . Actually, the `cbindgen.toml` was initially having a placeholder (not hardcoded values) which were defined. The idea was that whenever the `make c` command was run by the user, the up-to-date Qiskit version (as part of the environment variables) will overwrite whatever comes after the `#define ...` in the `after_includes` section of the `cbindgen.toml` (The logic for dynamically writing this is in the `build.rs` file).

So, If you try testing this by removing the version numbers from the `cbindgen.toml` and re-running `make c`, the version numbers should automatically be populated. I can update the `cbindgen.toml` with some placeholder like `@` or something else suitable to avoid any ambiguity.

Please let me know in case I am missing something.
Thank you.
author_association: CONTRIBUTOR
user: login: Cryoris
created_at: 2025-05-27T14:19:46Z
body: We discussed offline with @mtreinish and came to the conclusion that it's probably simpler to just hardcode the version number, without any additional cbindgen logic. That is partially motivated by #14430, which we'll likely change to sooner than later, which drops cbindgen anyways. Could you update the code accordingly? 🙂 
author_association: COLLABORATOR
user: login: velocityraptor7085
created_at: 2025-05-28T05:09:58Z
body: Okay @Cryoris. I have updated the code to use the hard-coded version information directly without any additional logic related to `cbindgen.toml`. Let me know if this works. Thank you.
author_association: CONTRIBUTOR
user: login: velocityraptor7085
created_at: 2025-05-28T13:41:25Z
body: Thank you so much! 🙂 I have made the suggested changes @Cryoris.
BTW, I'm just curious as to why it's a convention to leave an empty blank line at the end of the `cbindgen.toml` as I am not very experienced with this.
author_association: CONTRIBUTOR
user: login: Cryoris
created_at: 2025-05-29T13:09:39Z
body: @velocityraptor7085 the history of this PR includes some commits that don't belong here (e.g. [beeb97c](https://github.com/Qiskit/qiskit/pull/14423/commits/beeb97cd28bda9eb77e3227e7619e26edf0efdd2)). Would you mind rebasing to remove these or just clean the history? 

> BTW, I'm just curious as to why it's a convention to leave an empty blank line at the end of the cbindgen.toml as I am not very experienced with this.

It's often considered good practice because some tools expect the last line to be a linebreak (see e.g. https://stackoverflow.com/questions/2287967/why-is-it-recommended-to-have-empty-line-in-the-end-of-a-source-file)

Another note: you don't have to keep updating your branch with the `main` version, that's not required to merge your PR and it keeps triggering CI to run 🙂 
author_association: COLLABORATOR
user: login: Cryoris
created_at: 2025-05-29T13:46:36Z
body: Also, let us know if you need help cleaning up the history.
author_association: COLLABORATOR
user: login: velocityraptor7085
created_at: 2025-05-29T14:24:21Z
body: Thanks a lot. I just made the changes. Let me know if the changes are good to go.
author_association: CONTRIBUTOR
user: login: coveralls
created_at: 2025-05-29T14:55:29Z
body: ## Pull Request Test Coverage Report for [Build 15350808054](https://coveralls.io/builds/73925039)

### Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

- For more information on this, see <a target="_blank" href="https://docs.coveralls.io/build-types#tracking-coverage-changes-with-pull_request-builds">Tracking coverage changes with pull request builds</a>.
- To avoid this issue with future PRs, see these <a target="_blank" href="https://docs.coveralls.io/build-types#recommended-ci-configurations">Recommended CI Configurations</a>.
- For a quick fix, <a target="_blank" href="https://github.blog/changelog/2022-02-03-more-ways-to-keep-your-pull-request-branch-up-to-date/#update-your-pull-request-branch-by-rebasing">rebase this PR at GitHub</a>. Your next report should be accurate.

### Details

* **0** of **0**   changed or added relevant lines in **0** files are covered.
* **533** unchanged lines in **14** files lost coverage.
* Overall coverage increased (+**0.02%**) to **87.861%**

---


|  Files with Coverage Reduction | New Missed Lines | % |
| :-----|--------------|--: |
| [crates/transpiler/src/passes/unitary_synthesis.rs](https://coveralls.io/builds/73925039/source?filename=crates%2Ftranspiler%2Fsrc%2Fpasses%2Funitary_synthesis.rs#L1385) | 1 | 94.57% |
| [qiskit/circuit/library/pauli_evolution.py](https://coveralls.io/builds/73925039/source?filename=qiskit%2Fcircuit%2Flibrary%2Fpauli_evolution.py#L153) | 2 | 96.49% |
| [qiskit/result/sampled_expval.py](https://coveralls.io/builds/73925039/source?filename=qiskit%2Fresult%2Fsampled_expval.py#L50) | 2 | 93.55% |
| [crates/qasm2/src/lex.rs](https://coveralls.io/builds/73925039/source?filename=crates%2Fqasm2%2Fsrc%2Flex.rs#L202) | 3 | 93.23% |
| [qiskit/synthesis/evolution/suzuki_trotter.py](https://coveralls.io/builds/73925039/source?filename=qiskit%2Fsynthesis%2Fevolution%2Fsuzuki_trotter.py#L31) | 4 | 90.38% |
| [qiskit/synthesis/evolution/qdrift.py](https://coveralls.io/builds/73925039/source?filename=qiskit%2Fsynthesis%2Fevolution%2Fqdrift.py#L30) | 5 | 86.49% |
| [qiskit/synthesis/evolution/product_formula.py](https://coveralls.io/builds/73925039/source?filename=qiskit%2Fsynthesis%2Fevolution%2Fproduct_formula.py#L34) | 7 | 89.9% |
| [qiskit/transpiler/instruction_durations.py](https://coveralls.io/builds/73925039/source?filename=qiskit%2Ftranspiler%2Finstruction_durations.py#L101) | 8 | 85.59% |
| [qiskit/circuit/quantumcircuitdata.py](https://coveralls.io/builds/73925039/source?filename=qiskit%2Fcircuit%2Fquantumcircuitdata.py#L55) | 10 | 80.82% |
| [crates/quantum_info/src/sparse_observable/mod.rs](https://coveralls.io/builds/73925039/source?filename=crates%2Fquantum_info%2Fsrc%2Fsparse_observable%2Fmod.rs#L2667) | 15 | 94.16% |
<!-- | **Total:** | **533** |  | -->

|  Totals | [![Coverage Status](https://coveralls.io/builds/73925039/badge)](https://coveralls.io/builds/73925039) |
| :-- | --: |
| Change from base [Build 15312889782](https://coveralls.io/builds/73895022): |  0.02% |
| Covered Lines: | 80415 |
| Relevant Lines: | 91525 |

---
##### 💛  - [Coveralls](https://coveralls.io)

author_association: NONE
user: login: velocityraptor7085
created_at: 2025-05-30T04:13:57Z
body: Okay I'll have a look and add a release note 👍
author_association: CONTRIBUTOR
user: login: velocityraptor7085
created_at: 2025-05-30T04:41:50Z
body: @mtreinish Please let me know if the changes are appropriate. Thank you.
author_association: CONTRIBUTOR
user: login: velocityraptor7085
created_at: 2025-05-30T14:03:49Z
body: Thanks a lot for your help @mtreinish !
author_association: CONTRIBUTOR