1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonAtLeast,
6 pytestCheckHook,
7 aiohttp,
8 build,
9 mock,
10 opentelemetry-api,
11 pytest-asyncio,
12 pytest-cov-stub,
13 python-dateutil,
14 setuptools,
15 urllib3,
16}:
17
18buildPythonPackage rec {
19 pname = "openfga-sdk";
20 version = "0.9.1";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "openfga";
25 repo = "python-sdk";
26 tag = "v${version}";
27 hash = "sha256-+4Np406HAB6uHZhDUUSn9aDbuC4/G172+TZ560rYjlk=";
28 };
29
30 build-system = [ setuptools ];
31
32 dependencies = [
33 aiohttp
34 build
35 opentelemetry-api
36 python-dateutil
37 urllib3
38 ];
39
40 pythonImportsCheck = [ "openfga_sdk" ];
41
42 nativeCheckInputs = [
43 mock
44 pytest-cov-stub
45 pytestCheckHook
46 ] ++ lib.optionals (pythonAtLeast "3.13") [ pytest-asyncio ];
47
48 disabledTests = lib.optionals (pythonAtLeast "3.13") [
49 # These fail due to a race condition in the test mocks
50 "test_client_batch_check_multiple_request"
51 "test_client_batch_check_multiple_request_fail"
52 ];
53
54 meta = {
55 changelog = "https://github.com/openfga/python-sdk/blob/v${version}/CHANGELOG.md";
56 description = "Fine-Grained Authorization solution for Python";
57 homepage = "https://github.com/openfga/python-sdk";
58 license = lib.licenses.asl20;
59 maintainers = with lib.maintainers; [ nicklewis ];
60 };
61}