diff --git a/pkgs/development/python-modules/guidance/default.nix b/pkgs/development/python-modules/guidance/default.nix index 7cd557d394ef..a8d382310d60 100644 --- a/pkgs/development/python-modules/guidance/default.nix +++ b/pkgs/development/python-modules/guidance/default.nix @@ -2,6 +2,10 @@ , buildPythonPackage , fetchFromGitHub , pytestCheckHook +, pythonOlder +, pybind11 +, setuptools +, wheel , aiohttp , diskcache , gptcache @@ -9,9 +13,9 @@ , nest-asyncio , numpy , openai +, ordered-set , platformdirs -, pygtrie -, pyparsing +, pyformlang , requests , tiktoken , torch @@ -19,16 +23,24 @@ buildPythonPackage rec { pname = "guidance"; - version = "0.0.64"; - format = "setuptools"; + version = "0.1.6"; + pyproject = true; + + disabled = pythonOlder "3.8"; src = fetchFromGitHub { - owner = "microsoft"; + owner = "guidance-ai"; repo = "guidance"; rev = "refs/tags/${version}"; - hash = "sha256-tQpDJprxctKI88F+CZ9aSJbVo7tjmI4+VrI+WO4QlxE="; + hash = "sha256-Z3EuHAQPPXf/i0HnbDhGv5KBUBP0aZDHTwpff7g2E3g="; }; + nativeBuildInputs = [ + pybind11 + setuptools + wheel + ]; + propagatedBuildInputs = [ aiohttp diskcache @@ -37,9 +49,9 @@ buildPythonPackage rec { nest-asyncio numpy openai + ordered-set platformdirs - pygtrie - pyparsing + pyformlang requests tiktoken ]; @@ -51,17 +63,21 @@ buildPythonPackage rec { disabledTests = [ # require network access - "test_each_parallel_with_gen_openai" + "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" ]; disabledTestPaths = [ # require network access "tests/library/test_gen.py" - "tests/library/test_include.py" - "tests/library/test_select.py" - "tests/llms/test_openai.py" - "tests/llms/test_transformers.py" - "tests/test_program.py" ]; preCheck = '' @@ -72,8 +88,8 @@ buildPythonPackage rec { meta = with lib; { description = "A guidance language for controlling large language models"; - homepage = "https://github.com/microsoft/guidance"; - changelog = "https://github.com/microsoft/guidance/releases/tag/${src.rev}"; + homepage = "https://github.com/guidance-ai/guidance"; + changelog = "https://github.com/guidance-ai/guidance/releases/tag/${src.rev}"; license = licenses.mit; maintainers = with maintainers; [ natsukium ]; }; diff --git a/pkgs/development/python-modules/pyformlang/default.nix b/pkgs/development/python-modules/pyformlang/default.nix new file mode 100644 index 000000000000..d4a055d459cd --- /dev/null +++ b/pkgs/development/python-modules/pyformlang/default.nix @@ -0,0 +1,45 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools +, wheel +, networkx +, numpy +, pydot +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "pyformlang"; + version = "1.0.4"; + pyproject = true; + + src = fetchPypi { + inherit pname version; + hash = "sha256-ysX6c8q26bcQyq6GgKBKxTdp00j+4ypb3mgM2cqCmBs="; + }; + + nativeBuildInputs = [ + setuptools + wheel + ]; + + propagatedBuildInputs = [ + networkx + numpy + pydot + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ "pyformlang" ]; + + meta = with lib; { + description = "A python framework for formal grammars"; + homepage = "https://pypi.org/project/pyformlang/"; + license = licenses.mit; + maintainers = with maintainers; [ natsukium ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6929933a5089..3acf0a2ac5dd 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9319,6 +9319,8 @@ self: super: with self; { pyfluidsynth = callPackage ../development/python-modules/pyfluidsynth { }; + pyformlang = callPackage ../development/python-modules/pyformlang { }; + pyfreedompro = callPackage ../development/python-modules/pyfreedompro { }; pygments-style-github = callPackage ../development/python-modules/pygments-style-github { };