1{
2 lib,
3 anyio,
4 buildPythonPackage,
5 fetchFromGitHub,
6 hishel,
7 httpx,
8 poetry-core,
9 pydantic,
10 pyjwt,
11 pytest-xdist,
12 pytestCheckHook,
13 pythonOlder,
14 typing-extensions,
15}:
16
17buildPythonPackage rec {
18 pname = "githubkit";
19 version = "0.11.4";
20 pyproject = true;
21
22 disabled = pythonOlder "3.8";
23
24 src = fetchFromGitHub {
25 owner = "yanyongyu";
26 repo = "githubkit";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-uxXRDavp5c3e1MOZR2B4wUxEHh6K81avTeaIVsOdup8=";
29 };
30
31 postPatch = ''
32 substituteInPlace pyproject.toml \
33 --replace-fail "--cov=githubkit --cov-append --cov-report=term-missing" ""
34 '';
35
36 build-system = [ poetry-core ];
37
38 dependencies = [
39 hishel
40 httpx
41 pydantic
42 typing-extensions
43 ];
44
45 passthru.optional-dependencies = {
46 all = [
47 anyio
48 pyjwt
49 ];
50 jwt = [ pyjwt ];
51 auth-app = [ pyjwt ];
52 auth-oauth-device = [ anyio ];
53 auth = [
54 anyio
55 pyjwt
56 ];
57 };
58
59 nativeCheckInputs = [
60 pytestCheckHook
61 pytest-xdist
62 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
63
64 pythonImportsCheck = [ "githubkit" ];
65
66 disabledTests = [
67 # Tests require network access
68 "test_graphql"
69 "test_async_graphql"
70 "test_call"
71 "test_async_call"
72 "test_versioned_call"
73 "test_versioned_async_call"
74 ];
75
76 meta = {
77 description = "GitHub SDK for Python";
78 homepage = "https://github.com/yanyongyu/githubkit";
79 changelog = "https://github.com/yanyongyu/githubkit/releases/tag/v${version}";
80 license = lib.licenses.mit;
81 maintainers = with lib.maintainers; [ kranzes ];
82 };
83}