A collection of utilities for file management, deduplication, and system monitoring
Project description
๐ฆ morchaos
A collection of utilities for file management, deduplication, and system monitoring.
Features
- File Deduplication: Find and manage duplicate files using SHA-256 hashing
- Image Deduplication: Detect similar images using perceptual hashing
- Source Code Deduplication: Find duplicate source files with whitespace normalization
- Ebook Catalogization: Organize ebooks by author using metadata extraction
- Chatbot Interface: Simple HTTP client for local Ollama/chat model endpoints
- System Information: Collect CPU, memory, disk, battery, and network statistics
Installation
From Source
# Clone the repository
git clone <repository-url>
cd morchaos
# Install with Poetry
poetry install
# Or install with pip
pip install .
Dependencies
- Python โฅ3.10
- click (CLI framework)
- imagehash, Pillow (image processing)
- pdfplumber, python-docx, ebooklib (ebook metadata)
- psutil (system information)
- requests (HTTP client)
Usage
Command Line Tools
After installation, the following console scripts are available:
Duplicate File Detection
# Find duplicates in a directory
duplicate --directory /path/to/files
# Delete duplicates (keeps first occurrence)
duplicate --directory /path/to/files --action delete
# Move duplicates to a separate directory
duplicate --directory /path/to/files --action move --target-dir /path/to/duplicates
# Filter by file extensions
duplicate --directory /path/to/files --extensions .txt .doc
# Ignore specific directories
duplicate --directory /path/to/files --ignore-dirs temp cache
Image Duplicate Detection
# Find similar images
image-diff --directory /path/to/images
# Adjust similarity threshold (0-64, lower = more strict)
image-diff --directory /path/to/images --threshold 10
# Specify image extensions
image-diff --directory /path/to/images --extensions .jpg .png .gif
Source Code Duplicate Detection
# Find duplicate source files (whitespace-insensitive)
source-diff --directory /path/to/code
# Specify source file extensions
source-diff --directory /path/to/code --extensions .py .js .java
Ebook Catalogization
# Preview metadata extraction
ebook-catalog --directory /path/to/ebooks --preview
# Organize ebooks by author (dry run)
ebook-catalog --directory /path/to/ebooks --dry-run
# Actually organize ebooks
ebook-catalog --directory /path/to/ebooks
Chatbot Interface
# Single prompt
chatbot "Hello, how are you?"
# Interactive mode
chatbot --interactive
# Use different model or endpoint
chatbot --model codellama --url http://localhost:11434 "Write a Python function"
# Check endpoint health
chatbot --health-check
# List available models
chatbot --list-models
System Information
# Show all system information
system-info
# Show specific category
system-info --category cpu
system-info --category memory
# Output as JSON
system-info --json
Python API
from morchaos.core import duplicate, image, source, ebook, chatbot, system
# Find duplicate files
duplicates = duplicate.find_duplicates(Path("/path/to/files"))
duplicate.act_on_duplicates(duplicates, "delete")
# Find similar images
similar_images = image.find_image_duplicates(Path("/path/to/images"))
# Find duplicate source code
source_duplicates = source.find_source_duplicates(Path("/path/to/code"))
# Catalogize ebooks
ebook.catalogize(Path("/path/to/ebooks"))
# Use chatbot
bot = chatbot.Chatbot()
response = bot.ask("Hello!")
# Get system information
cpu_info = system.get_cpu_info()
memory_info = system.get_memory_info()
Development
Setup Development Environment
# Install development dependencies
poetry install --with dev
# Run tests
pytest
# Run tests with coverage
pytest --cov=morchaos --cov-report=html
# Type checking
mypy morchaos
# Code formatting
black morchaos tests
# Linting
flake8 morchaos tests
Project Structure
morchaos/
โโโ core/ # Business logic modules
โ โโโ duplicate.py # SHA-256 duplicate detection
โ โโโ image.py # Perceptual hash image comparison
โ โโโ source.py # Source code normalization
โ โโโ ebook.py # Ebook metadata extraction
โ โโโ chatbot.py # HTTP client for chat models
โ โโโ system.py # System information collection
โ โโโ file_utils.py # File utilities
โโโ cli/ # Command-line interfaces
โ โโโ duplicate.py # duplicate command
โ โโโ image_diff.py # image-diff command
โ โโโ source_diff.py # source-diff command
โ โโโ ebook_catalog.py # ebook-catalog command
โ โโโ chatbot.py # chatbot command
โ โโโ system_info.py # system-info command
โโโ logger/ # Logging configuration
โโโ tests/ # Test suite
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
We welcome contributions of all kinds! To get started:
- Fork the repository
- Create a new branch (
git checkout -b feature-name) - Make your changes with clear commit messages
- Run tests and ensure code quality checks pass
- Submit a pull request
Guidelines
- Follow the existing code style (PEP8)
- Include tests for new features or bug fixes
- Document new functionality in the README or docstrings
- Be respectful and constructive in code reviews and discussions
Let me know if you'd like a CONTRIBUTING.md or LICENSE file scaffolded next, or if you want to add badges, changelogs, or CI instructions.
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 Distributions
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 morchaos-0.1.0-py3-none-any.whl.
File metadata
- Download URL: morchaos-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42572c93412cc738b3fca93c14184bcdd0311abecc26df5ee417be346b424b45
|
|
| MD5 |
0c431988cbaf2675c63a7d813ee7f703
|
|
| BLAKE2b-256 |
da70891c890ac9455e4e000c9f764809d0fe2eabc10d9751877bfc36f3f95f1a
|