1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hatchling,
6 django,
7 freezegun,
8 qrcode,
9 pytest,
10 python,
11}:
12
13buildPythonPackage rec {
14 pname = "django-otp";
15 version = "1.6.1";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "django-otp";
20 repo = "django-otp";
21 tag = "v${version}";
22 hash = "sha256-//i2KSsrkofcNE2JUlIG9zPCe/cIzBo/zmueC4I5g7I=";
23 };
24
25 build-system = [ hatchling ];
26
27 dependencies = [
28 django
29 qrcode
30 ];
31
32 env.DJANGO_SETTINGS_MODUOLE = "test.test_project.settings";
33
34 nativeCheckInputs = [
35 freezegun
36 pytest
37 ];
38
39 checkPhase = ''
40 runHook preCheck
41
42 export PYTHONPATH=$PYTHONPATH:test
43 export DJANGO_SETTINGS_MODULE=test_project.settings
44 ${python.interpreter} -m django test django_otp
45
46 runHook postCheck
47 '';
48
49 enabledTestPaths = [ "src/django_otp/test.py" ];
50
51 pythonImportsCheck = [ "django_otp" ];
52
53 meta = with lib; {
54 homepage = "https://github.com/django-otp/django-otp";
55 changelog = "https://github.com/django-otp/django-otp/blob/${src.tag}/CHANGES.rst";
56 description = "Pluggable framework for adding two-factor authentication to Django using one-time passwords";
57 license = licenses.bsd2;
58 maintainers = [ ];
59 };
60}