1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pythonOlder,
6
7 withCExtensions ? true,
8
9 # build-system
10 setuptools,
11 setuptools-scm,
12
13 # tests
14 hypothesis,
15 pytest-cov-stub,
16 pytestCheckHook,
17}:
18
19buildPythonPackage rec {
20 pname = "cbor2";
21 version = "5.6.5";
22 pyproject = true;
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-toKCBnfuHbukX32hGJjScg+S4Gvjas7CkIZ9Xr89fgk=";
29 };
30
31 build-system = [
32 setuptools
33 setuptools-scm
34 ];
35
36 pythonImportsCheck = [ "cbor2" ];
37
38 nativeCheckInputs = [
39 hypothesis
40 pytest-cov-stub
41 pytestCheckHook
42 ];
43
44 env = lib.optionalAttrs (!withCExtensions) {
45 CBOR2_BUILD_C_EXTENSION = "0";
46 };
47
48 passthru = {
49 inherit withCExtensions;
50 };
51
52 meta = with lib; {
53 changelog = "https://github.com/agronholm/cbor2/releases/tag/${version}";
54 description = "Python CBOR (de)serializer with extensive tag support";
55 mainProgram = "cbor2";
56 homepage = "https://github.com/agronholm/cbor2";
57 license = licenses.mit;
58 maintainers = [ ];
59 };
60}