python3Packages.datamodel-code-generator: cleanup

This commit is contained in:
Gaetan Lepage
2026-08-01 12:39:52 +00:00
parent 7dd97ddbcf
commit 6bd80a1daf

View File

@@ -1,59 +1,70 @@
{
lib,
argcomplete,
black,
buildPythonPackage,
email-validator,
fetchFromGitHub,
genson,
graphql-core,
grpcio-tools,
# build-system
hatch-vcs,
hatchling,
# dependencies
argcomplete,
black,
genson,
inflect,
isort,
jinja2,
packaging,
pydantic,
pyyaml,
# optional-dependencies
# debug:
pysnooper,
# graphql:
graphql-core,
# http:
httpx,
# protobuf:
grpcio-tools,
# ruff:
ruff,
# validation:
openapi-spec-validator,
prance,
# watch:
watchfiles,
# tests
email-validator,
hypothesis,
hypothesis-jsonschema,
inflect,
inline-snapshot,
isort,
jsonschema,
msgspec,
jinja2,
openapi-spec-validator,
packaging,
prance,
ruff,
pydantic,
pysnooper,
pytest-mock,
pytest-timeout,
pytest-xdist,
pytestCheckHook,
pyyaml,
time-machine,
watchfiles,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "datamodel-code-generator";
version = "0.71.0";
pyproject = true;
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "koxudaxi";
repo = "datamodel-code-generator";
tag = version;
tag = finalAttrs.version;
hash = "sha256-0vh/iynZzmMzvdUXNScb+JWANdSrzPLT1qt+jyKleg4=";
};
pythonRelaxDeps = [
"inflect"
"isort"
];
build-system = [
hatchling
hatch-vcs
hatchling
];
dependencies = [
@@ -68,8 +79,7 @@ buildPythonPackage rec {
pyyaml
];
optional-dependencies = {
all = lib.concatAttrValues (lib.removeAttrs optional-dependencies [ "all" ]);
optional-dependencies = lib.fix (self: {
debug = [ pysnooper ];
graphql = [ graphql-core ];
http = [ httpx ];
@@ -82,13 +92,13 @@ buildPythonPackage rec {
watch = [
watchfiles
];
};
});
nativeCheckInputs = [
email-validator
inline-snapshot
hypothesis
hypothesis-jsonschema
inline-snapshot
jsonschema
msgspec
pytest-mock
@@ -97,11 +107,7 @@ buildPythonPackage rec {
pytestCheckHook
time-machine
]
++ optional-dependencies.all;
pytestFlags = [
"--maxfail=2"
];
++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies;
disabledTests = [
# remote testing, name resolution failure.
@@ -113,9 +119,9 @@ buildPythonPackage rec {
meta = {
description = "Pydantic model and dataclasses.dataclass generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources";
homepage = "https://github.com/koxudaxi/datamodel-code-generator";
changelog = "https://github.com/koxudaxi/datamodel-code-generator/releases/tag/${src.tag}";
changelog = "https://github.com/koxudaxi/datamodel-code-generator/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ tochiaha ];
mainProgram = "datamodel-code-generator";
};
}
})