Skip to main content

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:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature-name)
  3. Make your changes with clear commit messages
  4. Run tests and ensure code quality checks pass
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

morchaos-0.1.0-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

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

Hashes for morchaos-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42572c93412cc738b3fca93c14184bcdd0311abecc26df5ee417be346b424b45
MD5 0c431988cbaf2675c63a7d813ee7f703
BLAKE2b-256 da70891c890ac9455e4e000c9f764809d0fe2eabc10d9751877bfc36f3f95f1a

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