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