Repository: qtile/qtile

Issue:
qtile-top crash 'Client' object has no attribute 'tracemalloc_dump'
<!--
Please do not ask general questions here! There are [community
contact](https://github.com/qtile/qtile#community) options for that.
-->

# Issue description

<!--
A brief discussion of what failed and how it failed. A description of
what you tried is helpful, i.e. "When I use lazy.kill() on a window I get
the following stack trace" instead of "Closing windows doesn't work".
-->
Tried to run `qtile-top` and it crashed. I'm not sure should be done before that script  - no documentation.
Tried 
```
 arnas@zordmachine  ~  qtile-cmd -o cmd -f tracemalloc_dump
[False, 'Trace not started']
 arnas@zordmachine  ~  qtile-cmd -o cmd -f tracemalloc_toggle
 arnas@zordmachine  ~  qtile-cmd -o cmd -f tracemalloc_dump
[True, '/home/arnas/.cache/qtile/qtile_tracemalloc.dump']
```
but this didn't helped

# Qtile version

<!--
Please include the exact commit hash of the version of Qtile that failed.
-->

5bd8e57f78b72ed9de4d10bf51af6db51561d794 (latest git version)

# Stack traces

<!--
Please attach any stack traces found in:

* `~/.xsession-errors`
* `~/.local/share/qtile/qtile.log`
-->

Traceback (most recent call last):
  File "/usr/bin/qtile-top", line 11, in <module>
    load_entry_point('qtile==0.15.0', 'console_scripts', 'qtile-top')()
  File "/usr/lib/python3.8/site-packages/libqtile/scripts/qtile_top.py", line 164, in main
    curses.wrapper(get_stats, client, limit=lines, seconds=seconds,
  File "/usr/lib/python3.8/curses/__init__.py", line 105, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/lib/python3.8/site-packages/libqtile/scripts/qtile_top.py", line 91, in get_stats
    snapshot = get_trace(client, force_start)
  File "/usr/lib/python3.8/site-packages/libqtile/scripts/qtile_top.py", line 63, in get_trace
    (started, path) = client.tracemalloc_dump()
AttributeError: 'Client' object has no attribute 'tracemalloc_dump'


# Configuration

<!--
Please include a link or attach your configuration to the issue.
-->
https://github.com/zordsdavini/qtile-config
Arch
qtile-top crash 'Client' object has no attribute 'tracemalloc_dump'
<!--
Please do not ask general questions here! There are [community
contact](https://github.com/qtile/qtile#community) options for that.
-->

# Issue description

<!--
A brief discussion of what failed and how it failed. A description of
what you tried is helpful, i.e. "When I use lazy.kill() on a window I get
the following stack trace" instead of "Closing windows doesn't work".
-->
Tried to run `qtile-top` and it crashed. I'm not sure should be done before that script  - no documentation.
Tried 
```
 arnas@zordmachine  ~  qtile-cmd -o cmd -f tracemalloc_dump
[False, 'Trace not started']
 arnas@zordmachine  ~  qtile-cmd -o cmd -f tracemalloc_toggle
 arnas@zordmachine  ~  qtile-cmd -o cmd -f tracemalloc_dump
[True, '/home/arnas/.cache/qtile/qtile_tracemalloc.dump']
```
but this didn't helped

# Qtile version

<!--
Please include the exact commit hash of the version of Qtile that failed.
-->

5bd8e57f78b72ed9de4d10bf51af6db51561d794 (latest git version)

# Stack traces

<!--
Please attach any stack traces found in:

* `~/.xsession-errors`
* `~/.local/share/qtile/qtile.log`
-->

Traceback (most recent call last):
  File "/usr/bin/qtile-top", line 11, in <module>
    load_entry_point('qtile==0.15.0', 'console_scripts', 'qtile-top')()
  File "/usr/lib/python3.8/site-packages/libqtile/scripts/qtile_top.py", line 164, in main
    curses.wrapper(get_stats, client, limit=lines, seconds=seconds,
  File "/usr/lib/python3.8/curses/__init__.py", line 105, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/lib/python3.8/site-packages/libqtile/scripts/qtile_top.py", line 91, in get_stats
    snapshot = get_trace(client, force_start)
  File "/usr/lib/python3.8/site-packages/libqtile/scripts/qtile_top.py", line 63, in get_trace
    (started, path) = client.tracemalloc_dump()
AttributeError: 'Client' object has no attribute 'tracemalloc_dump'


# Configuration

<!--
Please include a link or attach your configuration to the issue.
-->
https://github.com/zordsdavini/qtile-config
Arch


Discussion:
Same error with 0.15.1 from the arch repo.
Same error with 0.15.1 from the arch repo.

Resolving patch:
diff --git a/libqtile/scripts/qtile_top.py b/libqtile/scripts/qtile_top.py
--- a/libqtile/scripts/qtile_top.py
+++ b/libqtile/scripts/qtile_top.py
@@ -30,7 +30,7 @@
 import tracemalloc
 from tracemalloc import Snapshot
 
-from libqtile import ipc
+from libqtile import command_client, command_interface, ipc
 
 
 class TraceNotStarted(Exception):
@@ -158,6 +158,8 @@ def main():
     else:
         socket = opts.socket
     client = ipc.Client(socket)
+    client = command_interface.IPCCommandInterface(client)
+    client = command_client.InteractiveCommandClient(client)
 
     try:
         if not opts.raw:


Test patch: