Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sgl-model-gateway/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[workspace]
members = ["bindings/python"]
exclude = ["bindings/golang", "examples"]

[package]
name = "sgl-model-gateway"
version = "0.3.2"
Expand Down
7 changes: 0 additions & 7 deletions sgl-model-gateway/bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,3 @@ default-features = true
[features]
default = ["pyo3/extension-module"]
vendored-openssl = ["sgl-model-gateway/vendored-openssl"]

[profile.ci]
inherits = "release"
opt-level = 2 # Lighter optimization (still fast runtime, much faster compile)
lto = "thin" # Thin LTO - good balance
codegen-units = 16 # More parallelization for faster builds
strip = true
28 changes: 16 additions & 12 deletions sgl-model-gateway/bindings/python/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::collections::HashMap;

use once_cell::sync::OnceCell;
use pyo3::prelude::*;
use smg::*;
use once_cell::sync::OnceCell;
use std::collections::HashMap;

// Define the enums with PyO3 bindings
#[pyclass(eq)]
Expand Down Expand Up @@ -69,7 +70,12 @@ impl PyApiKeyEntry {
#[new]
#[pyo3(signature = (id, name, key, role = PyRole::User))]
fn new(id: String, name: String, key: String, role: PyRole) -> Self {
PyApiKeyEntry { id, name, key, role }
PyApiKeyEntry {
id,
name,
key,
role,
}
}
}

Expand Down Expand Up @@ -166,11 +172,7 @@ impl PyControlPlaneAuthConfig {
api_keys = vec![],
audit_enabled = true,
))]
fn new(
jwt: Option<PyJwtConfig>,
api_keys: Vec<PyApiKeyEntry>,
audit_enabled: bool,
) -> Self {
fn new(jwt: Option<PyJwtConfig>, api_keys: Vec<PyApiKeyEntry>, audit_enabled: bool) -> Self {
PyControlPlaneAuthConfig {
jwt,
api_keys,
Expand All @@ -183,7 +185,11 @@ impl PyControlPlaneAuthConfig {
pub fn to_auth_control_plane_config(&self) -> auth::ControlPlaneAuthConfig {
auth::ControlPlaneAuthConfig {
jwt: self.jwt.as_ref().map(|j| j.to_auth_jwt_config()),
api_keys: self.api_keys.iter().map(|k| k.to_auth_api_key_entry()).collect(),
api_keys: self
.api_keys
.iter()
.map(|k| k.to_auth_api_key_entry())
.collect(),
audit_enabled: self.audit_enabled,
}
}
Expand Down Expand Up @@ -576,9 +582,7 @@ impl Router {
};

let redis_config = if matches!(self.history_backend, HistoryBackendType::Redis) {
self.redis_config
.as_ref()
.map(|cfg| cfg.to_config_redis())
self.redis_config.as_ref().map(|cfg| cfg.to_config_redis())
} else {
None
};
Expand Down
Loading