python3Packages.outlines: 1.2.1 -> 1.2.3 (#436595)

This commit is contained in:
Gaétan Lepage
2025-08-25 14:34:19 +02:00
committed by GitHub
3 changed files with 1388 additions and 469 deletions
File diff suppressed because it is too large Load Diff
@@ -1,37 +1,48 @@
{
lib,
buildPythonPackage,
fetchPypi,
pythonOlder,
fetchFromGitHub,
# nativeBuildInputs
cargo,
pkg-config,
rustPlatform,
rustc,
# buildInputs
openssl,
# build-system
setuptools-rust,
setuptools-scm,
# dependencies
interegular,
jsonschema,
# optional-dependencies
datasets,
numpy,
pytestCheckHook,
pydantic,
scipy,
torch,
transformers,
# tests
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "outlines-core";
version = "0.1.26";
version = "0.2.11";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchPypi {
inherit version;
pname = "outlines_core";
hash = "sha256-SBxDATQed8yPGDLWFnhK201GG0/sZYeOfA0sunFjoYk=";
src = fetchFromGitHub {
owner = "dottxt-ai";
repo = "outlines-core";
tag = version;
hash = "sha256-lLMTHFytJT2MhnzT0RlRCaSBPijA81fjxUqx4IGfVo8=";
};
cargoDeps = rustPlatform.importCargoLock {
@@ -39,6 +50,11 @@ buildPythonPackage rec {
};
postPatch = ''
substituteInPlace Cargo.toml \
--replace-fail \
'version = "0.0.0"' \
'version = "${version}"'
cp --no-preserve=mode ${./Cargo.lock} Cargo.lock
'';
@@ -46,6 +62,7 @@ buildPythonPackage rec {
cargo
pkg-config
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
rustc
];
@@ -74,16 +91,27 @@ buildPythonPackage rec {
];
};
pythonImportsCheck = [ "outlines_core" ];
preCheck = ''
rm -rf outlines_core
'';
nativeCheckInputs = [ pytestCheckHook ] ++ lib.flatten (lib.attrValues optional-dependencies);
disabledTests = [
# Tests that need to download from Hugging Face Hub.
"test_complex_serialization"
"test_create_fsm_index_tokenizer"
"test_from_pretrained"
"test_pickling_from_pretrained_with_revision"
"test_reduced_vocabulary_with_rare_tokens"
];
pythonImportsCheck = [ "outlines_core" ];
disabledTestPaths = [
# Downloads from Hugging Face Hub
"tests/test_kernels.py"
];
meta = {
description = "Structured text generation (core)";
@@ -2,37 +2,55 @@
lib,
buildPythonPackage,
fetchFromGitHub,
# build-system
setuptools,
setuptools-scm,
# dependencies
airportsdata,
interegular,
cloudpickle,
datasets,
diskcache,
genson,
interegular,
iso3166,
jinja2,
jsonschema,
lark,
nest-asyncio,
numpy,
outlines-core,
pycountry,
pydantic,
lark,
nest-asyncio,
referencing,
requests,
torch,
transformers,
# tests
anthropic,
google-genai,
jax,
llama-cpp-python,
ollama,
openai,
pytest-asyncio,
pytest-mock,
pytestCheckHook,
tensorflow,
}:
buildPythonPackage rec {
pname = "outlines";
version = "1.2.1";
version = "1.2.3";
pyproject = true;
src = fetchFromGitHub {
owner = "outlines-dev";
repo = "outlines";
tag = version;
hash = "sha256-WmkA+plIouEzleo3yoSxfCjK0E3EfMGQIPl20aIKxl8=";
hash = "sha256-t1YSkFC56De9HkdDJN9WIpKDdHxZRfGRbFOtAiJxKUI=";
};
build-system = [
@@ -42,33 +60,139 @@ buildPythonPackage rec {
dependencies = [
airportsdata
interegular
cloudpickle
datasets
diskcache
genson
interegular
iso3166
jinja2
jsonschema
outlines-core
pydantic
lark
nest-asyncio
numpy
outlines-core
pycountry
pydantic
referencing
requests
torch
transformers
pycountry
];
checkPhase = ''
export HOME=$(mktemp -d)
python3 -c 'import outlines'
'';
pythonImportsCheck = [ "outlines" ];
meta = with lib; {
nativeCheckInputs = [
anthropic
google-genai
jax
llama-cpp-python
ollama
openai
pytest-asyncio
pytest-mock
pytestCheckHook
tensorflow
];
disabledTests = [
# Try to dowload models from Hugging Face Hub
"test_application_callable_call"
"test_application_generator_reuse"
"test_application_template_call"
"test_application_template_error"
"test_generator_black_box_async_processor"
"test_generator_black_box_sync_processor"
"test_generator_init_multiple_output_type"
"test_generator_steerable_output_type"
"test_generator_steerable_processor"
"test_llamacpp_type_adapter_format_output_type"
"test_steerable_generator_call"
"test_steerable_generator_init_cfg_output_type"
"test_steerable_generator_init_invalid_output_type"
"test_steerable_generator_init_other_output_type"
"test_steerable_generator_init_valid_processor"
"test_steerable_generator_stream"
"test_transformer_tokenizer_convert_token_to_string"
"test_transformer_tokenizer_decode"
"test_transformer_tokenizer_encode"
"test_transformer_tokenizer_eq"
"test_transformer_tokenizer_getstate_setstate"
"test_transformer_tokenizer_hash"
"test_transformer_tokenizer_init"
# TypeError: "Could not resolve authentication method.
# Expected either api_key or auth_token to be set.
# Or for one of the `X-Api-Key` or `Authorization` headers to be explicitly omitted.
"test_anthopic_streaming"
"test_anthropic_chat"
"test_anthropic_simple_call"
"test_anthropic_simple_vision"
# ConnectionError: Failed to connect to Ollama.
"test_ollama_async_chat"
"test_ollama_async_direct"
"test_ollama_async_json"
"test_ollama_async_simple"
"test_ollama_async_simple_vision"
"test_ollama_async_stream"
"test_ollama_async_stream_json"
"test_ollama_chat"
"test_ollama_direct"
"test_ollama_json"
"test_ollama_simple"
"test_ollama_simple_vision"
"test_ollama_stream"
"test_ollama_stream_json"
# openai.APIConnectionError: Connection error.
"test_openai_async_chat"
"test_openai_async_direct_call"
"test_openai_async_simple_call"
"test_openai_async_simple_call_multiple_samples"
"test_openai_async_simple_json_schema"
"test_openai_async_simple_pydantic"
"test_openai_async_simple_pydantic_refusal"
"test_openai_async_simple_vision"
"test_openai_async_simple_vision_pydantic"
"test_openai_async_streaming"
"test_openai_chat"
"test_openai_direct_call"
"test_openai_simple_call"
"test_openai_simple_call_multiple_samples"
"test_openai_simple_json_schema"
"test_openai_simple_pydantic"
"test_openai_simple_pydantic_refusal"
"test_openai_simple_vision"
"test_openai_simple_vision_pydantic"
"test_openai_streaming"
];
disabledTestPaths = [
# Try to dowload models from Hugging Face Hub
"tests/backends/test_backends.py"
"tests/backends/test_llguidance.py"
"tests/backends/test_outlines_core.py"
"tests/backends/test_xgrammar.py"
"tests/models/test_llamacpp.py"
"tests/models/test_llamacpp_tokenizer.py"
"tests/models/test_transformers.py"
"tests/models/test_transformers_multimodal.py"
"tests/models/test_transformers_multimodal_type_adapter.py"
"tests/models/test_transformers_type_adapter.py"
# Requires unpackaged dottxt
"tests/models/test_dottxt.py"
# ValueError: Missing key inputs argument! To use the Google AI API, provide (`api_key`) arguments.
"tests/models/test_gemini.py"
];
meta = {
description = "Structured text generation";
homepage = "https://github.com/outlines-dev/outlines";
license = licenses.asl20;
maintainers = with maintainers; [ lach ];
changelog = "https://github.com/dottxt-ai/outlines/releases/tag/${version}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ lach ];
};
}