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.2.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.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kingkybel_pyprocess-2.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 b74251c25a598236785bf7854dee5605d3a23df8ef45ff62081eefe474c83e67
MD5 6ecd6dd990b6499b73b71e17cb46bdd7
BLAKE2b-256 b1e0dc90814805565a47c8896419759f9d855b72e5f974fd7ac2bc7539d26c52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kingkybel_pyprocess-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 09e1dd3cd0b3a7ac80f1c046478025417516bb7f80b643f4e9d426120e60adda
MD5 0603abc2b808886fc3dd9e23ab2e77d5
BLAKE2b-256 6501fc389cc14e2cb1150eafa9222481c71736370cf21b2274d954303e55f4d1

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