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.0.tar.gz (19.7 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.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

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

Hashes for kingkybel_pyprocess-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ed8dcb9e5604780a8c5dcfae10f25fed52290a5915a7952fb1b469edccf95b5c
MD5 4c1078cb57f981b5924f731aea6d632c
BLAKE2b-256 b2b9e2e91fe5ce76c257f661121adf9062fdbd4363a6d72d33203d74ad724061

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kingkybel_pyprocess-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9135f9ef682423f7e7b04b5dc6b5094f83cab9278fc714a40d50bba47206018
MD5 28662b6a91153ede189b99a2d7bf61aa
BLAKE2b-256 a7dc48cfcc469420ad8b76b72f33e69eac40ddb4326178f61dddf08bc8952307

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