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.2.tar.gz (9.6 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.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zbig-0.2.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1018-azure

File hashes

Hashes for zbig-0.2.2.tar.gz
Algorithm Hash digest
SHA256 4f7b303abf4077556463fb3592c683fa7eb086373ebf4db67b2f0b56cad0fa5c
MD5 b7c3d16593783b03fb9fdda79b68bd2e
BLAKE2b-256 51542cd72fb28549042b0166d540f57c835332ef1982cfe55cf0d8459b0dc2de

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zbig-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1018-azure

File hashes

Hashes for zbig-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d769310d4ce9110ab162015d1414b329b1dd55a01f8acb4c1552d4499ed61133
MD5 ad737cca4ce7a1ad1ab27237c80840cd
BLAKE2b-256 0720f7901d36bd1152c9eb7d8d740be69feb365ad4be0c5159aa0e5c6c29fd5e

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