1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pytest-asyncio,
7 nix-update-script,
8 setuptools,
9 wheel,
10}:
11
12buildPythonPackage rec {
13 pname = "result";
14 version = "0.17.0";
15 pyproject = true;
16 build-system = [
17 setuptools
18 wheel
19 ];
20
21 src = fetchFromGitHub {
22 owner = "rustedpy";
23 repo = "result";
24 rev = "v${version}";
25 hash = "sha256-o+7qKxGQCeMUnsmEReggvf+XwQWFHRCYArYk3DxCa50=";
26 };
27
28 postPatch = ''
29 substituteInPlace pyproject.toml \
30 --replace '"--flake8",' "" \
31 --replace '"--tb=short",' "" \
32 --replace '"--cov=result",' "" \
33 --replace '"--cov=tests",' "" \
34 --replace '"--cov-report=term",' "" \
35 --replace '"--cov-report=xml",' ""
36 '';
37
38 nativeCheckInputs = [
39 pytestCheckHook
40 pytest-asyncio
41 ];
42
43 passthru.updateScript = nix-update-script { };
44 pythonImportsCheck = [ "result" ];
45
46 meta = with lib; {
47 description = "A simple Result type for Python 3 inspired by Rust, fully type annotated";
48 homepage = "https://github.com/rustedpy/result";
49 license = licenses.mit;
50 maintainers = with lib.maintainers; [ emattiza ];
51 };
52}