zbig


Namezbig JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryBig Zhu Python Utility Library
upload_time2025-07-18 07:33:54
maintainerNone
docs_urlNone
authorbigzhu
requires_python<4.0,>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # zbig - Big Zhu Python Utility Library

[![Test](https://github.com/bigzhu/zbig/actions/workflows/test.yml/badge.svg)](https://github.com/bigzhu/zbig/actions/workflows/test.yml)
[![Lint](https://github.com/bigzhu/zbig/actions/workflows/lint.yml/badge.svg)](https://github.com/bigzhu/zbig/actions/workflows/lint.yml)
[![PyPI version](https://badge.fury.io/py/zbig.svg)](https://badge.fury.io/py/zbig)
[![Python versions](https://img.shields.io/pypi/pyversions/zbig.svg)](https://pypi.org/project/zbig/)

一个包含各种实用工具的 Python 库,主要用于个人开发项目。

## 安装

```bash
pip install zbig
```

## 功能模块

### zfile - 文件操作
- CSV 文件读写操作
- 支持重复数据检测
- 批量数据处理

### ztelegram - Telegram 集成
- 消息发送
- 图片发送
- 支持中国时区时间戳

### zprint - 增强打印
- 表格格式化输出
- 支持中文字符宽度计算
- 实时刷新表格显示

### ztime - 时间工具
- 中国时区时间格式化
- 统一的时间戳格式

### zcache - 缓存工具
- JSON 文件缓存装饰器
- 可配置缓存生命周期
- 自动缓存清理
- UTF-8 支持与性能优化

### zhash - 哈希工具
- 函数参数哈希计算
- 一致性哈希生成

### zlog - 日志系统
- 统一的日志配置
- 多级别日志支持
- 灵活的格式化配置

### zconfig - 配置管理
- 环境变量管理
- .env 文件支持
- 配置验证机制

## 使用示例

```python
# CSV 操作
from zbig.zfile.zcsv import read_csv, write_csv_append

header, rows = read_csv("data.csv")
write_csv_append("data.csv", ["new", "row", "data"])

# 缓存装饰器
from zbig.zcache.json_cache import cache

@cache(life_second=3600)  # 1小时缓存
def expensive_function(param):
    # 耗时操作
    return result

# 时间格式化
from zbig.ztime.cn_now import cn_now
print(cn_now())  # 2024-01-01 12:00:00

# 表格打印
from zbig.zprint.table import table
table([['Name', 'Age'], ['Alice', '25']], "  ")
```

## 开发

### 环境设置

```bash
# 安装依赖
poetry install

# 安装预提交钩子
pre-commit install

# 运行测试
poetry run pytest

# 代码格式化
poetry run ruff format zbig

# 类型检查
poetry run mypy zbig
```

## 更新日志

### 0.1.20
- 添加完整的测试套件
- 改进类型注解
- 添加开发工具配置
- 修复拼写错误

### 0.1.14
- curses_table 自动刷新功能

### 0.1.13
- 增加 curses_table

### 0.1.9
- 支持非英文的 table print

## test

```bash
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "zbig",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "bigzhu",
    "author_email": "vermiliondun@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ea/3a/33675a6696e8ed07acfc1a329a0ce2bae8710db0066fbf58791f6b070c50/zbig-0.2.0.tar.gz",
    "platform": null,
    "description": "# zbig - Big Zhu Python Utility Library\n\n[![Test](https://github.com/bigzhu/zbig/actions/workflows/test.yml/badge.svg)](https://github.com/bigzhu/zbig/actions/workflows/test.yml)\n[![Lint](https://github.com/bigzhu/zbig/actions/workflows/lint.yml/badge.svg)](https://github.com/bigzhu/zbig/actions/workflows/lint.yml)\n[![PyPI version](https://badge.fury.io/py/zbig.svg)](https://badge.fury.io/py/zbig)\n[![Python versions](https://img.shields.io/pypi/pyversions/zbig.svg)](https://pypi.org/project/zbig/)\n\n\u4e00\u4e2a\u5305\u542b\u5404\u79cd\u5b9e\u7528\u5de5\u5177\u7684 Python \u5e93\uff0c\u4e3b\u8981\u7528\u4e8e\u4e2a\u4eba\u5f00\u53d1\u9879\u76ee\u3002\n\n## \u5b89\u88c5\n\n```bash\npip install zbig\n```\n\n## \u529f\u80fd\u6a21\u5757\n\n### zfile - \u6587\u4ef6\u64cd\u4f5c\n- CSV \u6587\u4ef6\u8bfb\u5199\u64cd\u4f5c\n- \u652f\u6301\u91cd\u590d\u6570\u636e\u68c0\u6d4b\n- \u6279\u91cf\u6570\u636e\u5904\u7406\n\n### ztelegram - Telegram \u96c6\u6210\n- \u6d88\u606f\u53d1\u9001\n- \u56fe\u7247\u53d1\u9001\n- \u652f\u6301\u4e2d\u56fd\u65f6\u533a\u65f6\u95f4\u6233\n\n### zprint - \u589e\u5f3a\u6253\u5370\n- \u8868\u683c\u683c\u5f0f\u5316\u8f93\u51fa\n- \u652f\u6301\u4e2d\u6587\u5b57\u7b26\u5bbd\u5ea6\u8ba1\u7b97\n- \u5b9e\u65f6\u5237\u65b0\u8868\u683c\u663e\u793a\n\n### ztime - \u65f6\u95f4\u5de5\u5177\n- \u4e2d\u56fd\u65f6\u533a\u65f6\u95f4\u683c\u5f0f\u5316\n- \u7edf\u4e00\u7684\u65f6\u95f4\u6233\u683c\u5f0f\n\n### zcache - \u7f13\u5b58\u5de5\u5177\n- JSON \u6587\u4ef6\u7f13\u5b58\u88c5\u9970\u5668\n- \u53ef\u914d\u7f6e\u7f13\u5b58\u751f\u547d\u5468\u671f\n- \u81ea\u52a8\u7f13\u5b58\u6e05\u7406\n- UTF-8 \u652f\u6301\u4e0e\u6027\u80fd\u4f18\u5316\n\n### zhash - \u54c8\u5e0c\u5de5\u5177\n- \u51fd\u6570\u53c2\u6570\u54c8\u5e0c\u8ba1\u7b97\n- \u4e00\u81f4\u6027\u54c8\u5e0c\u751f\u6210\n\n### zlog - \u65e5\u5fd7\u7cfb\u7edf\n- \u7edf\u4e00\u7684\u65e5\u5fd7\u914d\u7f6e\n- \u591a\u7ea7\u522b\u65e5\u5fd7\u652f\u6301\n- \u7075\u6d3b\u7684\u683c\u5f0f\u5316\u914d\u7f6e\n\n### zconfig - \u914d\u7f6e\u7ba1\u7406\n- \u73af\u5883\u53d8\u91cf\u7ba1\u7406\n- .env \u6587\u4ef6\u652f\u6301\n- \u914d\u7f6e\u9a8c\u8bc1\u673a\u5236\n\n## \u4f7f\u7528\u793a\u4f8b\n\n```python\n# CSV \u64cd\u4f5c\nfrom zbig.zfile.zcsv import read_csv, write_csv_append\n\nheader, rows = read_csv(\"data.csv\")\nwrite_csv_append(\"data.csv\", [\"new\", \"row\", \"data\"])\n\n# \u7f13\u5b58\u88c5\u9970\u5668\nfrom zbig.zcache.json_cache import cache\n\n@cache(life_second=3600)  # 1\u5c0f\u65f6\u7f13\u5b58\ndef expensive_function(param):\n    # \u8017\u65f6\u64cd\u4f5c\n    return result\n\n# \u65f6\u95f4\u683c\u5f0f\u5316\nfrom zbig.ztime.cn_now import cn_now\nprint(cn_now())  # 2024-01-01 12:00:00\n\n# \u8868\u683c\u6253\u5370\nfrom zbig.zprint.table import table\ntable([['Name', 'Age'], ['Alice', '25']], \"  \")\n```\n\n## \u5f00\u53d1\n\n### \u73af\u5883\u8bbe\u7f6e\n\n```bash\n# \u5b89\u88c5\u4f9d\u8d56\npoetry install\n\n# \u5b89\u88c5\u9884\u63d0\u4ea4\u94a9\u5b50\npre-commit install\n\n# \u8fd0\u884c\u6d4b\u8bd5\npoetry run pytest\n\n# \u4ee3\u7801\u683c\u5f0f\u5316\npoetry run ruff format zbig\n\n# \u7c7b\u578b\u68c0\u67e5\npoetry run mypy zbig\n```\n\n## \u66f4\u65b0\u65e5\u5fd7\n\n### 0.1.20\n- \u6dfb\u52a0\u5b8c\u6574\u7684\u6d4b\u8bd5\u5957\u4ef6\n- \u6539\u8fdb\u7c7b\u578b\u6ce8\u89e3\n- \u6dfb\u52a0\u5f00\u53d1\u5de5\u5177\u914d\u7f6e\n- \u4fee\u590d\u62fc\u5199\u9519\u8bef\n\n### 0.1.14\n- curses_table \u81ea\u52a8\u5237\u65b0\u529f\u80fd\n\n### 0.1.13\n- \u589e\u52a0 curses_table\n\n### 0.1.9\n- \u652f\u6301\u975e\u82f1\u6587\u7684 table print\n\n## test\n\n```bash\npytest\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Big Zhu Python Utility Library",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "841584a6280aa48644d5796a7c1e34cf0ed1883b4c02e3921f5409a7bb61dc87",
                "md5": "479174ad7f1c749843a1438f539a9ce4",
                "sha256": "1c8295b901cdfe0661ff074670f6173253260e2dbd5752ae20b944635ccf0ec8"
            },
            "downloads": -1,
            "filename": "zbig-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "479174ad7f1c749843a1438f539a9ce4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 13807,
            "upload_time": "2025-07-18T07:33:53",
            "upload_time_iso_8601": "2025-07-18T07:33:53.124554Z",
            "url": "https://files.pythonhosted.org/packages/84/15/84a6280aa48644d5796a7c1e34cf0ed1883b4c02e3921f5409a7bb61dc87/zbig-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ea3a33675a6696e8ed07acfc1a329a0ce2bae8710db0066fbf58791f6b070c50",
                "md5": "5ce64a334bf0012d7bf950c6f6f98b3f",
                "sha256": "278129d411fce158504726236a1e5f82416a44ee96f892b709dc302dd8836e36"
            },
            "downloads": -1,
            "filename": "zbig-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5ce64a334bf0012d7bf950c6f6f98b3f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 10278,
            "upload_time": "2025-07-18T07:33:54",
            "upload_time_iso_8601": "2025-07-18T07:33:54.594679Z",
            "url": "https://files.pythonhosted.org/packages/ea/3a/33675a6696e8ed07acfc1a329a0ce2bae8710db0066fbf58791f6b070c50/zbig-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-18 07:33:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "zbig"
}
        
Elapsed time: 2.13852s