1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 setuptools,
7 google-auth,
8 requests-oauthlib,
9 click,
10 mock,
11 pytestCheckHook,
12}:
13
14buildPythonPackage rec {
15 pname = "google-auth-oauthlib";
16 version = "1.2.2";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "googleapis";
21 repo = "google-auth-library-python-oauthlib";
22 rev = "v${version}";
23 sha256 = "sha256-nkXS1vNsq7k30EmNHclRblsmGTMYuIAaHuaVDORqRmc=";
24 };
25
26 build-system = [ setuptools ];
27
28 dependencies = [
29 google-auth
30 requests-oauthlib
31 ];
32
33 optional-dependencies = {
34 tool = [ click ];
35 };
36
37 nativeCheckInputs = [
38 mock
39 pytestCheckHook
40 ]
41 ++ optional-dependencies.tool;
42
43 disabledTests = [
44 # Flaky test. See https://github.com/NixOS/nixpkgs/issues/288424#issuecomment-1941609973.
45 "test_run_local_server_occupied_port"
46 ]
47 ++ lib.optionals stdenv.hostPlatform.isDarwin [
48 # This test fails if the hostname is not associated with an IP (e.g., in `/etc/hosts`).
49 "test_run_local_server_bind_addr"
50 ];
51
52 pythonImportsCheck = [ "google_auth_oauthlib" ];
53
54 __darwinAllowLocalNetworking = true;
55
56 meta = {
57 description = "Google Authentication Library: oauthlib integration";
58 homepage = "https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib";
59 changelog = "https://github.com/googleapis/google-auth-library-python-oauthlib/blob/v${version}/CHANGELOG.md";
60 license = lib.licenses.asl20;
61 maintainers = with lib.maintainers; [
62 sarahec
63 terlar
64 ];
65 mainProgram = "google-oauthlib-tool";
66 };
67}