1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 hatchling,
7 ncurses,
8 procps,
9 pytest-rerunfailures,
10 pytestCheckHook,
11 tmux,
12}:
13
14buildPythonPackage rec {
15 pname = "libtmux";
16 version = "0.46.2";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "tmux-python";
21 repo = "libtmux";
22 tag = "v${version}";
23 hash = "sha256-M3su+bDFuvmNEDVK+poWfxwbpsw/0L1/R6Z4CL0mvZ4=";
24 };
25
26 postPatch = ''
27 substituteInPlace pyproject.toml \
28 --replace-fail '"--doctest-docutils-modules",' ""
29 '';
30
31 build-system = [ hatchling ];
32
33 nativeCheckInputs = [
34 procps
35 tmux
36 ncurses
37 pytest-rerunfailures
38 pytestCheckHook
39 ];
40
41 enabledTestPaths = [ "tests" ];
42
43 disabledTests = [
44 # Fail with: 'no server running on /tmp/tmux-1000/libtmux_test8sorutj1'.
45 "test_new_session_width_height"
46 # Assertion error
47 "test_capture_pane_start"
48 ]
49 ++ lib.optionals stdenv.hostPlatform.isDarwin [
50 # tests/test_pane.py:113: AssertionError
51 "test_capture_pane_start"
52 # assert (1740973920.500444 - 1740973919.015309) <= 1.1
53 "test_retry_three_times"
54 "test_function_times_out_no_raise"
55 # assert False
56 "test_retry_three_times_no_raise_assert"
57 ];
58
59 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [ "tests/test/test_retry.py" ];
60
61 pythonImportsCheck = [ "libtmux" ];
62
63 meta = {
64 description = "Typed scripting library / ORM / API wrapper for tmux";
65 homepage = "https://libtmux.git-pull.com/";
66 changelog = "https://github.com/tmux-python/libtmux/raw/v${version}/CHANGES";
67 license = lib.licenses.mit;
68 maintainers = with lib.maintainers; [ otavio ];
69 };
70}