nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hypothesis,
6 marshmallow,
7 poetry-core,
8 poetry-dynamic-versioning,
9 pytestCheckHook,
10 typing-inspect,
11}:
12
13buildPythonPackage rec {
14 pname = "dataclasses-json";
15 version = "0.6.7";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "lidatong";
20 repo = "dataclasses-json";
21 tag = "v${version}";
22 hash = "sha256-AH/T6pa/CHtQNox67fqqs/BBnUcmThvbnSHug2p33qM=";
23 };
24
25 patches = [
26 ./marshmallow-4.0-compat.patch
27 # https://github.com/lidatong/dataclasses-json/pull/565
28 ./python-3.14-compat.patch
29 ];
30
31 postPatch = ''
32 substituteInPlace pyproject.toml \
33 --replace-fail 'documentation =' 'Documentation =' \
34 --replace-fail 'version = "0.0.0"' 'version = "${version}"'
35 '';
36
37 build-system = [
38 poetry-core
39 poetry-dynamic-versioning
40 ];
41
42 pythonRelaxDeps = [ "marshmallow" ];
43
44 dependencies = [
45 typing-inspect
46 marshmallow
47 ];
48
49 nativeCheckInputs = [
50 hypothesis
51 pytestCheckHook
52 ];
53
54 disabledTests = [
55 # fails to deserialize None with marshmallow 4.0
56 "test_deserialize"
57 ];
58
59 disabledTestPaths = [
60 # fails with the following error and avoid dependency on mypy
61 # mypy_main(None, text_io, text_io, [__file__], clean_exit=True)
62 # TypeError: main() takes at most 4 arguments (5 given)
63 "tests/test_annotations.py"
64 ];
65
66 pythonImportsCheck = [ "dataclasses_json" ];
67
68 meta = {
69 description = "Simple API for encoding and decoding dataclasses to and from JSON";
70 homepage = "https://github.com/lidatong/dataclasses-json";
71 changelog = "https://github.com/lidatong/dataclasses-json/releases/tag/v${version}";
72 license = lib.licenses.mit;
73 maintainers = with lib.maintainers; [ albakham ];
74 };
75}