Skip to main content

Big Zhu Python Utility Library

Project description

zbig - Big Zhu Python Utility Library

Test Lint PyPI version Python versions

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

安装

pip install zbig

功能模块

zfile - 文件操作

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

ztelegram - Telegram 集成

  • 消息发送
  • 图片发送
  • 支持中国时区时间戳

zprint - 增强打印

  • 表格格式化输出
  • 支持中文字符宽度计算
  • 实时刷新表格显示

ztime - 时间工具

  • 中国时区时间格式化
  • 统一的时间戳格式

zcache - 缓存工具

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

zhash - 哈希工具

  • 函数参数哈希计算
  • 一致性哈希生成

zlog - 日志系统

  • 统一的日志配置
  • 多级别日志支持
  • 灵活的格式化配置

zconfig - 配置管理

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

使用示例

# 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']], "  ")

开发

环境设置

# 安装依赖
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

pytest

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

zbig-0.2.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

zbig-0.2.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zbig-0.2.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.11 Darwin/24.5.0

File hashes

Hashes for zbig-0.2.0.tar.gz
Algorithm Hash digest
SHA256 278129d411fce158504726236a1e5f82416a44ee96f892b709dc302dd8836e36
MD5 5ce64a334bf0012d7bf950c6f6f98b3f
BLAKE2b-256 ea3a33675a6696e8ed07acfc1a329a0ce2bae8710db0066fbf58791f6b070c50

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zbig-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.11 Darwin/24.5.0

File hashes

Hashes for zbig-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c8295b901cdfe0661ff074670f6173253260e2dbd5752ae20b944635ccf0ec8
MD5 479174ad7f1c749843a1438f539a9ce4
BLAKE2b-256 841584a6280aa48644d5796a7c1e34cf0ed1883b4c02e3921f5409a7bb61dc87

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