# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CRATES="
    adler2@2.0.1
    ahash@0.8.12
    aho-corasick@1.1.5
    aligned@0.4.3
    aligned-vec@0.6.4
    alloca@0.4.0
    allocator-api2@0.2.21
    android_system_properties@0.1.5
    anes@0.1.6
    anstream@1.0.0
    anstyle@1.0.14
    anstyle-parse@1.0.0
    anstyle-query@1.1.5
    anstyle-wincon@3.0.11
    anyhow@1.0.104
    arbitrary@1.4.2
    arc-swap@1.9.1
    arcstr@1.2.0
    arg_enum_proc_macro@0.3.4
    arrayvec@0.7.7
    as-slice@0.2.1
    assert-json-diff@2.0.2
    async-trait@0.1.92
    atomic-waker@1.1.2
    autocfg@1.5.1
    av-scenechange@0.14.1
    av1-grain@0.2.5
    avif-serialize@0.8.9
    aws-config@1.12.0
    aws-credential-types@1.3.0
    aws-lc-rs@1.18.1
    aws-lc-sys@0.45.0
    aws-runtime@1.9.2
    aws-sdk-sso@1.109.0
    aws-sdk-ssooidc@1.111.0
    aws-sdk-sts@1.114.0
    aws-sigv4@1.5.3
    aws-smithy-async@1.3.0
    aws-smithy-http@0.64.0
    aws-smithy-http-client@1.4.0
    aws-smithy-json@0.63.0
    aws-smithy-observability@0.3.0
    aws-smithy-query@0.62.0
    aws-smithy-runtime@1.14.0
    aws-smithy-runtime-api@1.17.0
    aws-smithy-runtime-api-macros@1.1.0
    aws-smithy-schema@0.2.0
    aws-smithy-types@1.8.0
    aws-smithy-xml@0.62.0
    aws-types@1.6.0
    axum@0.8.9
    axum-core@0.5.6
    axum-macros@0.5.1
    base64@0.13.1
    base64@0.22.1
    base64-simd@0.8.0
    bit-set@0.8.0
    bit-vec@0.8.0
    bit_field@0.10.3
    bitflags@2.13.0
    bitstream-io@4.10.0
    blake3@1.8.7
    block-buffer@0.10.4
    block-buffer@0.12.1
    bstr@1.12.1
    built@0.8.1
    bumpalo@3.20.3
    bytemuck@1.25.0
    byteorder@1.5.0
    byteorder-lite@0.1.0
    bytes@1.12.1
    bytes-utils@0.1.4
    bytesize@2.7.0
    cast@0.3.0
    castaway@0.2.4
    cc@1.4.7
    cfg-if@1.0.4
    cfg_aliases@0.2.1
    chacha20@0.10.2
    chrono@0.4.45
    ciborium@0.2.2
    ciborium-io@0.2.2
    ciborium-ll@0.2.2
    clap@4.6.7
    clap_builder@4.6.7
    clap_derive@4.6.7
    clap_lex@1.1.0
    cmake@0.1.58
    cmov@0.5.4
    color_quant@1.1.0
    colorchoice@1.0.5
    combine@4.6.8
    compact_str@0.9.1
    console@0.16.3
    const-oid@0.10.2
    constant_time_eq@0.4.2
    cookie@0.18.1
    cookie_store@0.22.1
    core-foundation@0.10.1
    core-foundation-sys@0.8.7
    core_maths@0.1.1
    cpufeatures@0.2.17
    cpufeatures@0.3.0
    crc32fast@1.5.2
    criterion@0.8.2
    criterion-plot@0.8.2
    crossbeam-deque@0.8.6
    crossbeam-epoch@0.9.20
    crossbeam-utils@0.8.21
    crunchy@0.2.4
    crypto-common@0.1.7
    crypto-common@0.2.2
    ctutils@0.4.2
    daachorse@3.0.3
    darling@0.20.11
    darling_core@0.20.11
    darling_macro@0.20.11
    dary_heap@0.3.9
    dashmap@6.2.1
    data-encoding@2.11.0
    deadpool@0.12.3
    deadpool-runtime@0.1.4
    deranged@0.5.8
    derive_builder@0.20.2
    derive_builder_core@0.20.2
    derive_builder_macro@0.20.2
    digest@0.10.7
    digest@0.11.3
    dirs@6.0.0
    dirs-sys@0.5.0
    displaydoc@0.2.6
    document-features@0.2.12
    dunce@1.0.5
    either@1.16.0
    encode_unicode@1.0.0
    encoding_rs@0.8.35
    equator@0.4.2
    equator-macro@0.4.2
    equivalent@1.0.2
    errno@0.3.14
    esaxx-rs@0.1.10
    exr@1.74.0
    fallible-iterator@0.3.0
    fallible-streaming-iterator@0.1.9
    fancy-regex@0.17.0
    fastembed@5.17.3
    fastrand@2.4.1
    fax@0.2.7
    fdeflate@0.3.7
    find-msvc-tools@0.1.13
    flate2@1.1.10
    fnv@1.0.7
    foldhash@0.2.0
    form_urlencoded@1.2.2
    fs_extra@1.3.0
    futures@0.3.34
    futures-channel@0.3.34
    futures-core@0.3.34
    futures-executor@0.3.34
    futures-io@0.3.34
    futures-macro@0.3.34
    futures-sink@0.3.34
    futures-task@0.3.34
    futures-util@0.3.34
    gcp_auth@0.12.7
    generic-array@0.14.7
    getrandom@0.2.17
    getrandom@0.3.4
    getrandom@0.4.3
    gif@0.14.2
    h2@0.4.16
    half@2.7.1
    hashbrown@0.14.5
    hashbrown@0.16.1
    hashbrown@0.17.1
    hashlink@0.12.1
    heck@0.5.0
    hermit-abi@0.5.2
    hex@0.4.3
    hf-hub@0.5.0
    hmac@0.13.0
    http@0.2.12
    http@1.5.0
    http-body@0.4.6
    http-body@1.0.1
    http-body-util@0.1.5
    httparse@1.10.1
    httpdate@1.0.3
    humantime@2.4.0
    hybrid-array@0.4.12
    hyper@1.11.1
    hyper-rustls@0.27.9
    hyper-util@0.1.20
    iana-time-zone@0.1.65
    iana-time-zone-haiku@0.1.2
    icu_collections@2.2.0
    icu_locale@2.2.0
    icu_locale_core@2.2.0
    icu_locale_data@2.2.0
    icu_normalizer@2.2.0
    icu_normalizer_data@2.2.0
    icu_properties@2.2.0
    icu_properties_data@2.2.0
    icu_provider@2.2.0
    icu_segmenter@2.2.0
    icu_segmenter_data@2.2.0
    ident_case@1.0.1
    idna@1.1.0
    idna_adapter@1.2.2
    image@0.25.10
    image-webp@0.2.4
    imgref@1.12.2
    indexmap@2.14.0
    indicatif@0.18.4
    interpolate_name@0.2.4
    ipnet@2.12.0
    is_terminal_polyfill@1.70.2
    itertools@0.13.0
    itertools@0.14.0
    itoa@1.0.18
    jobserver@0.1.34
    js-sys@0.3.102
    lazy_static@1.5.0
    lebe@0.5.3
    libc@0.2.186
    libfuzzer-sys@0.4.13
    libloading@0.9.0
    libm@0.2.16
    libredox@0.1.17
    libsqlite3-sys@0.38.2
    linux-raw-sys@0.12.1
    litemap@0.8.2
    litrs@1.0.0
    lock_api@0.4.14
    log@0.4.33
    loop9@0.1.5
    lru@0.18.4
    lru-slab@0.1.2
    macro_rules_attribute@0.2.2
    macro_rules_attribute-proc_macro@0.2.2
    magika@1.1.0
    matchers@0.2.0
    matchit@0.8.4
    matrixmultiply@0.3.10
    maybe-rayon@0.1.1
    md-5@0.11.0
    memchr@2.8.2
    mime@0.3.17
    minimal-lexical@0.2.1
    miniz_oxide@0.8.9
    miniz_oxide@0.9.1
    mio@1.2.1
    monostate@0.1.18
    monostate-impl@0.1.18
    moxcms@0.8.1
    ndarray@0.17.2
    new_debug_unreachable@1.0.6
    no_std_io2@0.9.4
    nom@7.1.3
    nom@8.0.0
    noop_proc_macro@0.3.0
    nu-ansi-term@0.50.3
    num-bigint@0.4.6
    num-complex@0.4.6
    num-conv@0.2.2
    num-derive@0.4.2
    num-integer@0.1.46
    num-rational@0.4.2
    num-traits@0.2.19
    num_cpus@1.17.0
    once_cell@1.21.4
    once_cell_polyfill@1.70.2
    onig@6.5.3
    onig_sys@69.9.3
    oorandom@11.1.5
    openssl-probe@0.2.1
    option-ext@0.2.0
    ort@2.0.0-rc.12
    ort-sys@2.0.0-rc.12
    outref@0.5.2
    page_size@0.6.0
    parking_lot@0.12.5
    parking_lot_core@0.9.12
    paste@1.0.15
    pastey@0.1.1
    percent-encoding@2.3.2
    pin-project@1.1.13
    pin-project-internal@1.1.13
    pin-project-lite@0.2.17
    pin-utils@0.1.0
    pkg-config@0.3.33
    plotters@0.3.7
    plotters-backend@0.3.7
    plotters-svg@0.3.7
    png@0.18.1
    portable-atomic@1.13.1
    portable-atomic-util@0.2.7
    potential_utf@0.1.5
    powerfmt@0.2.0
    ppv-lite86@0.2.21
    proc-macro2@1.0.106
    profiling@1.0.18
    profiling-procmacros@1.0.18
    prometheus@0.14.0
    proptest@1.11.0
    pxfm@0.1.29
    pyo3@0.29.2
    pyo3-build-config@0.29.2
    pyo3-ffi@0.29.2
    pyo3-log@0.13.4
    pyo3-macros@0.29.2
    pyo3-macros-backend@0.29.2
    qoi@0.4.1
    quick-error@1.2.3
    quick-error@2.0.1
    quinn@0.11.11
    quinn-proto@0.11.15
    quinn-udp@0.5.14
    quote@1.0.46
    r-efi@5.3.0
    r-efi@6.0.0
    rand@0.9.4
    rand@0.10.2
    rand_chacha@0.9.0
    rand_core@0.9.5
    rand_core@0.10.1
    rand_xorshift@0.4.0
    rav1e@0.8.1
    ravif@0.13.0
    rawpointer@0.2.1
    rayon@1.12.0
    rayon-cond@0.4.0
    rayon-core@1.13.0
    redis@1.7.0
    redox_syscall@0.5.18
    redox_users@0.5.2
    regex@1.13.1
    regex-automata@0.4.16
    regex-lite@0.1.9
    regex-syntax@0.8.11
    reqwest@0.12.28
    rgb@0.8.53
    ring@0.17.14
    rsqlite-vfs@0.1.1
    rusqlite@0.40.2
    rustc-hash@2.1.2
    rustc_version@0.4.1
    rustix@1.1.4
    rustls@0.23.45
    rustls-native-certs@0.8.4
    rustls-pki-types@1.14.1
    rustls-webpki@0.103.15
    rustversion@1.0.22
    rusty-fork@0.3.1
    ryu@1.0.23
    safetensors@0.8.0
    same-file@1.0.6
    schannel@0.1.29
    scopeguard@1.2.0
    security-framework@3.7.0
    security-framework-sys@2.17.0
    semver@1.0.28
    serde@1.0.229
    serde_core@1.0.229
    serde_derive@1.0.229
    serde_json@1.0.151
    serde_path_to_error@0.1.20
    serde_spanned@1.1.1
    serde_urlencoded@0.7.1
    sha1@0.10.6
    sha1@0.11.0
    sha2@0.11.0
    sharded-slab@0.1.7
    shlex@2.0.1
    signal-hook-registry@1.4.8
    simd-adler32@0.3.9
    simd_helpers@0.1.0
    slab@0.4.12
    smallvec@1.15.2
    socket2@0.6.4
    socks@0.3.4
    spm_precompiled@0.1.4
    sqlite-wasm-rs@0.5.5
    stable_deref_trait@1.2.1
    static_assertions@1.1.0
    streaming-iterator@0.1.9
    strsim@0.11.1
    subtle@2.6.1
    syn@2.0.118
    syn@3.0.3
    sync_wrapper@1.0.2
    synstructure@0.13.2
    target-lexicon@0.13.5
    tempfile@3.27.0
    thiserror@1.0.69
    thiserror@2.0.20
    thiserror-impl@1.0.69
    thiserror-impl@2.0.20
    thread_local@1.1.9
    tiff@0.11.3
    tiktoken-rs@0.12.0
    time@0.3.51
    time-core@0.1.9
    time-macros@0.2.30
    tinystr@0.8.3
    tinytemplate@1.2.1
    tinyvec@1.11.0
    tinyvec_macros@0.1.1
    tokenizers@0.22.2
    tokenizers@0.23.2
    tokio@1.53.1
    tokio-macros@2.7.0
    tokio-rustls@0.26.4
    tokio-stream@0.1.19
    tokio-tungstenite@0.29.0
    tokio-tungstenite@0.30.0
    tokio-util@0.7.19
    toml@1.1.6+spec-1.1.0
    toml_datetime@1.1.1+spec-1.1.0
    toml_parser@1.1.3+spec-1.1.0
    toml_writer@1.1.2+spec-1.1.0
    tower@0.5.3
    tower-http@0.6.11
    tower-http@0.7.1
    tower-layer@0.3.3
    tower-service@0.3.3
    tracing@0.1.44
    tracing-attributes@0.1.31
    tracing-core@0.1.36
    tracing-futures@0.2.5
    tracing-log@0.2.0
    tracing-serde@0.2.0
    tracing-subscriber@0.3.23
    tree-sitter@0.27.0
    tree-sitter-c@0.24.2
    tree-sitter-cpp@0.23.4
    tree-sitter-go@0.25.0
    tree-sitter-java@0.23.5
    tree-sitter-javascript@0.25.0
    tree-sitter-language@0.1.8
    tree-sitter-python@0.25.0
    tree-sitter-rust@0.24.2
    tree-sitter-typescript@0.23.2
    try-lock@0.2.5
    tungstenite@0.29.0
    tungstenite@0.30.0
    typenum@1.20.1
    unarray@0.1.4
    unicode-ident@1.0.24
    unicode-normalization-alignments@0.1.12
    unicode-segmentation@1.13.3
    unicode-width@0.2.2
    unicode_categories@0.1.1
    unidiff@0.4.1
    unit-prefix@0.5.2
    untrusted@0.9.0
    ureq@3.3.0
    ureq-proto@0.6.0
    url@2.5.8
    urlencoding@2.1.3
    utf8-zero@0.8.1
    utf8_iter@1.0.4
    utf8parse@0.2.2
    uuid@1.26.1
    v_frame@0.3.9
    valuable@0.1.1
    vcpkg@0.2.15
    version_check@0.9.5
    vsimd@0.8.0
    wait-timeout@0.2.1
    walkdir@2.5.0
    want@0.3.1
    wasi@0.11.1+wasi-snapshot-preview1
    wasip2@1.0.4+wasi-0.2.12
    wasm-bindgen@0.2.125
    wasm-bindgen-futures@0.4.75
    wasm-bindgen-macro@0.2.125
    wasm-bindgen-macro-support@0.2.125
    wasm-bindgen-shared@0.2.125
    wasm-streams@0.4.2
    web-sys@0.3.102
    web-time@1.1.0
    webpki-roots@0.26.11
    webpki-roots@1.0.8
    weezl@0.1.12
    winapi@0.3.9
    winapi-i686-pc-windows-gnu@0.4.0
    winapi-util@0.1.11
    winapi-x86_64-pc-windows-gnu@0.4.0
    windows-core@0.62.2
    windows-implement@0.60.2
    windows-interface@0.59.3
    windows-link@0.2.1
    windows-result@0.4.1
    windows-strings@0.5.1
    windows-sys@0.52.0
    windows-sys@0.61.2
    windows-targets@0.52.6
    windows_aarch64_gnullvm@0.52.6
    windows_aarch64_msvc@0.52.6
    windows_i686_gnu@0.52.6
    windows_i686_gnullvm@0.52.6
    windows_i686_msvc@0.52.6
    windows_x86_64_gnu@0.52.6
    windows_x86_64_gnullvm@0.52.6
    windows_x86_64_msvc@0.52.6
    winnow@1.0.3
    wiremock@0.6.5
    wit-bindgen@0.57.1
    writeable@0.6.3
    xmlparser@0.13.6
    xxhash-rust@0.8.18
    y4m@0.8.0
    yoke@0.8.3
    yoke-derive@0.8.2
    zerocopy@0.8.52
    zerocopy-derive@0.8.52
    zerofrom@0.1.8
    zerofrom-derive@0.1.7
    zeroize@1.9.0
    zerotrie@0.2.4
    zerovec@0.11.6
    zerovec-derive@0.11.3
    zlib-rs@0.6.7
    zmij@1.0.21
    zune-core@0.5.1
    zune-inflate@0.2.54
    zune-jpeg@0.5.15
"

DISTUTILS_USE_PEP517=maturin
DISTUTILS_SINGLE_IMPL=1
PYTHON_COMPAT=( python3_{12..14} )

inherit cargo distutils-r1 pypi

DESCRIPTION="The Context Optimization Layer for LLM Applications - Cut costs by 50-90%"
HOMEPAGE="https://www.headroomlabs.ai"
SRC_URI+="
	${CARGO_CRATE_URIS}
"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"
IUSE="verify-provenance"

RUST_MIN_VER="1.94.1"

RDEPEND="
	dev-util/ast-grep
	$(python_gen_cond_dep '
		dev-python/tiktoken[${PYTHON_USEDEP}]
		dev-python/pydantic[${PYTHON_USEDEP}]
		dev-python/click[${PYTHON_USEDEP}]
		dev-python/rich[${PYTHON_USEDEP}]
		dev-python/opentelemetry-api[${PYTHON_USEDEP}]
		dev-python/pyyaml[${PYTHON_USEDEP}]
		dev-python/tomli[${PYTHON_USEDEP}]
		dev-python/tomlkit[${PYTHON_USEDEP}]
		dev-python/truststore[${PYTHON_USEDEP}]
	')
	dev-python/litellm[${PYTHON_SINGLE_USEDEP}]"

BDEPEND=""

src_unpack() {
        pypi_src_unpack
        cargo_src_unpack
}