Skip to main content

baihe-config

基于 Pydantic 的结构化配置管理工具,支持配置的持久化与自动保存,适用于需要高可靠性和易用性的 Python 应用配置场景。

特性

  • 基于 Pydantic,类型安全、易于扩展
  • 支持配置自动持久化到本地 JSON 文件
  • 支持自动加载和保存配置变更
  • 适用于需要高可靠性和易用性的 Python 应用

安装

建议使用 uv 或 pip 进行安装:

# 使用pip
pip install baihe-config

# 使用uv
uv add baihe-config
# 或
uv pip install baihe-config

快速开始

from baihe_config import BaseConfig

class AppConfig(BaseConfig):
    username: str = "admin"
    password: str = "123456"

# 创建配置对象,启用持久化
config = AppConfig(persistent=True, filepath="app_config.json")

# 修改配置会自动保存到文件
config.username = "new_user"

# 重新加载配置
config.load()

参数说明

  • persistent:是否启用持久化(bool,默认 False)
  • filepath:持久化文件路径(str or Path,可选,默认以类名生成到当前工作目录)

依赖

  • Python >= 3.11
  • pydantic >= 2.11.7

作者

Metadata

Release files for baihe-config 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for baihe-config 0.1.2
File Size Uploaded Provenance
baihe_config-0.1.2.tar.gz 11.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for baihe-config 0.1.2
File Interpreter ABI Platform
baihe_config-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / baihe_config-0.1.2.tar.gz

Download URL baihe_config-0.1.2.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
37d6d8e42f93b43e58cd915c949c15dd79e89f7bdd907c8faae577332f883a9b
BLAKE2b-256 checksum
How to use checksums
1d0080417e3d91eedc02093b1a42441d3b6d4f634489b23d9c38e6a4407a11bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.7

Release files / baihe_config-0.1.2-py3-none-any.whl

Download URL baihe_config-0.1.2-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af2bcff3a73d8842cb57afdc1827256bde07b57a00345de819c610d92b0e409f
BLAKE2b-256 checksum
How to use checksums
d255cccb1a80ad157483f670f3e7848129ff1db20bbebb1f9c224f714bd0124d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.7

Security for baihe-config 0.1.2

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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page