1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
|
[build-system]
build-backend = "hatchling.build"
requires = [
"hatch-vcs>=0.4",
"hatchling>=1.25",
]
[project]
name = "datamodel-code-generator"
description = "Datamodel Code Generator"
readme.content-type = "text/markdown"
readme.file = "README.md"
license = "MIT"
authors = [ { name = "Koudai Aono", email = "koxudaxi@gmail.com" } ]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
]
dynamic = [
"version",
]
dependencies = [
"argcomplete>=2.10.1,<4",
"black>=19.10b0",
"genson>=1.2.1,<2",
"inflect>=4.1,<8",
"isort>=4.3.21,<7",
"jinja2>=2.10.1,<4",
"packaging",
"pydantic>=1.5",
"pyyaml>=6.0.1",
"tomli>=2.2.1,<3; python_version<='3.11'",
]
optional-dependencies.all = [
"datamodel-code-generator[debug]",
"datamodel-code-generator[graphql]",
"datamodel-code-generator[http]",
"datamodel-code-generator[ruff]",
"datamodel-code-generator[validation]",
]
optional-dependencies.debug = [
"pysnooper>=0.4.1,<2",
]
optional-dependencies.graphql = [
"graphql-core>=3.2.3",
]
optional-dependencies.http = [
"httpx>=0.24.1",
]
optional-dependencies.ruff = [
"ruff>=0.9.10",
]
optional-dependencies.validation = [
"openapi-spec-validator>=0.2.8,<0.7",
"prance>=0.18.2",
]
urls.Homepage = "https://github.com/koxudaxi/datamodel-code-generator"
urls.Source = "https://github.com/koxudaxi/datamodel-code-generator"
scripts.datamodel-codegen = "datamodel_code_generator.__main__:main"
[dependency-groups]
dev = [
{ include-group = "coverage" },
{ include-group = "docs" },
{ include-group = "fix" },
{ include-group = "pkg-meta" },
{ include-group = "test" },
{ include-group = "type" },
]
test = [
"freezegun",
"pytest>=6.1",
"pytest>=8.3.4",
"pytest-benchmark",
"pytest-codspeed>=2.2",
"pytest-cov>=2.12.1",
"pytest-cov>=5",
"pytest-mock>=3.14",
"pytest-xdist>=3.3.1",
"setuptools; python_version<'3.10'", # PyCharm debugger needs it
{ include-group = "coverage" },
]
type = [
"pyright>=1.1.393",
"types-jinja2",
"types-pyyaml",
"types-setuptools>=67.6.0.5,<70",
"types-toml",
{ include-group = "test" },
]
docs = [
"mkdocs>=1.6",
"mkdocs-material>=9.5.31",
]
black22 = [ "black==22.1" ]
black23 = [ "black==23.12" ]
black24 = [ "black==24.1" ]
fix = [ "pre-commit-uv>=4.1.4" ]
pkg-meta = [ "check-wheel-contents>=0.6.1", "twine>=6.1", "uv>=0.5.22" ]
coverage = [
"covdefaults>=2.3",
"coverage[toml]>=7.6.1",
"diff-cover>=7.7",
]
[tool.hatch]
build.dev-mode-dirs = [ "src" ]
build.targets.sdist.include = [
"/src",
"/tests",
]
version.source = "vcs"
[tool.ruff]
line-length = 120
extend-exclude = [ "tests/data" ]
format.preview = true
format.docstring-code-format = true
lint.select = [
"ALL",
]
lint.ignore = [
"ANN401", # Any as type annotation is allowed
"C901", # complex structure
"COM812", # Conflict with formatter
"CPY", # No copyright statements
"D", # limited documentation
"DOC", # limited documentation
"FIX002", # line contains to do
"ISC001", # Conflict with formatter
"S101", # can use assert
"TD002", # missing to do author
"TD003", # missing to do link
"TD004", # missing colon in to do
]
lint.per-file-ignores."tests/**/*.py" = [
"FBT", # don't care about booleans as positional arguments in tests
"INP001", # no implicit namespace
"PLC2701", # private import is fine
"PLR0913", # as many arguments as want
"PLR0915", # can have longer test methods
"PLR0917", # as many arguments as want
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
"S", # no safety concerns
"SLF001", # can test private methods
]
lint.isort = { known-first-party = [
"datamodel_code_generator",
"tests",
], required-imports = [
"from __future__ import annotations",
] }
lint.preview = true
[tool.codespell]
skip = '.git,*.lock,tests'
[tool.pytest.ini_options]
filterwarnings = [
"error",
"ignore:^.*The `parse_obj` method is deprecated; use `model_validate` instead.*",
"ignore:^.*The `__fields_set__` attribute is deprecated, use `model_fields_set` instead.*",
"ignore:^.*The `dict` method is deprecated; use `model_dump` instead.*",
"ignore:^.*The `copy` method is deprecated; use `model_copy` instead.*",
"ignore:^.*`--validation` option is deprecated.*",
"ignore:^.*Field name `name` is duplicated on Pet.*",
"ignore:^.*format of 'unknown-type' not understood for 'string' - using default.*",
"ignore:^.*unclosed file.*",
"ignore:^.*black doesn't support `experimental-string-processing` option for wrapping string literal in .*",
"ignore:^.*jsonschema.exceptions.RefResolutionError is deprecated as of version 4.18.0. If you wish to catch potential reference resolution errors, directly catch referencing.exceptions.Unresolvable..*",
"ignore:^.*`experimental string processing` has been included in `preview` and deprecated. Use `preview` instead..*",
]
norecursedirs = "tests/data/*"
verbosity_assertions = 2
[tool.coverage]
html.skip_covered = false
html.show_contexts = false
paths.source = [
"src",
".tox*/*/lib/python*/site-packages",
".tox*\\*\\Lib\\site-packages",
"*/src",
"*\\src",
]
paths.other = [
".",
"*/datamodel-code-generator",
"*\\datamodel-code-generator",
]
run.dynamic_context = "none"
run.omit = [ "tests/data/*" ]
report.fail_under = 88
run.parallel = true
run.plugins = [
"covdefaults",
]
covdefaults.subtract_omit = "*/__main__.py"
[tool.pyright]
reportPrivateImportUsage = false
[tool.pydantic-pycharm-plugin]
ignore-init-method-arguments = true
parsable-types.str = [ "int", "float" ]
[tool.uv]
conflicts = [
[
{ group = "black24" },
{ group = "black22" },
{ group = "black23" },
{ group = "dev" },
],
]
|