A global utility package for all the data sorting and inspection needs.
Project description
๐ globalutil: Your Global Utility Toolkit ๐ ๏ธ
globalutil is a comprehensive utility package for file and folder management, with additional features for building auto training pipeline scripts (ML Pipelines) for Python.
๐ Features
- ๐ Directory Inspection: Generate beautiful tree structures of your directories
- ๐ Smart File Sorting: Copy files with ease using powerful wildcard patterns
- ๐ File Search: Find files matching specific criteria across directories
- ๐ File Organization: Categorize files based on their types
- ๐ Duplicate Detection: Identify and manage duplicate files
- ๐ Large File Finder: Locate files exceeding specified size thresholds
- ๐ Metadata Extraction: Extract and display file metadata
- ๐ Directory Size Calculator: Calculate total size of directories
- ๐งน Empty Directory Cleaner: Identify and remove empty directories
- ๐พ File Backup: Create timestamped backups of files and directories
- ๐๏ธ File Archiving: Create and extract zip archives
- ๐ File Integrity: Calculate and verify file checksums
- ๐ Recent File Finder: Locate recently modified or created files
- ๐ท๏ธ Batch File Renaming: Rename multiple files based on patterns
- ๐ง Extensible Design: Built with future expansion in mind
- ๐ Code Documentation: Generate documentation for your code files
- ๐ File Reading: Efficiently read files with specific extensions
- ๐ Extension Finding: Identify coding and configuration file extensions in a directory
๐ฏ Vision
globalutil aims to become the Swiss Army knife of ML-related utility tools, supporting a wide range of file and directory operations!
๐ Quick Start
Installation
pip install globalutil
Usage
Example: Preparing Files for LLM Upload
from globalutil.filesystem import Inspect, Sort, ExtensionFinder
from globalutil.filesystem.operations import FileReader, CodeDocumentation
# Collect all Python files into a single folder
structure = Inspect.generate_copy_structure("./", "./temp")
Sort.copy_structure(structure, patterns=["*.py"])
# Generate a tree structure of your project
tree = Inspect.get_directory_tree(".")
with open("tree.txt", "w") as f:
f.write(tree)
# Find all coding and config extensions in a directory
extensions = ExtensionFinder.find_extensions("/path/to/your/project")
print("Coding extensions:", extensions.get('coding', set()))
print("Config extensions:", extensions.get('config', set()))
# Read files with specific extensions
allowed_extensions = set.union(
ExtensionFinder.CODING_EXTENSIONS,
ExtensionFinder.CONFIG_EXTENSIONS
)
reader = FileReader(allowed_extensions=allowed_extensions)
all_file_contents = reader.read_files_in_directory("/path/to/your/project")
# Generate documentation for your code
code_doc = CodeDocumentation()
generated_file = code_doc.generate_entire_folder_txt(
root_directory='/path/to/your/project',
output_file='/path/to/output/entire_code.txt',
file_extensions={".py", ".sh"}
)
print(f"Generated documentation file: {generated_file}")
This script demonstrates how to:
- Copy all Python files to a temp folder
- Generate a tree structure of your project
- Find all coding and configuration file extensions in a directory
- Read files with specific extensions
- Generate documentation for your code
๐ Documentation
For detailed documentation, visit our GitHub Pages.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Show Your Support
If you find this project useful, give it a star on GitHub! โญ
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file globalutil-0.4.1.tar.gz.
File metadata
- Download URL: globalutil-0.4.1.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
828caa6a6e7203052146b65917399e17a06ac12ada80e08028d6675bf153fd04
|
|
| MD5 |
c329708bb31ba6a1b348117fb88a8062
|
|
| BLAKE2b-256 |
8235191387fef0398903e79e4c608818272167fa9501c37fe6b1a44c89563816
|
File details
Details for the file globalutil-0.4.1-py3-none-any.whl.
File metadata
- Download URL: globalutil-0.4.1-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57c7c52a81e3c69801c18eb628d56a89601a9488521e911a8adab948cedaff11
|
|
| MD5 |
a412c7d32ba16cbe981657e520d83f93
|
|
| BLAKE2b-256 |
4adfb6da7524c67f63087bb4fbe835dc5d3f04c0f1d4e9ae08f55b20370aa819
|