base-tools
介绍
base-tools 是一套 Python 基础工具库,帮助开发者快速实现文件操作、字符串处理、编解码、网络通信、日志记录、音频合成等常见功能。所有工具类统一放在 cjlutils 包下,可按需导入使用。
环境要求
- Python >= 3.10
安装
pip install base-tools
安装指定版本:
pip install base-tools==0.1.10
模块一览
| 模块 | 说明 |
|---|---|
AdbUtil |
Android Debug Bridge 常用操作封装 |
BytesUtil |
字节流与整数列表互转 |
CryptoUtil |
AES、RSA、哈希、签名等加解密工具 |
DictUtil |
已废弃,请使用 MappingUtil |
EncodeUtil |
MD5、Base64、URL 编解码 |
FileUtil |
文件/目录创建、读写、压缩、路径处理 |
FtpUtil |
FTP 客户端常用操作 |
GitUtil |
Git 仓库克隆、提交、Stash 等封装 |
HttpUtil |
HTTP 请求封装 |
LipoUtil |
macOS/iOS lipo 命令封装 |
ListUtil |
已废弃,请使用 SequenceUtil |
LogUtil |
线程安全日志,支持文件截断/轮转/按天切分 |
LogicUtil |
常用逻辑运算工具 |
MappingUtil |
通用映射类型(dict、defaultdict 等)操作 |
PyplotUtil |
matplotlib 绘图简化封装 |
QuicUtil |
QUIC 协议客户端操作 |
ScpUtil |
SCP 文件传输封装 |
SequenceUtil |
通用序列类型(list、tuple、str 等)操作 |
SoundUtil |
音频波形合成、ADSR 包络、和弦生成 |
SshUtil |
SSH 连接与命令执行 |
StringUtil |
字符串查找、编码转换、驼峰/蛇形命名转换 |
TcpUtil |
TCP 服务端/客户端封装 |
TimeUtil |
时间格式化、转换、计时等 |
UdpUtil |
UDP 服务端/客户端封装 |
WebsocketUtil |
WebSocket 服务端/客户端封装 |
使用示例
from cjlutils import FileUtil, StringUtil, LogUtil, SequenceUtil
# 文件操作
FileUtil.create_file('./temp/readme.txt', 'hello world', create_parent=True)
# 字符串操作
print(StringUtil.to_camel_case('my_variable_name')) # myVariableName
# 日志记录(默认输出到标准输出和 ./logs/app.log)
LogUtil.i('MAIN', 'application started')
# 序列操作(兼容 list、tuple、str)
print(SequenceUtil.distinct([1, 2, 2, 3])) # [1, 2, 3]
运行测试
PYTHONPATH=$(pwd) python -m unittest discover -s test -p "*Test.py" -v
参与贡献
- Fork 本仓库
- 新建
Feat_xxx分支 - 提交代码
- 新建 Pull Request
Metadata
Release files for base-tools 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| base_tools-0.1.10.tar.gz | 78.3 kB | Without provenance | Details for base_tools-0.1.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| base_tools-0.1.10-py3-none-any.whl | Python 3 | none | any | Details for base_tools-0.1.10-py3-none-any.whl |
Total release size: 133.3 kB
Release files / base_tools-0.1.10.tar.gz
| Download URL | base_tools-0.1.10.tar.gz |
|---|---|
| Size | 78.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0db684a32192365a40f68f3e498bf2e2c69160f5fb8b403be89ed7d47f5f3ec
|
|
BLAKE2b-256 checksum How to use checksums |
34462a1fa82d37559b8311130a98da964d282dddffd92495d4f86764b0ea886c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.15
|
Release files / base_tools-0.1.10-py3-none-any.whl
| Download URL | base_tools-0.1.10-py3-none-any.whl |
|---|---|
| Size | 55.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f25dc6ef88d82065b3e3c9252c2096ecdc7ca310142c6a4a20628465a722015f
|
|
BLAKE2b-256 checksum How to use checksums |
b770240aa8a1ccfce682578cdf95ded6c7619b76fd1abf2e30123d61a1957331
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.15
|
Security for base-tools 0.1.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.