Comprehensive Python utility library for file system operations and process management
Project description
kingkybel-pyprocess
Comprehensive Python utility library for file system operations and process management.
Features
- 📂 File System Operations: Robust implementations of
mkdir,touch,remove, andsymbolic_linkwith glob support - 🛡️ Path Protection: Absolute path validation with automatic protection of critical Linux system directories
- 🥞 Directory Stack:
pushdandpopdfunctionality for clean working directory management - 🔍 Advanced Finding: Flexible
findutility with type filtering, name patterns, exclusion, and sorting - 📝 File Utilities: Easy
read_fileandwrite_fileoperations with automatic directory creation - ⚙️ Env Parsing: Simple
.envfile parser for configuration management - 🚀 Process Management: Run standard and interactive commands with real-time output monitoring and thread-safe capture
- 🌐 Network Tools: Simple
pingimplementation and IP retrieval - 🛠️ Tool Validation: Check for installed system tools and versions
- 🪵 Logger Integration: Built-in support for
PyFlashLoggerfor command and error logging - ✅ Comprehensive Testing: Robust test suite using Python's
unittestframework
Installation
pip install kingkybel-pyprocess
Or from source:
git clone https://github.com/kingkybel/PyProcess.git
cd PyProcess
pip install -e .
Quick Start
File System Operations
from pyprocess import mkdir, touch, remove, pushdir, popdir
# Create directories and files
mkdir("path/to/my/project")
touch("path/to/my/project/config.ini")
# Directory stack management
pushdir("path/to/my/project")
# ... do something ...
popdir()
# Clean up
remove("path/to/my/project")
Process Management
from pyprocess import run_command, run_interactive_command
# Run a simple command
reval, stdout, stderr = run_command("ls -la", cwd="/tmp")
# Run an interactive command (e.g., top, vim)
run_interactive_command("top")
Advanced Finding
from pyprocess import find, FileSystemObjectType, FindSortField
# Find all python files, sorted by name
py_files = find(
paths=".",
file_type_filter=FileSystemObjectType.FILE,
name_patterns="*.py",
sort_field=FindSortField.BY_NAME
)
Releasing to PyPI
- Bump the package version in
pyprocess/__init__.py(__version__). - Clean old build artifacts:
rm -rf build dist *.egg-info
- Build distributions:
python -m build
- Upload to TestPyPI first (recommended):
python -m twine upload --repository testpypi dist/*
- Upload to PyPI:
python -m twine upload dist/*
License
GPLv2 - See the LICENSE file for details.
Contributing
Contributions welcome! Please open issues for bugs or feature requests.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kingkybel_pyprocess-2.0.0.tar.gz.
File metadata
- Download URL: kingkybel_pyprocess-2.0.0.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed8dcb9e5604780a8c5dcfae10f25fed52290a5915a7952fb1b469edccf95b5c
|
|
| MD5 |
4c1078cb57f981b5924f731aea6d632c
|
|
| BLAKE2b-256 |
b2b9e2e91fe5ce76c257f661121adf9062fdbd4363a6d72d33203d74ad724061
|
File details
Details for the file kingkybel_pyprocess-2.0.0-py3-none-any.whl.
File metadata
- Download URL: kingkybel_pyprocess-2.0.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9135f9ef682423f7e7b04b5dc6b5094f83cab9278fc714a40d50bba47206018
|
|
| MD5 |
28662b6a91153ede189b99a2d7bf61aa
|
|
| BLAKE2b-256 |
a7dc48cfcc469420ad8b76b72f33e69eac40ddb4326178f61dddf08bc8952307
|