Skip to main content

Comprehensive Python utility library for file system operations and process management

Project description

PyProcess banner

kingkybel-pyprocess

Comprehensive Python utility library for file system operations and process management.

Features

  • 📂 File System Operations: Robust implementations of mkdir, touch, remove, and symbolic_link with glob support
  • 🛡️ Path Protection: Absolute path validation with automatic protection of critical Linux system directories
  • 🥞 Directory Stack: pushd and popd functionality for clean working directory management
  • 🔍 Advanced Finding: Flexible find utility with type filtering, name patterns, exclusion, and sorting
  • 📝 File Utilities: Easy read_file and write_file operations with automatic directory creation
  • ⚙️ Env Parsing: Simple .env file parser for configuration management
  • 🚀 Process Management: Run standard and interactive commands with real-time output monitoring and thread-safe capture
  • 🌐 Network Tools: Simple ping implementation and IP retrieval
  • 🛠️ Tool Validation: Check for installed system tools and versions
  • 🪵 Logger Integration: Built-in support for PyFlashLogger for command and error logging
  • Comprehensive Testing: Robust test suite using Python's unittest framework

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

  1. Bump the package version in pyprocess/__init__.py (__version__).
  2. Clean old build artifacts:
    rm -rf build dist *.egg-info
    
  3. Build distributions:
    python -m build
    
  4. Upload to TestPyPI first (recommended):
    python -m twine upload --repository testpypi dist/*
    
  5. 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.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. 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

kingkybel_pyprocess-2.0.3.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kingkybel_pyprocess-2.0.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file kingkybel_pyprocess-2.0.3.tar.gz.

File metadata

  • Download URL: kingkybel_pyprocess-2.0.3.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for kingkybel_pyprocess-2.0.3.tar.gz
Algorithm Hash digest
SHA256 9cca53644fc9b99fc7bcae9b366897417c785d9317c7e5c670b10ba69e3091ba
MD5 a2d8b028377b4b39077b2920796a0561
BLAKE2b-256 9fcffdd85401bf21077a3f6b94e4b4d17b8bcf2cfe5c717aa68133b44903aadb

See more details on using hashes here.

File details

Details for the file kingkybel_pyprocess-2.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for kingkybel_pyprocess-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b6181453df4d5479d562d8192db0b36abd366cfcabbbad8a0a615fb0b6668716
MD5 9055d01d4535a65553344c4c9a4bc9f3
BLAKE2b-256 87d34f816fed87cfb3e6ada2810b0114c2550d310b9fb26a55af26211e9e0b42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page