1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 marshmallow,
6 pytestCheckHook,
7 pythonAtLeast,
8 pythonOlder,
9 setuptools,
10 typeguard,
11 typing-extensions,
12 typing-inspect,
13}:
14
15buildPythonPackage rec {
16 pname = "marshmallow-dataclass";
17 version = "8.7.1";
18 pyproject = true;
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "lovasoa";
24 repo = "marshmallow_dataclass";
25 tag = "v${version}";
26 hash = "sha256-0OXP78oyNe/UcI05NHskPyXAuX3dwAW4Uz4dI4b8KV0=";
27 };
28
29 build-system = [ setuptools ];
30
31 dependencies = [
32 marshmallow
33 typing-inspect
34 ]
35 ++ lib.optionals (pythonOlder "3.10") [ typing-extensions ];
36
37 nativeCheckInputs = [
38 pytestCheckHook
39 typeguard
40 ];
41
42 pytestFlags = [
43 # DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12.
44 "-Wignore::DeprecationWarning"
45 ];
46
47 disabledTests = lib.optionals (pythonAtLeast "3.10") [
48 # TypeError: UserId is not a dataclass and cannot be turned into one.
49 "test_newtype"
50 ];
51
52 pythonImportsCheck = [ "marshmallow_dataclass" ];
53
54 meta = with lib; {
55 description = "Automatic generation of marshmallow schemas from dataclasses";
56 homepage = "https://github.com/lovasoa/marshmallow_dataclass";
57 changelog = "https://github.com/lovasoa/marshmallow_dataclass/blob/v${version}/CHANGELOG.md";
58 license = licenses.mit;
59 maintainers = with maintainers; [ fab ];
60 };
61}