Skip to content

Commit 1d0a690

Browse files
committed
refactor(tui): rename nvitop.gui -> nvitop.tui
1 parent 37b95d8 commit 1d0a690

30 files changed

+97
-97
lines changed

.flake8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ per-file-ignores =
2323
__init__.py: F401
2424
nvitop/api/host.py: F401
2525
nvitop/api/libnvml.py: F401
26-
# SIM113: use enumarate
26+
# SIM113: use enumerate
2727
# false positive
28-
nvitop/gui/screens/main/process.py: SIM113
28+
nvitop/tui/screens/main/process.py: SIM113
2929
exclude =
3030
.git,
3131
.vscode,

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ nvitop (GPL-3.0)
14611461
├── select.py (Apache-2.0)
14621462
├── __main__.py (GPL-3.0)
14631463
├── cli.py (GPL-3.0)
1464-
└── gui (GPL-3.0)
1464+
└── tui (GPL-3.0)
14651465
├── COPYING (GPL-3.0)
14661466
└── * (GPL-3.0)
14671467
```
@@ -1482,13 +1482,13 @@ from nvitop import Device, ResourceMetricCollector
14821482

14831483
The public APIs from `nvitop` are released under the **Apache License, Version 2.0 (Apache-2.0)**. The original license files can be found at [LICENSE](https://github.com/XuehaiPan/nvitop/blob/HEAD/LICENSE), [nvitop/api/LICENSE](https://github.com/XuehaiPan/nvitop/blob/HEAD/nvitop/api/LICENSE), and [nvitop/callbacks/LICENSE](https://github.com/XuehaiPan/nvitop/blob/HEAD/nvitop/callbacks/LICENSE).
14841484

1485-
The CLI of `nvitop` is released under the **GNU General Public License, Version 3 (GPL-3.0)**. The original license files can be found at [COPYING](https://github.com/XuehaiPan/nvitop/blob/HEAD/COPYING) and [nvitop/gui/COPYING](https://github.com/XuehaiPan/nvitop/blob/HEAD/nvitop/gui/COPYING). If you dynamically load the source code of `nvitop`'s CLI or GUI:
1485+
The CLI of `nvitop` is released under the **GNU General Public License, Version 3 (GPL-3.0)**. The original license files can be found at [COPYING](https://github.com/XuehaiPan/nvitop/blob/HEAD/COPYING) and [nvitop/tui/COPYING](https://github.com/XuehaiPan/nvitop/blob/HEAD/nvitop/tui/COPYING). If you dynamically load the source code of `nvitop`'s CLI or TUI:
14861486

14871487
```python
14881488
from nvitop import cli
1489-
from nvitop import gui
1489+
from nvitop import tui
14901490
import nvitop.cli
1491-
import nvitop.gui
1491+
import nvitop.tui
14921492
```
14931493

14941494
your source code should also be released under the GPL-3.0 License.

nvitop/cli.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import textwrap
1111

1212
from nvitop.api import HostProcess, libnvml
13-
from nvitop.gui import UI, USERNAME, Device, colored, libcurses, set_color, setlocale_utf8
13+
from nvitop.tui import TUI, USERNAME, Device, colored, libcurses, set_color, setlocale_utf8
1414
from nvitop.version import __version__
1515

1616

@@ -345,26 +345,26 @@ def main() -> int:
345345
pids = set(args.pid)
346346
filters.append(lambda process: process.pid in pids)
347347

348-
ui = None
348+
tui = None
349349
if hasattr(args, 'monitor') and len(devices) > 0:
350350
try:
351351
with libcurses(colorful=args.colorful, light_theme=args.light) as win:
352-
ui = UI(
352+
tui = TUI(
353353
devices,
354354
filters,
355355
ascii=args.ascii,
356356
mode=args.monitor,
357357
interval=args.interval,
358358
win=win,
359359
)
360-
ui.loop()
360+
tui.loop()
361361
except curses.error as ex:
362-
if ui is not None:
362+
if tui is not None:
363363
raise
364364
messages.append(f'ERROR: Failed to initialize `curses` ({ex})')
365365

366-
if ui is None:
367-
ui = UI(devices, filters, ascii=args.ascii)
366+
if tui is None:
367+
tui = TUI(devices, filters, ascii=args.ascii)
368368
if not sys.stdout.isatty():
369369
parent = HostProcess().parent()
370370
if parent is not None:
@@ -379,8 +379,8 @@ def main() -> int:
379379
'Please try `nvitop -m` directly.',
380380
)
381381

382-
ui.print()
383-
ui.destroy()
382+
tui.print()
383+
tui.destroy()
384384

385385
if len(libnvml.UNKNOWN_FUNCTIONS) > 0:
386386
unknown_function_messages = [

nvitop/gui/library/__init__.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

nvitop/gui/screens/__init__.py

Lines changed: 0 additions & 10 deletions
This file was deleted.
File renamed without changes.

nvitop/gui/__init__.py renamed to nvitop/tui/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# pylint: disable=missing-module-docstring
55

6-
from nvitop.gui.library import (
6+
from nvitop.tui.library import (
77
SUPERUSER,
88
USERNAME,
99
Device,
@@ -12,4 +12,4 @@
1212
set_color,
1313
setlocale_utf8,
1414
)
15-
from nvitop.gui.ui import UI
15+
from nvitop.tui.tui import TUI

nvitop/tui/library/__init__.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This file is part of nvitop, the interactive NVIDIA-GPU process viewer.
2+
# License: GNU GPL version 3.
3+
4+
# pylint: disable=missing-module-docstring
5+
6+
from nvitop.tui.library.device import NA, Device
7+
from nvitop.tui.library.displayable import Displayable, DisplayableContainer
8+
from nvitop.tui.library.history import BufferedHistoryGraph, HistoryGraph
9+
from nvitop.tui.library.keybinding import (
10+
ALT_KEY,
11+
ANYKEY,
12+
PASSIVE_ACTION,
13+
QUANT_KEY,
14+
SPECIAL_KEYS,
15+
KeyBuffer,
16+
KeyMaps,
17+
normalize_keybinding,
18+
)
19+
from nvitop.tui.library.libcurses import libcurses, setlocale_utf8
20+
from nvitop.tui.library.messagebox import MessageBox, send_signal
21+
from nvitop.tui.library.mouse import MouseEvent
22+
from nvitop.tui.library.process import (
23+
GiB,
24+
GpuProcess,
25+
HostProcess,
26+
Snapshot,
27+
bytes2human,
28+
host,
29+
timedelta2human,
30+
)
31+
from nvitop.tui.library.selection import Selection
32+
from nvitop.tui.library.utils import (
33+
HOSTNAME,
34+
LARGE_INTEGER,
35+
SUPERUSER,
36+
USERCONTEXT,
37+
USERNAME,
38+
colored,
39+
cut_string,
40+
make_bar,
41+
set_color,
42+
ttl_cache,
43+
)
44+
from nvitop.tui.library.widestring import WideString, wcslen

nvitop/gui/library/device.py renamed to nvitop/tui/library/device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from nvitop.api import NA, libnvml, ttl_cache, utilization2string
77
from nvitop.api import MigDevice as MigDeviceBase
88
from nvitop.api import PhysicalDevice as DeviceBase
9-
from nvitop.gui.library.process import GpuProcess
9+
from nvitop.tui.library.process import GpuProcess
1010

1111

1212
__all__ = ['Device', 'NA']

nvitop/gui/library/displayable.py renamed to nvitop/tui/library/displayable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# pylint: disable=missing-module-docstring,missing-function-docstring
66

7-
from nvitop.gui.library.libcurses import CursesShortcuts
7+
from nvitop.tui.library.libcurses import CursesShortcuts
88

99

1010
class Displayable(CursesShortcuts): # pylint: disable=too-many-instance-attributes

0 commit comments

Comments
 (0)