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.5";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "openfga";
25 repo = "python-sdk";
26 tag = "v${version}";
27 hash = "sha256-e/Pgyj7A1HtcDPeRy0QK+Nok2ruWBiU9A1Yh7RZvtVI=";
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 ]
47 ++ lib.optionals (pythonAtLeast "3.13") [ pytest-asyncio ];
48
49 disabledTests = lib.optionals (pythonAtLeast "3.13") [
50 # These fail due to a race condition in the test mocks
51 "test_client_batch_check_multiple_request"
52 "test_client_batch_check_multiple_request_fail"
53 ];
54
55 meta = {
56 changelog = "https://github.com/openfga/python-sdk/blob/${src.tag}/CHANGELOG.md";
57 description = "Fine-Grained Authorization solution for Python";
58 homepage = "https://github.com/openfga/python-sdk";
59 license = lib.licenses.asl20;
60 maintainers = with lib.maintainers; [ nicklewis ];
61 };
62}