Skip to main content

This is the gembox toolbox for steve flyer. You can also find your hammers here.

Project description

Steveflyer's Gembox 💎

This is a versatile, Python-based toolbox crafted with ❤️ by Steveflyer. It serves not only as a standalone repository of utilities but also as an essential package for other innovative projects under Steveflyer's belt.

Projects such as:

  • zephyrion: A 🚀 pyppeteer-based headless web automation tool.
  • cetino: A 🎈 lightweight and pythonic database manipulation tool.

🛠 Toolbox Contents

Gembox encapsulates a plethora of utilities streamlined for daily use, including:

Core Utilities

  • date_utils: 📅 Tools for effective date manipulations.
  • debug_utils: 🐛 Essential debugging aids for developers.
  • re_utils: 🧵 Regular expression utilities for efficient string processing.

I/O Utilities

  • io:
    • pandas_io: 🐼 I/O operations centered around Pandas.
    • text_reader: 📖 Efficient reading capabilities across multiple formats.
    • _io: Core I/O functionalities.

Multiprocessing Utilities 🚀

Gembox's multiprocessing utilities are tailored for efficient, parallel execution of both synchronous and asynchronous tasks. Leveraging the power of Python's multiprocessing and asyncio modules, it provides a seamless way to distribute and execute tasks across multiple CPU cores.

ParallelExecutor

The crown jewel of the multiprocessing utilities. ParallelExecutor facilitates the parallel execution of tasks. Whether you're dealing with synchronous or asynchronous tasks, this class got you covered.

Features:

  • Asynchronous Task Execution: Seamlessly execute asynchronous functions in parallel across multiple processes.
  • Weighted Task Splitting: Dynamically split tasks amongst worker processes based on their assigned weights, ensuring balanced work distribution.

Usage:

tasks = [Task(function_name, params_dict), ...]
results = ParallelExecutor.run(tasks, n_workers=number_of_processes)

Task

A robust wrapper for any task (function) that you wish to execute, be it asynchronous or synchronous. The Task class ensures that each task is handled appropriately based on its nature.

Features:

  • Async Detection: Automatically detects if a task is asynchronous and handles it accordingly during execution.
  • Weighted Execution: Assign weights to tasks, which can then be used by the ParallelExecutor for balanced task distribution.

Usage:

With gembox 🚀, you can parallel your codes really easy

# for example, you have a function:
def calc_something(input_df, threshold):
    # do something
    return output_df

Then, you can parallel it by:

import asyncio
from gembox.multiprocessing import Task, ParallelExecutor

input_df_list = [df1, df2, df3, df4, df5]  # your input dataframes
tasks = [Task(calc_something, {'input_df': df, 'threshold': 0.5}) for df in input_df_list]

asyncio.run(ParallelExecutor.run(tasks, n_workers=5))

Super Easy, right? (✿◠‿◠)

This multiprocess utility ensures that your CPU cores are efficiently utilized, boosting the performance of your applications manifold.

OpenAI Utilities

  • openai_util: 🤖 Utilities tailored for OpenAI integrations.

Pandas Utilities

  • pandas_util: 🐼 Tools to supercharge your Pandas operations.

Windows Utilities

  • win_utils: 🪟 Specific tools for Windows operations, including word utilities.

Scripts Utilities 🛠️

Gembox's script utilities offer a set of practical scripts that simplify frequent tasks, encapsulating complex operations into a single command. Currently, we've introduced a script that offers a fresh perspective on directory listing, aptly named ls-py.

ls-py

Move over traditional directory listing; ls-py is here to revolutionize the way you view your directory's contents!

Features:

  • Intuitive Listing: Display directory contents in a structured tree format.
  • Recursive Listing: Dive deep into directories with the recursive option.
  • Exclude Specific Items: Have control over what you wish to see or skip.
  • Expand Hidden Directories: Decide whether to peek into those hidden gems starting with "__" or ".".
  • Cross-Platform: Whether you're on Windows, macOS, or Linux, ls-py has got you covered.

Usage:

ls-py [path] [options]

Examples:

  1. Simple Listing: Just want to see what's in your current directory?
    ls-py
    
  2. Recursive Listing: Want a deeper dive? No problem!
    ls-py -r ..
    
  3. Exclude Specific Items: Want to skip those pesky .git and .idea folders? Easy easy!
    ls-py -r -x .git .idea __pycache__
    
  4. Expand Hidden Directories: Want to peek into those hidden gems starting with "__" or "."? No problem!
    ls-py -r -e
    

Enhance your terminal experience with ls-py on any platform, a modern directory listing for the modern developer.

📦 Installation

To get started with Gembox, you can simply clone this repository or install it via pip (assuming it's available on PyPi).

pip install gembox

Requirements

The required packages for Gembox are listed in requirements.txt. Ensure to install them for a smooth experience.

🤝 Contribution

Feel free to fork, enhance, create PRs and spread the word. Any contributions, big or small, are welcomed with open arms!

⭐ Star the Repo

If you find this project useful, please consider giving it a star on GitHub.

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

gembox-0.2.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

gembox-0.2.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file gembox-0.2.0.tar.gz.

File metadata

  • Download URL: gembox-0.2.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for gembox-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c4e5e40ec64252097bbdfbf5f2b04d2fcb86c97566281cb81f14507a9eee18bd
MD5 3891eafa26fdb1ebf4a50878b73a635a
BLAKE2b-256 03030806e028531fecbbac29f24a25277a71379603d8972ddafb05fe6d7056ce

See more details on using hashes here.

File details

Details for the file gembox-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: gembox-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for gembox-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73886345c65c4a3fa912a590d948e348d9404fc135d9fcaa83c1f591a6368782
MD5 cd95a14e18c53cd58498f66609dbccbf
BLAKE2b-256 617269a1a966d91fc8aac4995f10a1f9a6f8893890ca3edf672672570036886c

See more details on using hashes here.

Supported by

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