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.3

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.3
File Size Uploaded Provenance Actions
iiconf-0.0.3.tar.gz 4.1 kB Without provenance Details for iiconf-0.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 8.4 kB

Release files / iiconf-0.0.3.tar.gz

Download URL iiconf-0.0.3.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
832df2ca46d066d4a273835a82be8efb8aabb1c4c02d0066a33b6b73c812fa56
BLAKE2b-256 checksum
How to use checksums
a8798b958459d7460fcd34d9f5231dec304df0757dbd4d4b451bf69465b66a56
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.3-py3-none-any.whl

Download URL iiconf-0.0.3-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc6fec786f1299091c70d9785320e4a0e03622bdb6e36cd1382dd6b7a4df5fcb
BLAKE2b-256 checksum
How to use checksums
9aa6e93ffcbc3d82963951c28cc6b5a53d727eb7082cb7c46f419e80e1a32fb2
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.3

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