Commit ef250b63 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

python312Packages.guidance: fix

parent 190193c6
Loading
Loading
Loading
Loading
+49 −17
Original line number Diff line number Diff line
@@ -2,23 +2,36 @@
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pytestCheckHook,

  # build-system
  pybind11,
  setuptools,

  # dependencies
  diskcache,
  fastapi,
  huggingface-hub,
  jsonschema,
  guidance-stitch,
  llguidance,
  numpy,
  openai,
  ordered-set,
  platformdirs,
  protobuf,
  psutil,
  pydantic,
  referencing,
  requests,
  tiktoken,
  torch,

  # optional-dependencies
  openai,
  jsonschema,
  fastapi,
  uvicorn,

  # tests
  huggingface-hub,
  pytestCheckHook,
  tokenizers,
  torch,
  writableTmpDirAsHomeHook,
}:

buildPythonPackage rec {
@@ -38,13 +51,20 @@ buildPythonPackage rec {
    setuptools
  ];

  pythonRelaxDeps = [
    "llguidance"
  ];

  dependencies = [
    diskcache
    guidance-stitch
    llguidance
    numpy
    ordered-set
    platformdirs
    protobuf
    psutil
    pydantic
    referencing
    requests
    tiktoken
  ];
@@ -62,27 +82,40 @@ buildPythonPackage rec {
  nativeCheckInputs = [
    huggingface-hub
    pytestCheckHook
    tokenizers
    torch
    writableTmpDirAsHomeHook
  ] ++ optional-dependencies.schemas;

  pytestFlagsArray = [ "tests/unit" ];

  disabledTests = [
    # require network access
    "test_select_simple"
    "test_commit_point"
    "test_token_healing"
    "test_fstring"
    "test_fstring_custom"
    "test_token_count"
    "test_gpt2"
    "test_recursion_error"
    "test_openai_class_detection"
    "test_openai_chat_without_roles"
    "test_image_from_bytes"
    "test_ll_backtrack_stop"
    "test_ll_dolphin"
    "test_ll_fighter"
    "test_ll_max_tokens"
    "test_ll_nice_man"
    "test_ll_nullable_bug"
    "test_ll_nullable_lexeme"
    "test_ll_pop_tokens"
    "test_ll_stop_quote_comma"
    "test_llparser"
    "test_local_image"
    "test_openai_chat_without_roles"
    "test_openai_class_detection"
    "test_recursion_error"
    "test_remote_image"
    "test_image_from_bytes"
    "test_remote_image_not_found"
    "test_select_simple"
    "test_str_method_smoke"
    "test_token_count"
    "test_token_healing"

    # flaky tests
    "test_remote_mock_gen" # frequently fails when building packages in parallel
@@ -94,7 +127,6 @@ buildPythonPackage rec {
  ];

  preCheck = ''
    export HOME=$TMPDIR
    rm tests/conftest.py
  '';

@@ -105,7 +137,7 @@ buildPythonPackage rec {
  meta = {
    description = "Guidance language for controlling large language models";
    homepage = "https://github.com/guidance-ai/guidance";
    changelog = "https://github.com/guidance-ai/guidance/releases/tag/${src.tag}";
    changelog = "https://github.com/guidance-ai/guidance/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ natsukium ];
  };