1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hatch-vcs,
6 hatchling,
7 gitMinimal,
8 importlib-metadata,
9 pydantic,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "pydantic-compat";
15 version = "0.1.2";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "pyapp-kit";
20 repo = "pydantic-compat";
21 tag = "v${version}";
22 leaveDotGit = true;
23 hash = "sha256-YJUfWu+nyGlwpJpxYghCKzj3CasdAaqYoNVCcfo/7YE=";
24 };
25
26 build-system = [
27 hatch-vcs
28 hatchling
29 ];
30
31 nativeBuildInputs = [
32 gitMinimal
33 ];
34
35 dependencies = [
36 importlib-metadata
37 pydantic
38 ];
39
40 pythonImportsCheck = [ "pydantic_compat" ];
41
42 nativeCheckInputs = [ pytestCheckHook ];
43
44 pytestFlagsArray = [
45 "-W"
46 # pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is
47 # deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from
48 # the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
49 "ignore::pydantic.warnings.PydanticDeprecatedSince211"
50 ];
51
52 meta = {
53 description = "Compatibility layer for pydantic v1/v2";
54 homepage = "https://github.com/pyapp-kit/pydantic-compat";
55 changelog = "https://github.com/pyapp-kit/pydantic-compat/releases/tag/v${version}";
56 license = lib.licenses.bsd3;
57 maintainers = with lib.maintainers; [ fab ];
58 };
59}