ChatEnv 是 ChatArch / chatxxx 系列项目共用的 typed env/profile 底层包。它提供字段描述、配置基类、registry、路径、profile 文件读写、mask、paste 解析,以及 runtime token-store 的通用能力;具体业务变量、登录刷新和连通性语义由各项目自己定义并注册。
文档入口:https://arch.gh.wzhecnu.cn/ChatEnv/
安装
pip install chatenv --upgrade
chatenv --version
chatenv --tree
chatenv --tree-brief
支持 Python >=3.10。
目录
CHATARCH_HOME=${CHATARCH_HOME:-~/.chatarch}
$CHATARCH_HOME/envs/ # stable typed env/profile files
$CHATARCH_HOME/tokens/ # generated runtime tokens/sessions, parallel to env profiles
ChatEnv 只负责 stable env/profile 与 runtime token-store 的存储规则,不额外创建 config/cache/data/state,也不把 tokens/ 当作第二个手工维护 secret/env 层。
CLI 树
chatenv --tree 从当前安装包的 Click 注册表实时输出带参数签名的完整命令面;chatenv --tree-brief 读取同一注册表,但省略参数签名。
chatenv
├── --help # Show this message and exit.
├── --version # Show the version and exit.
├── --tree # Print the registered command tree.
├── --tree-brief # Print the registered command tree without parameter signatures.
├── --home HOME # Override CHATARCH_HOME for this command.
├── init [--type CONFIG-TYPES] [--interactive] # Create or update active typed env files.
├── new [NAME] [--type CONFIG-TYPES] [--yes] [--interactive] # Create a named typed profile without activating it.
├── paste [--value VALUE] [--stdin] [--profile PROFILE] [--yes] [--interactive] # Paste loose env text and import recognized keys.
├── use [NAME] [--type CONFIG-TYPES] [--interactive] # Activate a named profile for one config type.
├── list [--type CONFIG-TYPES] # List active default and named profiles grouped by config type.
├── status [--type CONFIG-TYPES] [--detail] # Show registered config platforms and provider ownership.
├── token # Manage generic runtime token profiles.
│ ├── status <SERVICE> [PROFILE] [--format OUTPUT-FORMAT] # Show safe runtime token metadata for SERVICE/PROFILE.
│ ├── refresh <SERVICE> [PROFILE] [--format OUTPUT-FORMAT] # Refresh SERVICE/PROFILE through a registered service refresh provider.
│ ├── import <SERVICE> [PROFILE] [--stdin] [--file VALUE-FILE] [--token-type TOKEN-TYPE] [--summary SUMMARY] [--expires-at EXPIRES-AT] [--format OUTPUT-FORMAT] # Explicitly import externally refreshed runtime token JSON.
│ ├── list [SERVICE] [--format OUTPUT-FORMAT] # List runtime token profiles grouped by service.
│ └── clear <SERVICE> [PROFILE] [--execute] [--format OUTPUT-FORMAT] # Clear a generic runtime token file for SERVICE/PROFILE.
├── cat [NAME] [--no-mask] [--type CONFIG-TYPES] # Print active values, or a named typed profile with -t TYPE NAME.
├── get [KEY] [--interactive] # Get a configuration value from active typed env files.
├── set [KEY-VALUE] [--interactive] # Set a configuration value in the matching active typed env file.
├── save [NAME] [--type CONFIG-TYPES] [--yes] [--interactive] # Save current active values as a named profile.
├── delete [NAME] [--type CONFIG-TYPES] [--yes] [--interactive] # Delete a named profile for one config type.
└── test [--target TARGET] [--interactive] # Test a registered configuration schema.
常用命令
chatenv init -t example
chatenv status --detail
chatenv cat -t example
chatenv paste --stdin --profile work --yes
chatenv set EXAMPLE_API_KEY=sk-xxx
chatenv get EXAMPLE_API_KEY
chatenv token refresh PyPI RexWzh
chatenv token status PyPI RexWzh
敏感值默认 mask;token status/list/clear 只输出 safe metadata,不输出 raw token/cookie/CSRF values。
Python API
from chatenv import BaseEnvConfig, EnvField, EnvStore, get_paths
class ExampleConfig(BaseEnvConfig):
_title = "Example Configuration"
_aliases = ["example"]
_storage_dir = "Example"
EXAMPLE_API_KEY = EnvField("EXAMPLE_API_KEY", is_sensitive=True)
paths = get_paths()
store = EnvStore(paths.envs_dir)
store.save_active(ExampleConfig, {"EXAMPLE_API_KEY": "sk-..."})
文档
- https://arch.gh.wzhecnu.cn/ChatEnv/
docs/cli.md:CLI 用法docs/design.md:路径、数据布局与注册策略docs/developer-guide.md:chatxxx 项目接入和 provider 开发指南docs/development.md:测试、构建与发布
开发
python -m pip install -e .[dev,docs]
python -m pytest -q
python -m mkdocs build --strict
python -m build
python -m twine check dist/*
开源协议
MIT License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file chatenv-0.2.10.tar.gz.
File metadata
- Download URL: chatenv-0.2.10.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d6251b6aa387350ee45640f415f5f01779337b95cd76cceffddddb074b42b80
|
|
| MD5 |
bdac39100cf3b62314d84310a7885dee
|
|
| BLAKE2b-256 |
709fd9f3318b9123e6ef6be0d892bc7ed56b6c63514782a8d8712418a868db93
|
Provenance
The following attestation bundles were made for chatenv-0.2.10.tar.gz:
Publisher:
publish.yml on ChatArch/ChatEnv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chatenv-0.2.10.tar.gz -
Subject digest:
0d6251b6aa387350ee45640f415f5f01779337b95cd76cceffddddb074b42b80 - Sigstore transparency entry: 2547683523
- Sigstore integration time:
-
Permalink:
ChatArch/ChatEnv@7d25b32798e5b93f9119878c41a72c8b7eed8641 -
Branch / Tag:
refs/tags/v0.2.10 - Owner: https://github.com/ChatArch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7d25b32798e5b93f9119878c41a72c8b7eed8641 -
Trigger Event:
push
-
Statement type:
File details
Details for the file chatenv-0.2.10-py3-none-any.whl.
File metadata
- Download URL: chatenv-0.2.10-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
634668af28d5868b4a71c2ff4220c7c0f781440415d826757a45b22e0f0b010b
|
|
| MD5 |
b516ae4fa97977cbfd8b5b2775f573f6
|
|
| BLAKE2b-256 |
27cd96b986ebcea168d39f1f2bb74254b4ec7da66756788e5c461ea86fcccb75
|
Provenance
The following attestation bundles were made for chatenv-0.2.10-py3-none-any.whl:
Publisher:
publish.yml on ChatArch/ChatEnv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chatenv-0.2.10-py3-none-any.whl -
Subject digest:
634668af28d5868b4a71c2ff4220c7c0f781440415d826757a45b22e0f0b010b - Sigstore transparency entry: 2547683921
- Sigstore integration time:
-
Permalink:
ChatArch/ChatEnv@7d25b32798e5b93f9119878c41a72c8b7eed8641 -
Branch / Tag:
refs/tags/v0.2.10 - Owner: https://github.com/ChatArch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7d25b32798e5b93f9119878c41a72c8b7eed8641 -
Trigger Event:
push
-
Statement type: