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 pytestFlags = [
45 # pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is
46 # deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from
47 # the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
48 "-Wignore::pydantic.warnings.PydanticDeprecatedSince211"
49 ];
50
51 meta = {
52 description = "Compatibility layer for pydantic v1/v2";
53 homepage = "https://github.com/pyapp-kit/pydantic-compat";
54 changelog = "https://github.com/pyapp-kit/pydantic-compat/releases/tag/v${version}";
55 license = lib.licenses.bsd3;
56 maintainers = with lib.maintainers; [ fab ];
57 };
58}