Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 anyio, 4 buildPythonPackage, 5 cached-property, 6 dirty-equals, 7 distro, 8 fetchFromGitHub, 9 hatch-fancy-pypi-readme, 10 hatchling, 11 httpx, 12 numpy, 13 pandas, 14 pandas-stubs, 15 pydantic, 16 pytest-asyncio, 17 pytest-mock, 18 pytestCheckHook, 19 pythonOlder, 20 respx, 21 sniffio, 22 tqdm, 23 typing-extensions, 24}: 25 26buildPythonPackage rec { 27 pname = "openai"; 28 version = "1.37.0"; 29 pyproject = true; 30 31 disabled = pythonOlder "3.7.1"; 32 33 src = fetchFromGitHub { 34 owner = "openai"; 35 repo = "openai-python"; 36 rev = "refs/tags/v${version}"; 37 hash = "sha256-hvzXOMEBDYVhmAJQDKYLO6HZMoRbGPTkXfoHdjysvlQ="; 38 }; 39 40 build-system = [ 41 hatchling 42 hatch-fancy-pypi-readme 43 ]; 44 45 dependencies = [ 46 httpx 47 pydantic 48 typing-extensions 49 anyio 50 distro 51 sniffio 52 tqdm 53 ] ++ lib.optionals (pythonOlder "3.8") [ cached-property ]; 54 55 passthru.optional-dependencies = { 56 datalib = [ 57 numpy 58 pandas 59 pandas-stubs 60 ]; 61 }; 62 63 pythonImportsCheck = [ "openai" ]; 64 65 nativeCheckInputs = [ 66 pytestCheckHook 67 pytest-asyncio 68 pytest-mock 69 respx 70 dirty-equals 71 ]; 72 73 pytestFlagsArray = [ 74 "-W" 75 "ignore::DeprecationWarning" 76 ]; 77 78 disabledTests = [ 79 # Tests make network requests 80 "test_streaming_response" 81 "test_copy_build_request" 82 83 # Test fails with pytest>=8 84 "test_basic_attribute_access_works" 85 ]; 86 87 disabledTestPaths = [ 88 # Test makes network requests 89 "tests/api_resources" 90 ]; 91 92 meta = with lib; { 93 description = "Python client library for the OpenAI API"; 94 homepage = "https://github.com/openai/openai-python"; 95 changelog = "https://github.com/openai/openai-python/releases/tag/v${version}"; 96 license = licenses.mit; 97 maintainers = with maintainers; [ malo ]; 98 mainProgram = "openai"; 99 }; 100}