Metadata-Version: 2.1
Name: zhige-tools
Version: 0.1.3
Summary: zhige office的个人工具箱
Home-page: https://github.com/zhigeoffice/ZhigeTools/
Author: Zhige office
Author-email: zhigeoffice@gmail.com
License: MIT
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# ZhigeTools
[English](README.md)    |    [简体中文](README-zh.md)
## Introduction
ZhigeTools is an open-source Python toolkit that provides a collection of utility functions for daily work. It is designed to simplify common tasks by offering easy-to-use wrappers.

## Installation
```
pip install zhigetools
```

## Features
- [x] Character Conversion Tools

    base_to_number
    - Converts a string to a number, supporting custom bases and custom symbols for the base.
    ``` python
    from zhige_tools.base_converter import base_to_number
    ```
    number_to_base
    - Converts a number to a string, supporting custom bases and custom symbols for the base.
    ``` python
    from zhige_tools.base_converter import number_to_base
    ```

- [x] INI Configuration File Tools
    - Read, write and validate INI configuration files with type checking
    ``` python
    from zhige_tools.ini_reader import read_ini_file, write_ini_file, initialize_ini_file
    
    # Define configuration rules
    rules = {
        'Database': {
            'host': str,
            'port': int,
            'debug': bool
        }
    }
    
    # Initialize with default values
    initialize_ini_file('config.ini', rules, default_values)
    
    # Read configuration
    config = read_ini_file('config.ini')
    ```

- [x] Snowflake ID Generator
    - Distributed unique ID generator based on Twitter's Snowflake algorithm
    - Support multiple machine IDs and clock drift correction
    ``` python
    from zhige_tools.snowflake import snowflake_handler
    
    # Initialize (can be used on multiple machines with different machine_ids)
    snowflake_handler.create_snowflake(machine_id=1)
    
    # Generate ID
    new_id = snowflake_handler.get_id(machine_id=1)
    
    # Parse ID
    parsed = snowflake_handler.parse_id(new_id, machine_id=1)
    print(parsed)  # {'timestamp': ..., 'datetime': '2024-02-10 10:30:00', 'machine_id': 1, 'sequence': 0}
    ```

## Changelog
- **2024.02.10 v0.1.3**
  - Added Snowflake ID generator
  - Added INI configuration file tools

- **2021.10.25 v0.1.1**
  - Added function hints, updated README.md

- **2021.10.25 v0.1.0**
  - Initial release

