1{
2 lib,
3 argcomplete,
4 black,
5 buildPythonPackage,
6 fetchFromGitHub,
7 freezegun,
8 genson,
9 graphql-core,
10 hatch-vcs,
11 hatchling,
12 httpx,
13 inflect,
14 isort,
15 jinja2,
16 openapi-spec-validator,
17 packaging,
18 prance,
19 ruff,
20 pydantic,
21 pytest-benchmark,
22 pytest-mock,
23 pytestCheckHook,
24 pyyaml,
25 toml,
26}:
27
28buildPythonPackage rec {
29 pname = "datamodel-code-generator";
30 version = "0.34.0";
31 pyproject = true;
32
33 src = fetchFromGitHub {
34 owner = "koxudaxi";
35 repo = "datamodel-code-generator";
36 tag = version;
37 hash = "sha256-fJ7+TtWLJXBaTil0LGsCyu9njDuj1pOVUZYN2huoKao=";
38 };
39
40 pythonRelaxDeps = [
41 "inflect"
42 "isort"
43 ];
44
45 build-system = [
46 hatchling
47 hatch-vcs
48 ];
49
50 dependencies = [
51 argcomplete
52 black
53 genson
54 inflect
55 isort
56 jinja2
57 packaging
58 pydantic
59 pyyaml
60 toml
61 ];
62
63 optional-dependencies = {
64 graphql = [ graphql-core ];
65 http = [ httpx ];
66 ruff = [ ruff ];
67 validation = [
68 openapi-spec-validator
69 prance
70 ];
71 };
72
73 nativeCheckInputs = [
74 freezegun
75 pytest-benchmark
76 pytest-mock
77 pytestCheckHook
78 ]
79 ++ lib.flatten (builtins.attrValues optional-dependencies);
80
81 pythonImportsCheck = [ "datamodel_code_generator" ];
82
83 disabledTests = [
84 # remote testing, name resolution failure.
85 "test_openapi_parser_parse_remote_ref"
86 ];
87
88 meta = {
89 description = "Pydantic model and dataclasses.dataclass generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources";
90 homepage = "https://github.com/koxudaxi/datamodel-code-generator";
91 changelog = "https://github.com/koxudaxi/datamodel-code-generator/releases/tag/${src.tag}";
92 license = lib.licenses.mit;
93 maintainers = with lib.maintainers; [ tochiaha ];
94 mainProgram = "datamodel-code-generator";
95 };
96}