1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6 pytest-timeout,
7 pytestCheckHook,
8 pytest-cov-stub,
9 pythonOlder,
10 setuptools,
11 setuptools-scm,
12 bashInteractive,
13}:
14
15buildPythonPackage rec {
16 pname = "shtab";
17 version = "1.7.2";
18 pyproject = true;
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "iterative";
24 repo = "shtab";
25 tag = "v${version}";
26 hash = "sha256-ngTAST+6lBek0PHvULmlJZAHVU49YN5+XAu5KEk6cIM=";
27 };
28
29 patches = [
30 # Fix bash error on optional nargs="?" (iterative/shtab#184)
31 (fetchpatch2 {
32 url = "https://github.com/iterative/shtab/commit/a04ddf92896f7e206c9b19d48dcc532765364c59.patch?full_index=1";
33 hash = "sha256-H4v81xQLI9Y9R5OyDPJevCLh4gIUaiJKHVEU/eWdNbA=";
34 })
35 ];
36
37 nativeBuildInputs = [
38 setuptools
39 setuptools-scm
40 ];
41
42 nativeCheckInputs = [
43 bashInteractive
44 pytest-timeout
45 pytestCheckHook
46 pytest-cov-stub
47 ];
48
49 pythonImportsCheck = [ "shtab" ];
50
51 meta = with lib; {
52 description = "Module for shell tab completion of Python CLI applications";
53 mainProgram = "shtab";
54 homepage = "https://docs.iterative.ai/shtab/";
55 changelog = "https://github.com/iterative/shtab/releases/tag/${src.tag}";
56 license = licenses.asl20;
57 maintainers = with maintainers; [ fab ];
58 };
59}