Skip to main content

This package contains various automotion tools

Project description

mhmixtools

mhmixtools is a Python utility package providing automation tools for developers and web maintainers. It includes features like HTML template syncing, image utilities, site crawling/reporting, folder structure generation, and helpful decorators.


📦 Installation

pip install mhmixtools

✨ Features

  • template_sync: Automate updating HTML files with a shared layout.
  • image_utils: Download and manage image files efficiently.
  • webcrawler: Crawl websites, collect links, and generate reports.
  • folder_structure_generator: Generate project folder structures quickly.
  • decorators: Simple decorators to track function execution time.

🧩 Module Guide

1. template_sync

Update multiple HTML files with a shared template layout, preserving dynamic sections.

🔹 list_html

list_html(exclude_dirs: list, show: bool = True) -> list
  • Parameters:

    • exclude_dirs: Directories to ignore.
    • show: Print file paths if True (default); return list if False.

🔹 render_templates

render_templates(template_url: str, target_files: list, content_id: str, indent: int = 4)
  • Updates HTML files by replacing layout while keeping content inside an element with id=content_id.

2. image_utils

Tools for working with images from the web and image converters.

🔹 get_next_filename

get_next_filename(base_path: str, filename: str) -> str
  • Returns a unique filename to avoid overwriting existing files in a directory.

🔹 download_image

download_image(url: str, save_dir: str, filename: str = None)
  • Downloads an image from a URL and saves it, generating a unique name if needed.

3. webcrawler

Analyze websites and generate a report of all internal, external, image links, and broken pages.

🔹 get_internal_links, get_external_links, get_image_links

  • Extracts respective link types from a BeautifulSoup-parsed page and base URL.

🔹 crawl_site

crawl_site(start_url: str, max_pages: int = 100)
  • Crawls a website and gathers data from pages.

🔹 check_broken_pages

Checks for broken links (HTTP errors or unreachable pages).

🔹 generate_site_report

Returns a structured dictionary summarizing internal, external, image links, and broken pages.

🔹 print_site_report and save_site_report

  • Display or save the crawl results.

4. folder_structure_generator

Quickly create nested folder structures for projects.

🔹 list_files

list_files(base_dir: str, depth: int = 1, prefix: str = "")
  • Prints or returns folder structure recursively to a specified depth.

5. decorators

Helper decorator for monitoring performance.

🔹 execution_time

@execution_time
def your_function():
    ...
  • Prints how long a function takes to execute.

🧪 Example Usage

Template Sync

from mhmixtools.template_sync import list_html, render_templates

files = list_html(exclude_dirs=['env'], show=False)
render_templates(template_url="base.html", target_files=files, content_id="content")

Download Image

from mhmixtools.image_utils import download_image

download_image("https://example.com/image.jpg", save_dir="images")

Crawl Site

from mhmixtools.webcrawler import crawl_site, print_site_report

report = crawl_site("https://example.com", max_pages=50)
print_site_report(report)

📌 Notes

  • Designed for developers working with static HTML sites, scraping, or automating small tasks.
  • Contributions and suggestions are welcome via GitHub issues.

🛠️ License

MIT License


🤝 Contribute

If you have ideas, improvements, or new tools to add, feel free to open an issue or submit a pull request!

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

mhmixtools-0.2.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

mhmixtools-0.2.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mhmixtools-0.2.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for mhmixtools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 93e4508c5ae17c32f410157d3e7e537326a0c846a188aa592448b5303cd67b28
MD5 854eef9f2e8e41cd229207f739681b09
BLAKE2b-256 a9f0f68f9edb55aaad0ada649a595f5cd9b9c9de9ca20bc5b705be98f5537aa0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mhmixtools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for mhmixtools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0a32fb45edca076417e80e7c1964aa6bc992f053d1bea5648a0c6a0d485b1ac
MD5 1e312b982ed972a6a8968c23c22cd78e
BLAKE2b-256 2234694706571c60be798e721bde7c2405bad9b4d3b25ad035907e1c2fcfbc96

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