• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / qiskit / 25853702590

14 May 2026 09:54AM UTC coverage: 87.425% (-0.2%) from 87.632%
25853702590

Pull #16145

github

web-flow
Merge b64e22949 into dcc06fb27
Pull Request #16145: Add generated `qiskit-pyo3-ffi` crate

0 of 317 new or added lines in 4 files covered. (0.0%)

247 existing lines in 12 files now uncovered.

107175 of 122591 relevant lines covered (87.42%)

956757.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/crates/bindgen-cli/src/main.rs
1
// This code is part of Qiskit.
2
//
3
// (C) Copyright IBM 2026
4
//
5
// This code is licensed under the Apache License, Version 2.0. You may
6
// obtain a copy of this license in the LICENSE.txt file in the root directory
7
// of this source tree or at https://www.apache.org/licenses/LICENSE-2.0.
8
//
9
// Any modifications or derivative works of this code must retain this
10
// copyright notice, and modified files need to carry a notice indicating
11
// that they have been altered from the originals.
12

13
mod abi;
14
mod lint;
15

16
use std::path::PathBuf;
17

18
use anyhow::anyhow;
19
use clap::{Parser, Subcommand};
20

21
use crate::abi::SlotsLists;
22

23
/// Toolkit for working with and installing the C header files.
24
#[derive(Parser, Debug)]
25
struct Args {
26
    #[clap(subcommand)]
27
    command: Command,
28
}
29
#[derive(Subcommand, Debug)]
30
enum Command {
31
    /// Install the header files into a given directory.
32
    Install {
33
        /// Path to the `cext` sources to generate headers for.
34
        #[arg(short, long)]
35
        cext_path: PathBuf,
36
        /// Where to install the header files to.
37
        #[arg(short, long)]
38
        output_path: PathBuf,
39
    },
40
    /// Check for correctness between the slots tables and the list of exported functions for the
41
    /// current version of Qiskit.
42
    LintSlots {
43
        /// Path to the `cext` sources to generate headers for.
44
        #[arg(short, long)]
45
        cext_path: PathBuf,
46
    },
47
    GeneratePyo3 {
48
        /// Path to the `cext` sources to generate headers for.
49
        #[arg(short, long)]
50
        cext_path: PathBuf,
51
        /// Path to write the output crate.
52
        #[arg(short, long)]
53
        output_path: PathBuf,
54
    },
55
}
56

57
fn main() -> anyhow::Result<()> {
×
58
    let args = Args::parse();
×
59
    match &args.command {
×
60
        Command::Install {
61
            cext_path,
×
62
            output_path,
×
63
        } => {
64
            let mut bindings = qiskit_bindgen::generate_bindings(cext_path)?;
×
65
            qiskit_bindgen::install_c_headers(&mut bindings, output_path)?;
×
66
            Ok(())
×
67
        }
68
        Command::LintSlots { cext_path } => {
×
69
            let bindings = qiskit_bindgen::generate_bindings(cext_path)?;
×
70
            lint::lint(&bindings, &SlotsLists::ours())?.map_err(|fails| anyhow!(fails.explain()))
×
71
        }
72
        Command::GeneratePyo3 {
NEW
73
            cext_path,
×
NEW
74
            output_path,
×
75
        } => {
NEW
76
            let bindings = qiskit_bindgen::generate_bindings(cext_path)?;
×
NEW
77
            qiskit_bindgen::install_rust_pyo3_ffi(&bindings, output_path)?;
×
NEW
78
            Ok(())
×
79
        }
80
    }
81
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc