Skip to main content

Steveflyer's Stevools 💎

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

Stevools 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 🚀

Stevools'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 stevools 🚀, 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 Stevools.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 🛠️

Stevools'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 Stevools, you can simply clone this repository or install it via pip (assuming it's available on PyPi).

pip install Stevools

Requirements

The required packages for Stevools 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.

Metadata

Release files for stevools 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stevools 0.1.2
File Size Uploaded Provenance Actions
stevools-0.1.2.tar.gz 15.6 kB Without provenance Details for stevools-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stevools 0.1.2
File Interpreter ABI Platform Actions
stevools-0.1.2-py3-none-any.whl Python 3 none any Details for stevools-0.1.2-py3-none-any.whl

Total release size: 32.3 kB

Release files / stevools-0.1.2.tar.gz

Download URL stevools-0.1.2.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0bbdf82a0ba6e4c914b85cf4161c0f3695fac87b8424a93f53181c639e8e3894
BLAKE2b-256 checksum
How to use checksums
dd002bdd372a0d39a3415ae76b92ecd7a8a5501b1e0618c0ca7c493d1e3e0716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / stevools-0.1.2-py3-none-any.whl

Download URL stevools-0.1.2-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
203dc9839c5f9647c9ad3ee6e826c9a1648d5e1d207d7a0b743e04e177426495
BLAKE2b-256 checksum
How to use checksums
8331138d332f67c8ff700bc336f560623ccd0d985f0b79d71b06c9f68c709eae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for stevools 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page