Official Python YINI Parser
Parse YINI configuration files in Python.
The official Python parser for YINI is available as an alpha package for early testing, examples, integrations, and feedback.
It lets Python applications, scripts, tools, and services load YINI configuration files as ordinary Python data structures.
Status: Alpha
The parser is usable for testing and early integration, but the public API and edge-case behavior may still change before1.0.0.
Install
pip install yini-parserThe package name on PyPI is:
yini-parserThe Python import name is:
import yini_parserQuick example
Suppose you have this YINI file:
^ App
name = "Demo App"
version = 1.2
debug = false
^^ Server
host = "localhost"
port = 8080Parse it in Python:
from yini_parser import load
config = load("config.yini")
print(config["App"]["name"])
print(config["App"]["Server"]["port"])Output:
Demo App
8080Parse from a string
Use loads(...) when the YINI input is already available as a string:
from yini_parser import loads
config = loads("""
^ App
name = "Demo App"
debug = false
""")
print(config["App"]["debug"])Output:
FalseWhat you get back
The parser returns normal Python values such as dictionaries, lists, strings, numbers, booleans, and None.
^ App
name = "Demo App"
features = ["search", "logs"]
debug = falsebecomes:
{
"App": {
"name": "Demo App",
"features": ["search", "logs"],
"debug": False,
}
}Good fit for
The Python parser is useful for:
- Application configuration.
- Python scripts and tools.
- Small services and internal utilities.
- Testing YINI files in Python projects.
- Trying YINI outside the TypeScript/JavaScript ecosystem.
Related tools and examples
- YINI CLI page
Validate and convert YINI files from the command line. - YINI examples
Validate and convert YINI files from the command line. - YINI demo apps
Example projects showing YINI usage in Python, JavaScript, and TypeScript.
Learn more
- β‘οΈ YINI format overview
What YINI is and why it exists. - β‘οΈ Learn the YINI syntax
A simple introduction to sections, values, nesting, and comments. - β‘οΈ Examples
See YINI examples from simple to more advanced. - β‘οΈ YINI Specification
The formal specification for the YINI format.
Links
If you want to try the parser or explore the project further, these links are a good place to continue.
