diff --git a/.github/workflows/publish-python.yml b/.github/workflows/publish-python.yml index b8d3e3a..1e63deb 100644 --- a/.github/workflows/publish-python.yml +++ b/.github/workflows/publish-python.yml @@ -1,7 +1,7 @@ # This file is autogenerated by maturin v1.4.0 # To update, run # -# maturin generate-ci github --zig +# maturin generate-ci --manifest-path bindings/python/Cargo.toml github # name: publish-python @@ -26,7 +26,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist --find-interpreter --zig + args: --release --out dist --find-interpreter --manifest-path bindings/python/Cargo.toml sccache: 'true' manylinux: auto - name: Upload wheels @@ -50,7 +50,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist --find-interpreter + args: --release --out dist --find-interpreter --manifest-path bindings/python/Cargo.toml sccache: 'true' - name: Upload wheels uses: actions/upload-artifact@v3 @@ -62,7 +62,7 @@ jobs: runs-on: macos-latest strategy: matrix: - target: [x86_64, aarch64] + target: [x86_64, aarch64, universal2-apple-darwin] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -72,7 +72,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist --find-interpreter + args: --release --out dist --find-interpreter --manifest-path bindings/python/Cargo.toml sccache: 'true' - name: Upload wheels uses: actions/upload-artifact@v3 @@ -88,7 +88,7 @@ jobs: uses: PyO3/maturin-action@v1 with: command: sdist - args: --out dist + args: --out dist --manifest-path bindings/python/Cargo.toml - name: Upload sdist uses: actions/upload-artifact@v3 with: diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index 4762393..eb81640 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -7,12 +7,12 @@ use pyo3::types::*; use std::collections::{BTreeMap, BTreeSet}; -use regorus::Value; +use ::regorus::Value; -/// Python wrapper for [`regorus::Engine`] +/// Regorus engine. #[pyclass(unsendable)] pub struct Engine { - engine: regorus::Engine, + engine: ::regorus::Engine, } impl Default for Engine { @@ -171,7 +171,7 @@ impl Engine { #[new] pub fn new() -> Self { Self { - engine: regorus::Engine::new(), + engine: ::regorus::Engine::new(), } } @@ -199,7 +199,7 @@ impl Engine { /// /// * `data`: JSON encoded value to be used as policy data. pub fn add_data_json(&mut self, data: String) -> Result<()> { - let data = regorus::Value::from_json_str(&data)?; + let data = Value::from_json_str(&data)?; self.engine.add_data(data) } @@ -223,7 +223,7 @@ impl Engine { /// /// * `input`: JSON encoded value to be used as input to query. pub fn set_input_json(&mut self, input: String) -> Result<()> { - let input = regorus::Value::from_json_str(&input)?; + let input = Value::from_json_str(&input)?; self.engine.set_input(input); Ok(()) } @@ -270,10 +270,7 @@ impl Engine { } } -mod export { - use pyo3::prelude::*; - #[pymodule] - fn regorus(_py: Python<'_>, m: &PyModule) -> PyResult<()> { - m.add_class::() - } +#[pymodule] +pub fn regorus(_py: Python<'_>, m: &PyModule) -> PyResult<()> { + m.add_class::() }