Skip to main content

This package contains various automotion tools

Project description

mhmixtools

This package provides various automation tools for developers.

Current Features

  • template_sync: Automate HTML template updates.
  • folder_structure_generator: Simplify the creation of project folder structures.
  • image_utils: Utilities for image processing tasks.
  • decorators: Handy decorators for Python functions.

Installation

To install the package, use the following command:

pip install mhmixtools

Usage Guide

1. template_sync

This module helps automate updating multiple HTML files with a shared template.

Available Functions:

  1. list_html
    Lists all .html files in a project, with options to exclude specific directories and display the results.

    Function Signature:

    list_html(exclude_dirs: list, show: bool = True) -> list
    
    • Parameters:
      • exclude_dirs (list): Directories to skip while searching for .html files.
      • show (bool): When True (default), prints the file locations to the terminal. When False, returns a list of file paths.
    • Returns:
      • A list of file paths if show=False.

    Example:

    from mhmixtools.template_sync import list_html
    
    # List HTML files excluding the 'env' directory and print the results
    list_html(exclude_dirs=['env'])
    
    # Get a list of HTML file paths
    html_files = list_html(exclude_dirs=['env'], show=False)
    print(html_files)
    
  2. render_templates
    Updates multiple HTML files by applying a shared template, preserving dynamic content within a specific container.

    Function Signature:

    render_templates(template_url: str, target_files: list, content_id: str, indent: int = 4)
    
    • Parameters:
      • template_url (str): Path to the shared template file.
      • target_files (list): List of file paths to be updated with the template.
      • content_id (str): The id of the container element holding dynamic content. Content within this container remains unchanged.
      • indent (int): Indentation level for prettifying the HTML output (default is 4 spaces).
    • Returns:
      • None. Updates are made directly to the target files.

    Example:

    from mhmixtools.template_sync import render_templates
    
    # Define the template file and target files
    template_url = "template.html"
    target_files = [
        "file1.html",
        "file2.html",
    ]
    
    # Define the dynamic content container's ID
    content_id = "content"
    
    # Apply the template with 4-space indentation
    render_templates(template_url, target_files, content_id, indent=4)
    

Notes

  • Ensure the content_id matches the id attribute of the dynamic content container in your HTML files.
  • Use list_html to quickly gather all target file paths.

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.1.tar.gz (5.6 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.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mhmixtools-0.1.tar.gz
Algorithm Hash digest
SHA256 855272671b28997192b803f47b3366843a587a0800b0d43040ae6d7f13908f29
MD5 d3813cdff2d3c1254d50603ea514c55e
BLAKE2b-256 f5ceef9693b6f5fce0c54e2ee327637ba09bbb33a77348f842ebe6162821961f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mhmixtools-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2914ac783b6c010cbc0b236af9f78ff434b4954822905a015201ba6d41b1ec4f
MD5 ffab744f726ae7b57ac3c6a99b122207
BLAKE2b-256 023586fa6a1f187239d136a0aacc2c7e23d17bde8fec1aed687c19c19c0e46ee

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