diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3cf2f2f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Barkhayot Juraev + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 69a9aa4..f85e475 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# ltop User Manual +# lutop User Manual ## Introduction -Welcome to ltop (Lightweight System Monitor), a terminal-based system monitoring application inspired by Unix `top` command and designed using Python and curses library. +Welcome to lutop (Lightweight System Monitor), a terminal-based system monitoring application inspired by Unix `top` command and designed using Python and curses library. ## Table of Contents @@ -21,13 +21,13 @@ Welcome to ltop (Lightweight System Monitor), a terminal-based system monitoring - pip (Python package installer) - curses (Python standard library for terminal handling) -### Install ltop +### Install lutop 1. Clone the repository: ```bash - git clone https://github.com/barkhayot/ltop.git - cd ltop + git clone https://github.com/barkhayot/lutop.git + cd lutop ``` 2. Install dependencies: @@ -35,10 +35,10 @@ Welcome to ltop (Lightweight System Monitor), a terminal-based system monitoring pip install -r requirements.txt ``` ## Usage -To start ltop, simply run the following command in your terminal: +To start lutop, simply run the following command in your terminal: ```bash -python ltop.py +python lutop.py ``` ### Key Commands - Quit: Press Ctrl + D to quit the application. diff --git a/lutop/__init__.py b/lutop/__init__.py new file mode 100644 index 0000000..2aba9b4 --- /dev/null +++ b/lutop/__init__.py @@ -0,0 +1 @@ +from .lutop import main \ No newline at end of file diff --git a/ltop.py b/lutop/lutop.py similarity index 100% rename from ltop.py rename to lutop/lutop.py diff --git a/setup.py b/setup.py index 4d57050..2f6920e 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup( - name="ltop", + name="lutop", version="1.0.0", packages=find_packages(), install_requires=[ @@ -9,7 +9,7 @@ ], entry_points={ "console_scripts": [ - "ltop = ltop.__main__:main", + "lutop = lutop.lutop:main", ], }, python_requires=">=3.6", @@ -18,10 +18,11 @@ long_description_content_type="text/markdown", author="Barkhayot Juraev", author_email="barkhayotoff@email.com", - url="https://github.com/barkhayot/ltop", + url="https://github.com/barkhayot/lutop", classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], + keywords="system monitor processes", ) diff --git a/tests/test_ltop.py b/tests/test_ltop.py deleted file mode 100644 index 86c4be4..0000000 --- a/tests/test_ltop.py +++ /dev/null @@ -1,63 +0,0 @@ -import unittest -import curses -import psutil - -# Import functions/classes from your ltop.py script -from ltop import ( - get_system_info, - get_top_processes_by_memory, - draw_progress_bar, - safe_addstr, - display_system_info, -) - - -class TestLtop(unittest.TestCase): - - def test_get_system_info(self): - # Test get_system_info function - mem, swap, cpu = get_system_info() - self.assertIsNotNone(mem) - self.assertIsNotNone(swap) - self.assertIsNotNone(cpu) - - def test_get_top_processes_by_memory(self): - # Test get_top_processes_by_memory function - processes = get_top_processes_by_memory() - self.assertGreaterEqual(len(processes), 0) - - def test_draw_progress_bar(self): - # Test draw_progress_bar function - screen = curses.initscr() - try: - draw_progress_bar(screen, 0, 0, 20, 50, curses.color_pair(1)) - screen.refresh() - finally: - curses.endwin() - - def test_safe_addstr(self): - # Test safe_addstr function - screen = curses.initscr() - try: - safe_addstr(screen, 0, 0, "Test String", curses.A_NORMAL) - screen.refresh() - finally: - curses.endwin() - - def test_display_system_info(self): - # Test display_system_info function - screen = curses.initscr() - try: - mem = psutil.virtual_memory() - swap = psutil.swap_memory() - cpu = psutil.cpu_percent(interval=1, percpu=True) - processes = get_top_processes_by_memory() - display_system_info(screen, mem, swap, cpu, processes) - screen.refresh() - # You can add assertions here to verify if the system information is displayed correctly - finally: - curses.endwin() - - -if __name__ == "__main__": - unittest.main()