python312Packages.llguidance: init at 0.6.27

This commit is contained in:
Gaetan Lepage
2025-02-21 16:25:42 +01:00
parent e868b830e5
commit 190193c619
2 changed files with 103 additions and 0 deletions
@@ -0,0 +1,101 @@
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
# build-system
cargo,
pkg-config,
rustPlatform,
rustc,
# buildInputs
oniguruma,
openssl,
# tests
pytestCheckHook,
torch,
transformers,
pythonOlder,
}:
buildPythonPackage rec {
pname = "llguidance";
version = "0.6.27";
pyproject = true;
src = fetchFromGitHub {
owner = "guidance-ai";
repo = "llguidance";
tag = "v${version}";
hash = "sha256-7XtGKqkAk6ZvWPSswLe07FaB/RYKZEi+3Lp+GBIP0OI=";
};
cargoDeps = rustPlatform.fetchCargoVendor {
inherit src;
hash = "sha256-WbPTnB1Mv9HYOrMnDhayO2V4zkuwVH/C17MdkFy57Rc=";
};
build-system = [
cargo
pkg-config
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
rustc
];
buildInputs = [
oniguruma
openssl
];
env = {
RUSTONIG_SYSTEM_LIBONIG = true;
};
pythonImportsCheck = [
"llguidance"
"llguidance._lib"
];
nativeCheckInputs = [
pytestCheckHook
torch
transformers
];
# Prevent python from loading the package from $src instead of the $out
preCheck = ''
rm -r python/llguidance
'';
disabledTests =
[
# Require internet access (https://huggingface.co)
"test_grammar"
"test_par_grammar"
"test_par_errors"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# torch._inductor.exc.CppCompileError: C++ compile error
# OpenMP support not found.
"test_mask_data_torch"
];
disabledTestPaths = [
# Require internet access (https://huggingface.co)
"scripts/tokenizer_test.py"
];
# As dynamo is not supported on Python 3.13+, no successfull tests remain.
doCheck = pythonOlder "3.13";
meta = {
description = "Super-fast Structured Outputs";
homepage = "https://github.com/guidance-ai/llguidance";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}
+2
View File
@@ -7711,6 +7711,8 @@ self: super: with self; {
inherit (pkgs) fuse;
};
llguidance = callPackage ../development/python-modules/llguidance { };
llm = callPackage ../development/python-modules/llm { };
llm-anthropic = callPackage ../development/python-modules/llm-anthropic { };