about summary refs log tree commit diff
path: root/pkgs/development/python-modules/result/default.nix
blob: db123e0310675b2262ba64459938b2d900fd333c (plain) (blame)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pytestCheckHook,
  pytest-asyncio,
  nix-update-script,
  setuptools,
  wheel,
}:

buildPythonPackage rec {
  pname = "result";
  version = "0.17.0";
  pyproject = true;
  build-system = [
    setuptools
    wheel
  ];

  src = fetchFromGitHub {
    owner = "rustedpy";
    repo = "result";
    rev = "v${version}";
    hash = "sha256-o+7qKxGQCeMUnsmEReggvf+XwQWFHRCYArYk3DxCa50=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace '"--flake8",' "" \
      --replace '"--tb=short",' "" \
      --replace '"--cov=result",' "" \
      --replace '"--cov=tests",' "" \
      --replace '"--cov-report=term",' "" \
      --replace '"--cov-report=xml",' ""
  '';

  nativeCheckInputs = [
    pytestCheckHook
    pytest-asyncio
  ];

  passthru.updateScript = nix-update-script { };
  pythonImportsCheck = [ "result" ];

  meta = with lib; {
    description = "A simple Result type for Python 3 inspired by Rust, fully type annotated";
    homepage = "https://github.com/rustedpy/result";
    license = licenses.mit;
    maintainers = with lib.maintainers; [ emattiza ];
  };
}