1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4
5# build-system
6, setuptools
7
8# dependencies
9, ecdsa
10, rsa
11, pyasn1
12
13# optional-dependencies
14, cryptography
15, pycrypto
16, pycryptodome
17
18# tests
19, pytestCheckHook
20}:
21
22buildPythonPackage rec {
23 pname = "python-jose";
24 version = "3.3.0";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "mpdavis";
29 repo = pname;
30 rev = version;
31 hash = "sha256-6VGC6M5oyGCOiXcYp6mpyhL+JlcYZKIqOQU9Sm/TkKM=";
32 };
33
34 postPatch = ''
35 substituteInPlace setup.py \
36 --replace '"pytest-runner",' ""
37 '';
38
39 nativeBuildInputs = [
40 setuptools
41 ];
42
43 propagatedBuildInputs = [
44 ecdsa
45 pyasn1
46 rsa
47 ];
48
49 passthru.optional-dependencies = {
50 cryptography = [
51 cryptography
52 ];
53 pycrypto = [
54 pycrypto
55 ];
56 pycryptodome = [
57 pycryptodome
58 ];
59 };
60
61 pythonImportsCheck = [
62 "jose"
63 ];
64
65 nativeCheckInputs = [
66 pytestCheckHook
67 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
68
69 meta = with lib; {
70 changelog = "https://github.com/mpdavis/python-jose/releases/tag/${version}";
71 homepage = "https://github.com/mpdavis/python-jose";
72 description = "A JOSE implementation in Python";
73 license = licenses.mit;
74 maintainers = with maintainers; [ jhhuh ];
75 };
76}