Xulab toolkit in python
Project description
Xulab Useful Toolkit in Python (xutk)
导入项目
pip install \
--trusted-host "gitea.xulab.ion.ac.cn" \
--extra-index-url "http://gitea.xulab.ion.ac.cn/api/packages/zelin2001/pypi/simple/" \
xutk
或者使用 uv:
uv add --index http://gitea.xulab.ion.ac.cn/api/packages/zelin2001/pypi/simple xutk
快速开始
from xutk import verchk, log, mp_runner
from pathlib import Path
# 版本检查
verchk.check_version("0.2.0", "some_package")
# 日志记录
logger = log.CtxLogger("my_app")
logger.info({"module": "processor", "file": "data.csv"}, "Processing started")
# 多进程运行器
runner = mp_runner.mprunner_factory(2, log_file=Path("process.log")) # 进程队列,取 2 个运行
runner.batch_run(["echo", "-E", f"test{num}"] for num in range(1,25)) # 排队 25 个进程
建议在项目 __init__.py 创建 CtxLogger("my_app"),避免实例化顺序问题。
项目结构
xutk/
├── xutk/
│ ├── __init__.py # 包初始化
│ ├── log.py # 日志记录功能
│ ├── mp_runner.py # 多进程运行管理
│ ├── perf.py # 快速资源检查
│ └── verchk.py # 版本检查功能
├── test/
│ ├── integration/ # 集成测试
│ └── unit/ # 单元测试
├── gitea/
│ └── workflows/ # CI 工作流
├── pyproject.toml # 项目配置
└── README.md # 项目文档
开发
安装开发依赖
uv sync --all-extras
运行测试
uv run pytest
代码检查
uv run ruff check # 代码风格检查
uv run ty check # 类型检查
uv run pytest # 样例测试
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xutk-0.3.5.tar.gz
(12.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
xutk-0.3.5-py3-none-any.whl
(14.3 kB
view details)
File details
Details for the file xutk-0.3.5.tar.gz.
File metadata
- Download URL: xutk-0.3.5.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Gentoo","version":"2.18","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5be471d683a9df37e5d0521fb0e7b2f826a0d7c288b71cd89af0d2bece3d89b4
|
|
| MD5 |
53ba56bb937b1bd6881366a1b59ddc0b
|
|
| BLAKE2b-256 |
673fc1c5471857831e6b76c20df5ff45083933930245b38654ef014634a2a352
|
File details
Details for the file xutk-0.3.5-py3-none-any.whl.
File metadata
- Download URL: xutk-0.3.5-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Gentoo","version":"2.18","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ba5cc9a63e8fcdc19e7fe210ff785bc56e3758017d980620ad83de1219f9cfd
|
|
| MD5 |
e3f3d9ee653f9dbe2c75acd7beac5583
|
|
| BLAKE2b-256 |
bc170aea4157a585ebc117f3fa45cf0c3626537a0fbb13ebc24a1dfa39d00ad9
|