Skip to main content

iiconf

English | 中文

把 INI 与 .env 文本解析成普通字典。

安装

pip install iiconf

用法

from iiconf import load_config, parse_env, parse_ini

parse_env('''
# 本地设置
export HOST=localhost
PORT=5432
MOTTO="hello # 不是注释"
''')
# {'HOST': 'localhost', 'PORT': '5432', 'MOTTO': 'hello # 不是注释'}

parse_ini('''
key = v0
[db]
host = localhost
port: 5432
''')
# {'': {'key': 'v0'}, 'db': {'host': 'localhost', 'port': '5432'}}

load_config("settings.ini")

说明

没有类、没有全局状态、不改环境变量。值一律保持字符串——猜测 "0123" 是数字还是编号,正是前导零丢失的起点。${X} 不做替换,保持字面量;无法解析的行抛 ValueError。

许可证

MIT


English

Parse INI and .env text into plain dictionaries.

Install

pip install iiconf

Usage

from iiconf import load_config, parse_env, parse_ini

parse_env('''
# 本地设置
export HOST=localhost
PORT=5432
MOTTO="hello # 不是注释"
''')
# {'HOST': 'localhost', 'PORT': '5432', 'MOTTO': 'hello # 不是注释'}

parse_ini('''
key = v0
[db]
host = localhost
port: 5432
''')
# {'': {'key': 'v0'}, 'db': {'host': 'localhost', 'port': '5432'}}

load_config("settings.ini")

Notes

No classes, no global state, no environment mutation. Values stay strings on purpose: guessing whether "0123" is a number or an ID is how leading zeros get lost. ${X} is not substituted. An unparseable line raises ValueError.

License

MIT

Metadata

Release files for iiconf 0.0.4

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

Source distribution (sdist)

Source distribution for iiconf 0.0.4
File Size Uploaded Provenance Actions
iiconf-0.0.4.tar.gz 4.1 kB Without provenance Details for iiconf-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iiconf 0.0.4
File Interpreter ABI Platform Actions
iiconf-0.0.4-py3-none-any.whl Python 3 none any Details for iiconf-0.0.4-py3-none-any.whl

Total release size: 8.4 kB

Release files / iiconf-0.0.4.tar.gz

Download URL iiconf-0.0.4.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
65d9fe7032c3af93847b56b20add73706c58f62af80c22c1cf0a001acf3bdc6a
BLAKE2b-256 checksum
How to use checksums
8f003bc3eaaf6b012c52fce107c2095ad9d3e9d3cc92d7f4dc46354aadfe30e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / iiconf-0.0.4-py3-none-any.whl

Download URL iiconf-0.0.4-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f5ec76f689faf07edc3e4f3655c84eb2ff9676b0a48a9f8bb1f866fa20282c7
BLAKE2b-256 checksum
How to use checksums
b3d92c75913ee4839b81cd11702e72d24ed0cebb5094f3cb3236b092243756ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for iiconf 0.0.4

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.

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