summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pydantic-compat/default.nix
blob: db5ef91c20bb45947120326db393e751ea0a8cb7 (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  hatch-vcs,
  hatchling,
  gitMinimal,
  importlib-metadata,
  pydantic,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "pydantic-compat";
  version = "0.1.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "pyapp-kit";
    repo = "pydantic-compat";
    tag = "v${version}";
    leaveDotGit = true;
    hash = "sha256-YJUfWu+nyGlwpJpxYghCKzj3CasdAaqYoNVCcfo/7YE=";
  };

  build-system = [
    hatch-vcs
    hatchling
  ];

  nativeBuildInputs = [
    gitMinimal
  ];

  dependencies = [
    importlib-metadata
    pydantic
  ];

  pythonImportsCheck = [ "pydantic_compat" ];

  nativeCheckInputs = [ pytestCheckHook ];

  pytestFlags = [
    # pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is
    # deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from
    # the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
    "-Wignore::pydantic.warnings.PydanticDeprecatedSince211"
  ];

  meta = {
    description = "Compatibility layer for pydantic v1/v2";
    homepage = "https://github.com/pyapp-kit/pydantic-compat";
    changelog = "https://github.com/pyapp-kit/pydantic-compat/releases/tag/v${version}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ fab ];
  };
}