ianux 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. ianux-0.2.0/LICENSE +21 -0
  2. ianux-0.2.0/PKG-INFO +65 -0
  3. ianux-0.2.0/README.md +55 -0
  4. ianux-0.2.0/pyproject.toml +26 -0
  5. ianux-0.2.0/setup.cfg +4 -0
  6. ianux-0.2.0/src/ianux/__init__.py +3 -0
  7. ianux-0.2.0/src/ianux/__main__.py +63 -0
  8. ianux-0.2.0/src/ianux/attacher.py +65 -0
  9. ianux-0.2.0/src/ianux/cli.py +757 -0
  10. ianux-0.2.0/src/ianux/config.py +193 -0
  11. ianux-0.2.0/src/ianux/directory.py +35 -0
  12. ianux-0.2.0/src/ianux/dumper.py +111 -0
  13. ianux-0.2.0/src/ianux/exceptions.py +5 -0
  14. ianux-0.2.0/src/ianux/killer.py +265 -0
  15. ianux-0.2.0/src/ianux/lister.py +190 -0
  16. ianux-0.2.0/src/ianux/loader.py +220 -0
  17. ianux-0.2.0/src/ianux/picker.py +50 -0
  18. ianux-0.2.0/src/ianux/runner.py +276 -0
  19. ianux-0.2.0/src/ianux/session.py +150 -0
  20. ianux-0.2.0/src/ianux/tmux.py +323 -0
  21. ianux-0.2.0/src/ianux.egg-info/PKG-INFO +65 -0
  22. ianux-0.2.0/src/ianux.egg-info/SOURCES.txt +39 -0
  23. ianux-0.2.0/src/ianux.egg-info/dependency_links.txt +1 -0
  24. ianux-0.2.0/src/ianux.egg-info/entry_points.txt +2 -0
  25. ianux-0.2.0/src/ianux.egg-info/top_level.txt +1 -0
  26. ianux-0.2.0/tests/test_attacher_e2e.py +110 -0
  27. ianux-0.2.0/tests/test_cli.py +391 -0
  28. ianux-0.2.0/tests/test_config.py +50 -0
  29. ianux-0.2.0/tests/test_directory.py +41 -0
  30. ianux-0.2.0/tests/test_dumper.py +27 -0
  31. ianux-0.2.0/tests/test_dumper_e2e.py +128 -0
  32. ianux-0.2.0/tests/test_killer.py +39 -0
  33. ianux-0.2.0/tests/test_killer_e2e.py +149 -0
  34. ianux-0.2.0/tests/test_loader.py +242 -0
  35. ianux-0.2.0/tests/test_main.py +101 -0
  36. ianux-0.2.0/tests/test_picker.py +41 -0
  37. ianux-0.2.0/tests/test_runner.py +115 -0
  38. ianux-0.2.0/tests/test_runner_e2e.py +104 -0
  39. ianux-0.2.0/tests/test_session.py +98 -0
  40. ianux-0.2.0/tests/test_session_e2e.py +178 -0
  41. ianux-0.2.0/tests/test_tmux.py +170 -0
ianux-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rafael Eckstein
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
ianux-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: ianux
3
+ Version: 0.2.0
4
+ Summary: A quick-to-use tmux wrapper for managing sessions.
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Dynamic: license-file
10
+
11
+ <div align="center">
12
+ <img src="assets/ianux-logo.png" alt="Ianux logo" width="180">
13
+ <h1>Ianux</h1>
14
+ <p>A quick-to-use tmux wrapper for managing sessions.</p>
15
+ </div>
16
+
17
+ Ianux is a quick-to-use Python command-line tool for creating and restoring
18
+ multi-window, multi-pane tmux sessions, running detached jobs, and listing,
19
+ attaching to, or closing sessions. It requires Python 3.11+,
20
+ [uv](https://docs.astral.sh/uv/), and `tmux` on `PATH`.
21
+
22
+ ## Quick start
23
+
24
+ Install Ianux as a standalone command:
25
+
26
+ ```bash
27
+ uv tool install .
28
+ ianux --help
29
+ ianux session --panes 4
30
+ ```
31
+
32
+ Or run it from a checkout:
33
+
34
+ ```bash
35
+ uv sync
36
+ uv run ianux --help
37
+ uv run ianux session --panes 4
38
+ ```
39
+
40
+ ## Commands
41
+
42
+ | Command | Alias | Purpose |
43
+ |---|---|---|
44
+ | `session` | `s` | Create and attach to a multi-window, multi-pane session (default) |
45
+ | `run` | `r` | Run commands in a detached session |
46
+ | `list` | `ls` | List open sessions |
47
+ | `attach` | `a` | Attach to a session, window, or pane |
48
+ | `kill` | `k` | Close a session, window, or pane |
49
+ | `load` | `l` | Create a session from TOML |
50
+ | `dump` | `d` | Save a session's pane directories to TOML |
51
+
52
+ Run `ianux <command> --help` for options and examples. See the [wiki](wiki/Home.md)
53
+ for the [full command reference](wiki/Commands.md), [TOML configuration guide](wiki/Configuration.md),
54
+ and [architecture](wiki/Architecture.md).
55
+
56
+ ## Development
57
+
58
+ ```bash
59
+ uv sync
60
+ uv run pytest
61
+ uv build
62
+ ```
63
+
64
+ End-to-end tests use a real tmux server and skip when `tmux` is unavailable.
65
+ See [Development and testing](wiki/Development.md) for details.
ianux-0.2.0/README.md ADDED
@@ -0,0 +1,55 @@
1
+ <div align="center">
2
+ <img src="assets/ianux-logo.png" alt="Ianux logo" width="180">
3
+ <h1>Ianux</h1>
4
+ <p>A quick-to-use tmux wrapper for managing sessions.</p>
5
+ </div>
6
+
7
+ Ianux is a quick-to-use Python command-line tool for creating and restoring
8
+ multi-window, multi-pane tmux sessions, running detached jobs, and listing,
9
+ attaching to, or closing sessions. It requires Python 3.11+,
10
+ [uv](https://docs.astral.sh/uv/), and `tmux` on `PATH`.
11
+
12
+ ## Quick start
13
+
14
+ Install Ianux as a standalone command:
15
+
16
+ ```bash
17
+ uv tool install .
18
+ ianux --help
19
+ ianux session --panes 4
20
+ ```
21
+
22
+ Or run it from a checkout:
23
+
24
+ ```bash
25
+ uv sync
26
+ uv run ianux --help
27
+ uv run ianux session --panes 4
28
+ ```
29
+
30
+ ## Commands
31
+
32
+ | Command | Alias | Purpose |
33
+ |---|---|---|
34
+ | `session` | `s` | Create and attach to a multi-window, multi-pane session (default) |
35
+ | `run` | `r` | Run commands in a detached session |
36
+ | `list` | `ls` | List open sessions |
37
+ | `attach` | `a` | Attach to a session, window, or pane |
38
+ | `kill` | `k` | Close a session, window, or pane |
39
+ | `load` | `l` | Create a session from TOML |
40
+ | `dump` | `d` | Save a session's pane directories to TOML |
41
+
42
+ Run `ianux <command> --help` for options and examples. See the [wiki](wiki/Home.md)
43
+ for the [full command reference](wiki/Commands.md), [TOML configuration guide](wiki/Configuration.md),
44
+ and [architecture](wiki/Architecture.md).
45
+
46
+ ## Development
47
+
48
+ ```bash
49
+ uv sync
50
+ uv run pytest
51
+ uv build
52
+ ```
53
+
54
+ End-to-end tests use a real tmux server and skip when `tmux` is unavailable.
55
+ See [Development and testing](wiki/Development.md) for details.
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ianux"
7
+ dynamic = ["version"]
8
+ description = "A quick-to-use tmux wrapper for managing sessions."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+
13
+ [project.scripts]
14
+ ianux = "ianux.__main__:entrypoint"
15
+
16
+ [dependency-groups]
17
+ dev = ["pytest>=8"]
18
+
19
+ [tool.setuptools]
20
+ package-dir = {"" = "src"}
21
+
22
+ [tool.setuptools.packages.find]
23
+ where = ["src"]
24
+
25
+ [tool.setuptools.dynamic]
26
+ version = {attr = "ianux.__version__"}
ianux-0.2.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """ianux — spin up a named tmux development session with multiple panes."""
2
+
3
+ __version__ = "0.2.0"
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env python3.11
2
+ """Entry point for `python -m ianux`.
3
+
4
+ main() accepts an optional argv list so callers (tests, scripts) can drive
5
+ the tool without touching sys.argv. entrypoint() wraps main() with error
6
+ handling and is what the shell shim and __name__ == "__main__" both call.
7
+ """
8
+
9
+ import sys
10
+
11
+ from .attacher import SessionAttacher
12
+ from .cli import build_resolver, parse_args
13
+ from .config import AttachConfig, DumpConfig, KillConfig, LoadConfig, RunConfig, ListConfig
14
+ from .dumper import SessionDumper
15
+ from .exceptions import AppError
16
+ from .killer import SessionKiller
17
+ from .loader import load_session_config
18
+ from .runner import SessionRunner
19
+ from .session import SessionManager
20
+ from .tmux import TmuxClient
21
+ from .lister import SessionLister
22
+
23
+
24
+ def main(argv: list[str] | None = None) -> int:
25
+ """Parse *argv*, dispatch to the matching manager, and return its exit code."""
26
+ config = parse_args(argv)
27
+ client = TmuxClient()
28
+
29
+ if isinstance(config, AttachConfig):
30
+ return SessionAttacher(client).attach(config)
31
+
32
+ if isinstance(config, KillConfig):
33
+ return SessionKiller(client).kill(config)
34
+
35
+ if isinstance(config, RunConfig):
36
+ return SessionRunner(client).run(config)
37
+
38
+ if isinstance(config,ListConfig):
39
+ return SessionLister(client).list(config)
40
+
41
+ if isinstance(config, DumpConfig):
42
+ return SessionDumper(client).dump(config)
43
+
44
+ if isinstance(config, LoadConfig):
45
+ config = load_session_config(config)
46
+ # Falls through to the SessionConfig flow below.
47
+
48
+ # SessionConfig — existing multi-pane dev session flow.
49
+ resolver = build_resolver(config)
50
+ return SessionManager(client).setup(config, resolver)
51
+
52
+
53
+ def entrypoint() -> int:
54
+ """Run main(), converting an AppError into a printed message and exit code 1."""
55
+ try:
56
+ return main()
57
+ except AppError as exc:
58
+ print(f"Error: {exc}", file=sys.stderr)
59
+ return 1
60
+
61
+
62
+ if __name__ == "__main__":
63
+ raise SystemExit(entrypoint())
@@ -0,0 +1,65 @@
1
+ """SessionAttacher — list open sessions and attach to one interactively.
2
+
3
+ Two usage modes:
4
+
5
+ Interactive (session_name is None)
6
+ Lists all open tmux sessions with numeric IDs (1-based, matching the
7
+ 'list' subcommand), prompts the user to choose one, then attaches.
8
+
9
+ Direct (session_name is provided)
10
+ Accepts a tmux-style address: ``SESSION``, ``SESSION:WINDOW`` or
11
+ ``SESSION:WINDOW.PANE`` (mirrors the 'kill' subcommand's target
12
+ format). SESSION may be a literal name or one of the numeric IDs
13
+ shown by 'list'/the picker; WINDOW and PANE are tmux's own indices,
14
+ as displayed in 'list'. Validates the session exists and attaches
15
+ immediately, skipping the picker.
16
+ """
17
+
18
+ from typing import Callable
19
+
20
+ from .config import AttachConfig
21
+ from .exceptions import AppError
22
+ from .killer import _Target, _parse_target, resolve_session_id
23
+ from .picker import pick_session
24
+ from .tmux import TmuxClient
25
+
26
+
27
+ class SessionAttacher:
28
+ """Handles the 'attach' subcommand: direct-target and interactive modes."""
29
+
30
+ def __init__(
31
+ self,
32
+ client: TmuxClient,
33
+ prompt_fn: Callable[[str], str] = input,
34
+ ) -> None:
35
+ self._client = client
36
+ self._prompt = prompt_fn
37
+
38
+ def attach(self, config: AttachConfig) -> int:
39
+ if config.session_name is not None:
40
+ return self._attach_direct(config.session_name)
41
+ return self._attach_interactive()
42
+
43
+ # ------------------------------------------------------------------
44
+ # Internals
45
+ # ------------------------------------------------------------------
46
+
47
+ def _attach_direct(self, address: str) -> int:
48
+ t = _parse_target(address)
49
+ session = resolve_session_id(self._client, t.session)
50
+ if not self._client.session_exists(session):
51
+ raise AppError(f"Session '{session}' does not exist.")
52
+ self._client.attach(self._build_target(session, t))
53
+ return 0
54
+
55
+ def _build_target(self, session: str, t: _Target) -> str:
56
+ """Combine the resolved session name with the window/pane part of *t*."""
57
+ if t.kind == "pane":
58
+ return f"{session}:{t.window}.{t.pane}"
59
+ if t.kind in ("window", "panes_all"):
60
+ return f"{session}:{t.window}"
61
+ return session
62
+
63
+ def _attach_interactive(self) -> int:
64
+ self._client.attach(pick_session(self._client, self._prompt))
65
+ return 0