oscalling
oscalling 2.0 defines a new standard for OS interaction in Python. Designed by Rheehose (Rhee Creative), this package not only wraps the standard os module for seamless integration but also introduces advanced capabilities for memory management, leak prevention, and intelligent hardware resource handling.
Built for high-performance and safety, oscalling ensures your system operations are fast, secure, and resource-efficient.
🚀 Features
- 🗂️ Enhanced File System: Atomic writes, one-liner copies/moves, and smart directory traversal with type safety.
- ⚙️ Process Management: Run commands, kill processes by name/PID, and manage background tasks easily.
- 🧠 Memory Guard: Active memory monitoring and automatic garbage collection triggers to prevent leaks.
- 🖥️ Hardware Optimized: Intelligent resource allocation helpers to query CPU, RAM, and Disk usage.
- 🌍 Environment Control: Easy get/set for environment variables and PATH manipulation.
- ⚡ Zero Overhead: Lightweight, typed, and fast.
📦 Installation
pip install oscalling
🔧 Quick Start
import oscalling
# Initialize the enhanced OS manager
manager = oscalling.SystemManager()
### 🗂️ File System Operations ###
# Atomic file write (auto-cleanup resources, prevents corruption)
manager.fs.safe_write('log.txt', 'System checked.')
manager.fs.copy('log.txt', 'log_backup.txt')
print(f"File size: {manager.fs.get_size('log.txt', human_readable=True)}")
# Walk directories easily
for root, dirs, files in manager.fs.walk('/tmp'):
print(f"Scanning: {root}")
### ⚙️ Process Management ###
# Run a shell command easily
result = manager.proc.run("echo 'Hello from oscalling!'")
print(result.stdout)
# Kill a process by name
killed_pids = manager.proc.kill_by_name("chrome")
print(f"Killed processes: {killed_pids}")
### 🧠 Memory & Hardware ###
# Check memory status and optimize if needed
if manager.memory.is_critical(threshold_percent=85):
freed = manager.memory.optimize()
print(f"Freed {freed} objects via GC")
# Get hardware stats
stats = manager.hardware.get_stats()
print(f"CPU: {stats['cpu_percent']}%, RAM: {stats['memory_percent']}%")
### 🌍 Environment ###
manager.env.set("MY_APP_MODE", "production")
print(f"App Mode: {manager.env.get('MY_APP_MODE')}")
manager.env.add_path("/usr/local/custom/bin")
📚 API Overview
SystemManager
Central hub for all operations.
fs: FileSystemManagermemory: MemoryManagerhardware: HardwareManagerenv: EnvManagerproc: ProcessManager
FileSystemManager (manager.fs)
safe_write(path, content)- Atomic file writesafe_read(path)- Safe file readcopy(src, dst)- Copy files/directoriesmove(src, dst)- Move files/directoriesremove(path, recursive=False)- Delete files/dirstouch(path)- Create or update file timestampget_size(path, human_readable=False)- Get file sizewalk(path)- Directory tree traversalchmod(path, mode)- Change permissionsmake_executable(path)- Make file executable
MemoryManager (manager.memory)
get_info()- Current process memory usageis_critical(threshold_percent=90)- Check if system memory is lowoptimize()- Force garbage collectionget_system_memory()- Full system RAM stats
HardwareManager (manager.hardware)
get_cpu_info()- CPU cores, frequency, architectureget_memory_info()- System RAM statsget_disk_info(path='/')- Disk usage for pathget_stats()- Quick snapshot of CPU/RAM/Disk load
EnvManager (manager.env)
get(key, default=None)- Get environment variableset(key, value)- Set environment variablehas(key)- Check if variable existsunset(key)- Remove variablelist_all()- Get all environment variablesadd_path(path)- Append to PATH
ProcessManager (manager.proc)
run(command, cwd=None, timeout=None)- Run command synchronouslyrun_async(command, cwd=None)- Run command asynchronouslykill(pid, force=False)- Kill process by PIDkill_by_name(name)- Kill all processes by nameget_process_list()- List all running processes
🆕 What's New in v2.0
- Modern
pyproject.toml- Replacedsetup.pywith PEP 517/518 compliant build system - Full Type Hints - Complete typing support for better IDE integration
- Enhanced Error Handling - More robust exception handling across all modules
- Comprehensive Docstrings - Full documentation for every method
- Performance Optimizations - Improved atomic write logic and resource cleanup
📄 License
Copyright (c) 2008-2026 Rheehose (Rhee Creative).
Licensed under the MIT License.
👤 Author
Rheehose (Rhee Creative)
🤝 Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
🔗 Links
Metadata
Release files for oscalling 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oscalling-2.0.0.tar.gz | 14.1 kB | Without provenance | Details for oscalling-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oscalling-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for oscalling-2.0.0-py3-none-any.whl |
Total release size: 27.1 kB
Release files / oscalling-2.0.0.tar.gz
| Download URL | oscalling-2.0.0.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b3e761f06a122efee0017bac3d67f95c4281d3678ab9e1507bef8edc9609e53
|
|
BLAKE2b-256 checksum How to use checksums |
be6220a7054926cee0ca630177c972131287b63dc2b6f3e910f3a109ae4b4291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / oscalling-2.0.0-py3-none-any.whl
| Download URL | oscalling-2.0.0-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc555490a02db3ff2160d0b3038af3b8227a4ffaf61a869bfcf40f53ece71aa7
|
|
BLAKE2b-256 checksum How to use checksums |
52e3e1530ca6f5704e9bbc510e14d0b4c3ae8ca801e93211cf834a43c502ac89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for oscalling 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.