Skip to main content

Xulab toolkit in python

Project description

Xulab Useful Toolkit in Python (xutk)

Maintenance PyPI - Python Version

导入项目

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


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.4.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

xutk-0.3.4-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file xutk-0.3.4.tar.gz.

File metadata

  • Download URL: xutk-0.3.4.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for xutk-0.3.4.tar.gz
Algorithm Hash digest
SHA256 47995e0def32be928a61d6fedd06404b531dad40c646cc73279bc13a2b808800
MD5 5760cf3575daef3b4e13a51a0381b521
BLAKE2b-256 4b7d332da125350016f4bd8d0207b2e2d93d4ca6ffef8975c03251e6aa5a7d91

See more details on using hashes here.

File details

Details for the file xutk-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: xutk-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for xutk-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a715661cbae13bffdb13b6b0401cf154c8f71b5ef0d0a10237e0e8b1b4e01200
MD5 737b14f1cdab8789560ab4ab66d3b374
BLAKE2b-256 e1b97df761eda1a628d38bc43e3396507e53de8f4fc6c16b7366c2f48473ffcc

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