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.1.tar.gz (20.1 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.1-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kingkybel_pyprocess-2.0.1.tar.gz
  • Upload date:
  • Size: 20.1 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.1.tar.gz
Algorithm Hash digest
SHA256 ab80619007a87b4f0ab2dfa1b21721114a7b6696186334202aeaf1a246e56efd
MD5 6bfb2ba33a79700c66a168ce9aef2e87
BLAKE2b-256 4e93ea735324a6457462e9959be5af28cca17df685d837bb083e1953a58d4e97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kingkybel_pyprocess-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5054e001ddbcae95de2ea2d9f080aa5fa873c2fe928a18c02511b4c785ba814
MD5 5c72f2d4c933fafde5a6566171ac4d94
BLAKE2b-256 852056804ae7ffb2115cfba38541a7d9b1452ad067afd3796c99eaca4ae33568

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