This blog post is about one of my open source project called ptop. ptop is a task manager for Linux based systems written using Python. It was a hobby project that I hacked in a couple of weeks during July’15. Primary motivation of developing ptop was to dive into Python threads and Linux systems.
To my surprise, ptop went on to hit the GitHub trending list and gained a lot of traction. Issues started to pile up and within no time my to-do list saturated. I was still in undergrad college at that time and got my first lesson as a software developer:
“Maintaining projects is harder than bootstrapping them.”
I failed to multitask and got left behind on development. I made multiple attempts in the following years and narrowed down the issues list a bit. But, failed to roll out a stable release. Most of those times, my coding habits were a overkill lacking consistency and pushed me in a procrastination loop. I gave up and tried back many times towards the goal of bumping ptop but eventually failed due to lack of consistency and hurrying up towards the goal. This made me understand my second lesson as a software developer.
“Maintaining projects is all about consistency and developing habits.”
Finally, I decided to develop a habit and committed on a few days on weekly basis during this November and was able to release it.
A glance at architecture of ptop
At its core ptop is built using two main libraries npyscreen and psutil. npyscreen is used for drawing interfaces on terminal while psutil is used for getting information about Disk Usage, Memory Usage, CPU Usage, Processes etc. from the system. ptop has a pluggable architecture utilising Sensor classes to get system information with desired refresh rates, for eg. Disk Sensor which gives information about disk usage is implemented like this:
Similarly, other sensors can be implemented. A fifty feet view of ptop looks like this:
User consume information and pass actions while interacting with GUI layer. User actions like killing a process etc. are proxied from the GUI layer to the Sensor layer which executes them.
New features in ptop v1.0
ptop 1.0 is bundled with an awesome set of features like:
- Information about files and system ports used by a process
- Process search
- Responsiveness in-accordance with terminal resizing
- Automatic upgrades to newer versions
- Network activity monitoring
- Python3 and MacOS X compatibility
That’s all for this post ! In case you liked it, hit claps. Feel free to discuss here and DM me on Twitter.