1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchPypi,
6 google-api-python-client,
7 google-auth-oauthlib,
8 jupyterhub,
9 mwoauth,
10 pyjwt,
11 pytest-asyncio,
12 pytestCheckHook,
13 requests-mock,
14 setuptools,
15}:
16
17buildPythonPackage rec {
18 pname = "oauthenticator";
19 version = "16.3.0";
20 pyproject = true;
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-QMddGJUfafXoBxMCjlx1lH45a4Bab3AP4j8Px7JxYaQ=";
27 };
28
29 postPatch = ''
30 substituteInPlace pyproject.toml \
31 --replace-fail " --cov=oauthenticator" ""
32 '';
33
34 build-system = [ setuptools ];
35
36 dependencies = [
37 jupyterhub
38 pyjwt
39 ];
40
41 passthru.optional-dependencies = {
42 googlegroups = [
43 google-api-python-client
44 google-auth-oauthlib
45 ];
46 mediawiki = [ mwoauth ];
47 };
48
49 nativeCheckInputs = [
50 pytest-asyncio
51 pytestCheckHook
52 requests-mock
53 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
54
55 disabledTests = [
56 # Tests are outdated, https://github.com/jupyterhub/oauthenticator/issues/432
57 "test_azuread"
58 "test_mediawiki"
59 # Tests require network access
60 "test_allowed"
61 "test_auth0"
62 "test_bitbucket"
63 "test_cilogon"
64 "test_github"
65 "test_gitlab"
66 "test_globus"
67 "test_google"
68 "test_openshift"
69 ];
70
71 pythonImportsCheck = [ "oauthenticator" ];
72
73 meta = with lib; {
74 description = "Authenticate JupyterHub users with common OAuth providers";
75 homepage = "https://github.com/jupyterhub/oauthenticator";
76 changelog = "https://github.com/jupyterhub/oauthenticator/blob/${version}/docs/source/reference/changelog.md";
77 license = licenses.bsd3;
78 maintainers = with maintainers; [ ];
79 };
80}