Skip to content

Commit

Permalink
ci: Use trusted publishing for PyPI (#327)
Browse files Browse the repository at this point in the history
* ci: Use trusted publishing for PyPI

* remove unused import

* shuffle test modules to bottom for clippy
  • Loading branch information
MarquessV committed Jan 11, 2024
1 parent a58a14e commit 481334f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/publish-quil-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,11 @@ jobs:
# can be published.
needs: [ macos, linux, windows, sdist ]
if: always() && needs.sdist.result == 'success'
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
- name: Publish to PyPi
env:
MATURIN_USERNAME: ${{ secrets.PYPI_USERNAME }}
MATURIN_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
uses: messense/maturin-action@v1
with:
command: upload
Expand Down
60 changes: 30 additions & 30 deletions quil-rs/src/instruction/calibration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,36 @@ pub struct MeasureCalibrationDefinition {
pub instructions: Vec<Instruction>,
}

impl MeasureCalibrationDefinition {
pub fn new(qubit: Option<Qubit>, parameter: String, instructions: Vec<Instruction>) -> Self {
Self {
qubit,
parameter,
instructions,
}
}
}

impl Quil for MeasureCalibrationDefinition {
fn write(
&self,
f: &mut impl std::fmt::Write,
fall_back_to_debug: bool,
) -> crate::quil::ToQuilResult<()> {
write!(f, "DEFCAL MEASURE")?;
if let Some(qubit) = &self.qubit {
write!(f, " ")?;
qubit.write(f, fall_back_to_debug)?;
}

writeln!(f, " {}:", self.parameter,)?;

write_instruction_block(f, fall_back_to_debug, &self.instructions)?;
writeln!(f)?;
Ok(())
}
}

#[cfg(test)]
mod test_measure_calibration_definition {
use super::MeasureCalibrationDefinition;
Expand Down Expand Up @@ -113,33 +143,3 @@ mod test_measure_calibration_definition {
})
}
}

impl MeasureCalibrationDefinition {
pub fn new(qubit: Option<Qubit>, parameter: String, instructions: Vec<Instruction>) -> Self {
Self {
qubit,
parameter,
instructions,
}
}
}

impl Quil for MeasureCalibrationDefinition {
fn write(
&self,
f: &mut impl std::fmt::Write,
fall_back_to_debug: bool,
) -> crate::quil::ToQuilResult<()> {
write!(f, "DEFCAL MEASURE")?;
if let Some(qubit) = &self.qubit {
write!(f, " ")?;
qubit.write(f, fall_back_to_debug)?;
}

writeln!(f, " {}:", self.parameter,)?;

write_instruction_block(f, fall_back_to_debug, &self.instructions)?;
writeln!(f)?;
Ok(())
}
}
2 changes: 1 addition & 1 deletion quil-rs/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mod token;

pub(crate) use error::{ErrorInput, InternalParseError};
pub use error::{ParseError, ParserErrorKind};
pub use lexer::{LexError, LexErrorKind};
pub use lexer::LexError;
pub use token::{Token, TokenWithLocation};

type ParserInput<'a> = &'a [TokenWithLocation<'a>];
Expand Down

0 comments on commit 481334f

Please sign in to comment.