Files
2026-07-08 19:21:38 -07:00

56 lines
1.4 KiB
Nix

{
lib,
fetchFromGitHub,
fetchpatch,
buildPythonPackage,
pytestCheckHook,
pythonAtLeast,
setuptools,
}:
buildPythonPackage rec {
pname = "dacite";
version = "1.9.2";
pyproject = true;
src = fetchFromGitHub {
owner = "konradhalas";
repo = "dacite";
tag = "v${version}";
hash = "sha256-mAPqWvBpkTbtzHpwtCSDXMNkoc8/hbRH3OIEeK2yStU=";
};
patches = [
(fetchpatch {
name = "fix-version-in-setup.py.patch";
url = "https://github.com/konradhalas/dacite/commit/daad7e4a15569321d3cf118f8083a71a65d7e044.patch";
hash = "sha256-5udIgEf2P9SCZVGnPg/rMtFtkPJyLw9RWvVO47BddK8=";
})
];
postPatch = ''
substituteInPlace pyproject.toml \
--replace "--benchmark-autosave --benchmark-json=benchmark.json" ""
''
+ lib.optionalString (pythonAtLeast "3.14") ''
substituteInPlace tests/core/test_union.py \
--replace-fail "typing.Union[int, str]" "int | str"
'';
build-system = [ setuptools ];
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "dacite" ];
disabledTestPaths = [ "tests/performance" ];
meta = {
description = "Python helper to create data classes from dictionaries";
homepage = "https://github.com/konradhalas/dacite";
changelog = "https://github.com/konradhalas/dacite/blob/v${version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ fab ];
};
}