Skip to content

Add details on the C API to the project README#16192

Merged
jakelishman merged 6 commits into
Qiskit:mainfrom
mtreinish:add-c-to-the-readme
May 18, 2026
Merged

Add details on the C API to the project README#16192
jakelishman merged 6 commits into
Qiskit:mainfrom
mtreinish:add-c-to-the-readme

Conversation

@mtreinish
Copy link
Copy Markdown
Member

Arguably the largest development in Qiskit since the 2.0.0 release was the introduction of the C API. This changed how Qiskit is consumable from solely via Python to any environment that can use a C shared library. This expanded the scope and potential user base of Qiskit quite substantially. However, a clear oversight was that the C API is not at all mentioned in the README. This corrects the oversight and adds an explanation that the two public APIs are for Python and C and also installation instructions for the standalone C API.

AI/LLM disclosure

  • I didn't use LLM tooling, or only used it privately.
  • I used the following tool to help write this PR description:
  • I used the following tool to generate or modify code:

@mtreinish mtreinish requested a review from a team as a code owner May 15, 2026 19:58
@mtreinish mtreinish requested a review from jakelishman May 15, 2026 19:58
@mtreinish mtreinish added documentation Something is not clear or an error documentation stable backport potential Make Mergify open a backport PR to the most recent stable branch on merge. Changelog: None Do not include in the GitHub Release changelog. C API Related to the C API labels May 15, 2026
@qiskit-bot
Copy link
Copy Markdown
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@mtreinish mtreinish force-pushed the add-c-to-the-readme branch from 255a331 to 6aa3e29 Compare May 15, 2026 20:07
Arguably the largest development in Qiskit since the 2.0.0 release was
the introduction of the C API. This changed how Qiskit is consumable
from solely via Python to any environment that can use a C shared
library. This expanded the scope and potential user base of Qiskit
quite substantially. However, a clear oversight was that the C API is
not at all mentioned in the README. This corrects the oversight and
adds an explanation that the two public APIs are for Python and C and
also installation instructions for the standalone C API.
@mtreinish mtreinish force-pushed the add-c-to-the-readme branch from 6aa3e29 to 6e7a29f Compare May 15, 2026 20:07
@coveralls
Copy link
Copy Markdown

coveralls commented May 15, 2026

Coverage Report for CI Build 26042851897

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage decreased (-0.01%) to 87.698%

Details

  • Coverage decreased (-0.01%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 47 coverage regressions across 5 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

47 previously-covered lines in 5 files lost coverage.

File Lines Losing Coverage Coverage
qiskit/circuit/library/generalized_gates/linear_function.py 15 85.25%
crates/transpiler/src/passes/commutative_optimization.rs 13 96.75%
crates/circuit/src/parameter/symbol_expr.rs 12 73.84%
crates/qasm2/src/lex.rs 6 91.77%
crates/transpiler/src/passes/unitary_synthesis/decomposers.rs 1 94.71%

Coverage Stats

Coverage Status
Relevant Lines: 123047
Covered Lines: 107910
Line Coverage: 87.7%
Coverage Strength: 955897.71 hits per line

💛 - Coveralls

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment on lines 30 to +57
@@ -32,6 +39,22 @@ Pip will handle all dependencies automatically and you will always install the l

To install from source, follow the instructions in the [documentation](https://quantum.cloud.ibm.com/docs/guides/install-qiskit-source).

### Standalone C library

To install Qiskit as a standalone C library the only option is currently to build Qiskit from source. This requires having the
[Rust](https://rust-lang.org/) compiler installed. To simplify building having [GNU Make](https://www.gnu.org/software/make/) installed
is recommended. With these requirements installed you can run:

```bash
make c
```

Which will compile the C library and put the `dist/c` directory in the root of the repository which will contain the shared library and C headers for
library.

You can refer to the [documentation](https://quantum.cloud.ibm.com/docs/en/guides/install-c-api) on installing the C API for more details and how to
use the built library.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is your intention to change this once we've sorted out the distribution story for C? It's a bit weird having such a large asymmetry.

Even within that: perhaps we should just link to the canonical "build from source" instructions for C in the contributing guide, rather than duplicating them (and the requirements) on the main landing page.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I wanted to make sure we had some instructions for the time being. But once we have a better distribution story that would replace this and we can just link to the build from source instruction.

Comment thread README.md
Comment thread README.md Outdated
@mtreinish mtreinish requested a review from jakelishman May 18, 2026 15:15
Comment thread README.md Outdated
Copy link
Copy Markdown
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think we've slightly overdone the "build from source" detail in the "install the C API" section of the README, but I'm not that bothered since we intend to change it once we've got distributable artifacts anyway.

@jakelishman jakelishman enabled auto-merge May 18, 2026 15:22
@jakelishman jakelishman added this pull request to the merge queue May 18, 2026
Merged via the queue into Qiskit:main with commit 1680baf May 18, 2026
26 checks passed
chookity-pokk pushed a commit to qctrl/qiskit that referenced this pull request May 21, 2026
…#16209)

* Add details on the C API to the project README

Arguably the largest development in Qiskit since the 2.0.0 release was
the introduction of the C API. This changed how Qiskit is consumable
from solely via Python to any environment that can use a C shared
library. This expanded the scope and potential user base of Qiskit
quite substantially. However, a clear oversight was that the C API is
not at all mentioned in the README. This corrects the oversight and
adds an explanation that the two public APIs are for Python and C and
also installation instructions for the standalone C API.

* Update README.md



* Simplify wording about C API usage modes

* Add sentence to examples section saying explicitly that we're using python

* Only use the minor version

* Remove locale

---------


(cherry picked from commit 1680baf)

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Jake Lishman <jake@binhbar.com>
@ShellyGarion ShellyGarion added this to the 2.5.0 milestone May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C API Related to the C API Changelog: None Do not include in the GitHub Release changelog. documentation Something is not clear or an error documentation stable backport potential Make Mergify open a backport PR to the most recent stable branch on merge.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants