Skip to main content

一个包含原创工具类及快捷函数的工具库。A original utility Python package.

Project description

Zeraora

长期维护的个人开源工具库
An utility Python package supports for my personal and company projects

安装

使用 pip 直接安装:

pip install zeraora

用法

不能保证所有工具类和快捷函数自始至终都放在同一个子包,因此应该直接从根目录导入:

from zeraora import BearTimer

with BearTimer() as bear:
    summary = 0
    for i in range(1000000):
        bear.step(f'loop to {i} now.')
        summary += i

亦或者:

import zeraora

with zeraora.BearTimer() as bear:
    summary = 0
    for i in range(1000000):
        bear.step(f'loop to {i} now.')
        summary += i

但对于 charsetsdjangobase 可以放心从子包导入:

from random import choices
from zeraora.charsets import BASE64

def make_pwd(length: int) -> str:
    return ''.join(choices(BASE64, k=length))

if __name__ == '__main__':
    [
        print(make_pwd(16)) for _ in range(20)
    ]

文档

部分文档以 Markdown 格式存放在 docs 目录下。

源代码多数附带类型标注文档字符串reStructuredText格式),文档未尽事宜请移步源代码浏览。

兼容性

Python 3.7 开始 dict 正式按照插入顺序存储,考虑到 dict 是 Python 的基石,为了避免出现难以察觉的错误,因而将该版本定为兼容下限。这也是我接触过的项目中的最低运行版本,故而不太希望维护对更低版本的兼容。

项目会尽力保证向后兼容性,但还是建议在requirements中写明特定的版本号,避免因为版本更新或回退而出现棘手的错误。

更新

仅列出不兼容旧版的修改,其余变动见git历史。

0.2.5(2023-5-02)

  • OnionObject.__repr__() 不再进行嵌套递归,现在嵌套的OnionObject对象会显示为 OnionObject(...)
  • 去除 OnionObject.__str__() 方法,可以用 import jsonjson.dumps(OnionObject()) 实现原来的效果。
  • 更改 BearTimer 的默认打印格式。
  • BearTimer.output() 拆分为负责准备打印的 record() 和实现打印的 handle()

0.2.0(2023-4-12)

  • JSONObjectJsonObject 合并为 OnionObject ,并删去前述两个类。

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

Zeraora-0.2.5.tar.gz (14.8 kB view hashes)

Uploaded Source

Built Distribution

Zeraora-0.2.5-py3-none-any.whl (18.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page