Redid build.sh and removed files

This commit is contained in:
brotoskyj
2025-10-20 16:52:08 -04:00
parent 63a0da47a4
commit fd63ecbd1a
7 changed files with 53 additions and 11 deletions
+2
View File
@@ -1 +1,3 @@
/target /target
build.sh
pythontest.py
Generated
+10
View File
@@ -719,6 +719,7 @@ version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc1989dbf2b60852e0782c7487ebf0b4c7f43161ffe820849b56cf05f945cee1" checksum = "bc1989dbf2b60852e0782c7487ebf0b4c7f43161ffe820849b56cf05f945cee1"
dependencies = [ dependencies = [
"python3-dll-a",
"target-lexicon", "target-lexicon",
] ]
@@ -757,6 +758,15 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "python3-dll-a"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d381ef313ae70b4da5f95f8a4de773c6aa5cd28f73adec4b4a31df70b66780d8"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.41" version = "1.0.41"
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2024"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]
pyo3 = { version = "0.27.0", features = ["extension-module"] } pyo3 = { version = "0.27.0", features = ["extension-module", "generate-import-lib"] }
reqwest = "0.12.24" reqwest = "0.12.24"
serde = "1.0.228" serde = "1.0.228"
+37
View File
@@ -1,4 +1,41 @@
from typing import Dict, List, Optional from typing import Dict, List, Optional
class AirlockAPIWrapper:
"""
A wrapper class for interacting with the Airlock API.
Provides methods for managing agents, policies, hashes, OTPs, and execution history.
"""
def __init__(self, base_url: str, api_key: str):
"""
Initialize the API wrapper.
Parameters:
- base_url (str): Base URL of the Airlock API.
- api_key (str): API key for authentication.
"""
self.base_url = base_url.rstrip("/")
self.api_key = api_key
self.headers = {"X-APIKey": self.api_key}
def pull_policy_exec_histories(self, type: List[str], checkpoint: str, policy: List[str]) -> str: def pull_policy_exec_histories(self, type: List[str], checkpoint: str, policy: List[str]) -> str:
"""Retrieve execution history logs.""" """Retrieve execution history logs."""
def api(AirlockAPIWrapper):
"""
An implementation of the python AirlockAPIWrapper class to pass Python data into Rust
Parameters
----------
base_url : str
(Required) Base URL of the Airlock API, this should be in your .env file.
api_key : str
(Required) API Key for your profile in airlock, this should be in your credential manager.
headers : {"X-APIKey": self.api_key}
```def __init__(self, base_url: str, api_key: str):
self.base_url = base_ur.rstrip("/")
self.api_key = api_key
self.headers = {"X-APIKey": self.api_key}
```
"""
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
cargo clean
maturin build
python3 -m pip uninstall airlock_libs --break-system-packages
python3 -m pip install target/wheels/airlock_libs-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl --break-system-packages
-3
View File
@@ -1,3 +0,0 @@
import airlock_libs
airlock_libs.pull_policy_exec_histories()
+3 -2
View File
@@ -6,6 +6,7 @@ pub fn pull_policy_exec_histories() {
} }
#[pyfunction] #[pyfunction]
pub fn api(x: String) { pub fn api(py: Python<'_>, x: Py<PyAny>) {
println!("{}", x); let base_url: String = x.getattr(py, "base_url").unwrap().to_string();
println!("{}", base_url);
} }