-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c20da0f
Showing
30 changed files
with
1,808 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
comment: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[flake8] | ||
ignore = E203, E266, E501, W503, E741 | ||
max-line-length = 80 | ||
max-complexity = 18 | ||
select = B,C,E,F,W,T4,B9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["config:base"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
*.pyc | ||
*.swp | ||
*.prof | ||
MANIFEST | ||
dist/ | ||
build/ | ||
.coverage | ||
.cache/ | ||
*.egg-info/ | ||
.pytest_cache/ | ||
.tox/ | ||
venv | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
repos: | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.10.1 | ||
hooks: | ||
- id: isort | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 22.8.0 | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 5.0.4 | ||
hooks: | ||
- id: flake8 | ||
|
||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v3.0.0-alpha.0 | ||
hooks: | ||
- id: prettier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SOT Contributing Guidelines | ||
|
||
The SOT community appreciates your contributions via [issues](https://github.com/anistark/sot/pulls) and [pull requests](https://github.com/anistark/sot/pulls). | ||
|
||
When submitting pull requests, please follow the style guidelines of the project, ensure that your code is tested and documented, and write good commit messages, e.g., following [these guidelines](https://chris.beams.io/posts/git-commit/). | ||
|
||
By submitting a pull request, you are licensing your code under the project [license](LICENSE) and affirming that you either own copyright (automatic for most individuals) or are authorized to distribute under the project license (e.g., in case your employer retains copyright on your work). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2024, Kumar Anirudha | ||
Copyright (c) 2021-2022 Nico Schlömer | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<p align="center"> | ||
<a href="https://github.com/anistark/sot"><img alt="tiptop" src="./images/sot.png" width="200px"/></a> | ||
<p align="center">Command-line system oberving tool.</p> | ||
</p> | ||
|
||
`sot` is a Command-line System Obervation Tool in the spirit of [top](<https://en.wikipedia.org/wiki/Top_(software)>). It displays various interesting system stats and graphs them. Works on all operating systems. | ||
|
||
Install and run with | ||
|
||
<!--pytest-codeblocks: skip--> | ||
|
||
```sh | ||
pip install sot | ||
sot | ||
``` | ||
|
||
For all options, see | ||
|
||
<!--pytest-codeblocks:skipif(sys.version_info < (3, 10))--> | ||
|
||
```sh | ||
sot -H | ||
``` | ||
|
||
<!--pytest-codeblocks: expected-output--> | ||
|
||
``` | ||
usage: sot [--help] [--version] [--log LOG] [--net NET] | ||
Command-line System Obervation Tool ≈ | ||
options: | ||
--help, -H Show this help message and exit. | ||
--version, -V Display version information | ||
--log, -L LOG Debug log file | ||
--net, -N NET Network interface to display (default: auto) | ||
``` | ||
|
||
Main Theme: | ||
|
||
| Color | Hex | RGB | | ||
| --- | --- | --- | | ||
| sky_blue3 | `#5fafd7` | `rgb(95,175,215)` | | ||
| aquamarine3 | `#5fd7af` | `rgb(95,215,175)` | | ||
| yellow | `#808000` | `rgb(128,128,0)` | | ||
| bright_black | `#808080` | `rgb(128,128,128)` | | ||
| slate_blue1 | `#875fff` | `rgb(135,95,255)` | | ||
| red3 | `#d70000` | `rgb(215,0,0)` | | ||
| dark_orange | `#d75f00` | `rgb(215,95,0)` | | ||
|
||
All supported [colors](https://rich.readthedocs.io/en/latest/appendix/colors.html). | ||
|
||
--- | ||
|
||
<p align="center"> | ||
<p align="center">🏴 ≈ 🏴</p> | ||
</p> | ||
|
||
--- | ||
|
||
`sot` uses [Textual](https://github.com/willmcgugan/textual/) for layouting, [rich](https://rich.readthedocs.io/en/latest/index.html) for rich text and [psutil](https://github.com/giampaolo/psutil) for fetching system data. | ||
|
||
Other top alternatives in alphabetical order: | ||
|
||
- [tiptop](https://github.com/nschloe/tiptop) ✨ This project was created on top of `tiptop`, when it became unmaintained. | ||
- [bashtop](https://github.com/aristocratos/bashtop), [bpytop](https://github.com/aristocratos/bpytop), [btop](https://github.com/aristocratos/btop) | ||
- [bottom](https://github.com/ClementTsang/bottom) (one of my fav) | ||
- [Glances](https://github.com/nicolargo/glances) | ||
- [gtop](https://github.com/aksakalli/gtop) | ||
- [htop](https://github.com/htop-dev/htop) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version := `python3 -c "from src.sot.__about__ import __version__; print(__version__)"` | ||
|
||
default: | ||
@echo "\"just publish\"?" | ||
|
||
publish: clean | ||
@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi | ||
gh release create "v{{version}}" | ||
python3 -m build --sdist --wheel . | ||
twine upload dist/* | ||
|
||
clean: | ||
@find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf | ||
@rm -rf src/*.egg-info/ build/ dist/ .tox/ | ||
|
||
format: | ||
isort . | ||
black . | ||
blacken-docs README.md | ||
|
||
lint: | ||
black --check . | ||
flake8 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[build-system] | ||
requires = ["setuptools>=61"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.isort] | ||
profile = "black" | ||
|
||
[project] | ||
name = "sot" | ||
authors = [{name = "Kumar Anirudha", email = "[email protected]"}] | ||
description = "System Oberving Tool" | ||
readme = "README.md" | ||
license = {file = "LICENSE"} | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: POSIX :: Linux", | ||
"Operating System :: MacOS", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Topic :: Utilities", | ||
] | ||
dynamic = ["version"] | ||
requires-python = ">=3.7" | ||
dependencies = [ | ||
"py-cpuinfo", | ||
"distro", | ||
"psutil", | ||
"rich >= 11.0.0", | ||
"textual >=0.1.15, <0.2", | ||
] | ||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "sot.__about__.__version__"} | ||
|
||
[project.urls] | ||
Code = "https://github.com/anistark/sot" | ||
Issues = "https://github.com/anistark/sot/issues" | ||
|
||
[project.scripts] | ||
sot = "sot._app:run" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env python | ||
|
||
import setuptools | ||
|
||
if __name__ == "__main__": | ||
setuptools.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from datetime import datetime | ||
|
||
__version__ = "1.0.0" | ||
__current_year__ = datetime.now().year |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .__about__ import __version__, __current_year__ | ||
from ._app import run | ||
from .blockchar_stream import BlockCharStream | ||
from .braille_stream import BrailleStream | ||
|
||
__all__ = ["BrailleStream", "BlockCharStream", "run", "__version__", "__current_year__"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
from __future__ import annotations | ||
|
||
import argparse | ||
from sys import version_info | ||
|
||
from textual.app import App | ||
|
||
from .__about__ import __version__, __current_year__ | ||
from ._cpu import CPU | ||
from ._disk import Disk | ||
from ._info import InfoLine | ||
from ._mem import Mem | ||
from ._net import Net | ||
from ._procs_list import ProcsList | ||
# from ._sot import Sot | ||
|
||
def run(argv=None): | ||
parser = argparse.ArgumentParser( | ||
description="Command-line System Obervation Tool ≈", | ||
formatter_class=argparse.RawTextHelpFormatter, | ||
add_help=False | ||
) | ||
|
||
parser.add_argument( | ||
"--help", | ||
"-H", | ||
action="help", | ||
default=argparse.SUPPRESS, | ||
help="Show this help message and exit." | ||
) | ||
|
||
parser.add_argument( | ||
"--version", | ||
"-V", | ||
action="version", | ||
version=_get_version_text(), | ||
help="Display version information", | ||
) | ||
|
||
parser.add_argument( | ||
"--log", | ||
"-L", | ||
type=str, | ||
default=None, | ||
help="Debug log file", | ||
) | ||
|
||
parser.add_argument( | ||
"--net", | ||
"-N", | ||
type=str, | ||
default=None, | ||
help="Network interface to display (default: auto)", | ||
) | ||
|
||
args = parser.parse_args(argv) | ||
|
||
# with a grid | ||
class sotApp(App): | ||
async def on_mount(self) -> None: | ||
grid = await self.view.dock_grid(edge="left") | ||
|
||
grid.add_column(fraction=36, name="left") | ||
# grid.add_column(fraction=15, name="middle") | ||
# grid.add_column(fraction=36, name="right") | ||
grid.add_column(fraction=45, name="right") | ||
|
||
grid.add_row(size=1, name="r0") | ||
grid.add_row(fraction=1, name="r1") | ||
grid.add_row(fraction=1, name="r2") | ||
grid.add_row(fraction=1, name="r3") | ||
grid.add_areas( | ||
area0="left-start|right-end,r0", | ||
area1="left,r1", | ||
# area2a="middle,r1-start|r1-end", | ||
# area2b="middle,r2-start|r2-end", | ||
# area2c="middle,r3-start|r3-end", | ||
area3a="right,r1", | ||
area3b="right,r2", | ||
area3c="right,r3", | ||
area4="left,r2-start|r3-end", | ||
) | ||
grid.place( | ||
area0=InfoLine(), | ||
area1=CPU(), | ||
# area2b=Sot(), | ||
area3a=Mem(), | ||
area3b=Disk(), | ||
area3c=Net(args.net), | ||
area4=ProcsList(), | ||
) | ||
|
||
async def on_load(self, _): | ||
await self.bind("q", "quit", "quit") | ||
|
||
sotApp.run(log=args.log) | ||
|
||
|
||
def _get_version_text(): | ||
python_version = f"{version_info.major}.{version_info.minor}.{version_info.micro}" | ||
|
||
return "\n".join( | ||
[ | ||
f"sot {__version__} [Python {python_version}]", | ||
f"Copyright (c) 2024-{__current_year__} Kumar Anirudha", | ||
] | ||
) |
Oops, something went wrong.