imperfect
A CST-based config editor for configparser
Decision gist · record as of 2026-08-14
Yes, if you need to edit INI-format config files programmatically and preserving formatting matters. The package is stable, low-friction to install, and solves a real problem that standard configparser cannot. The aging maintenance status (477 days since last release) is not a blocker for a mature tool, but verify it handles your specific INI dialect before relying on it in production.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later
- Low friction: pure Python wheel with a single runtime dependency (moreorless).
- Maintenance status is aging—last release was 477 days ago, though the repository remains active and stable since its initial 2019 release.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions, making it suitable for both open-source and commercial projects.
last release 2025-04-24 (477 days) · last repo commit 2025-04-24 · 3 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 745,667 downloads/mo, #5,171 on PyPI
Alternatives
Verify before relying
import imperfect
with open("setup.cfg") as f:
data = f.read()
conf = imperfect.parse_string(data)
conf.set_value("metadata", "long_description_content_type", "text/markdown")
with open("setup.cfg", "w") as f:
f.write(conf.text)- Whether the CST implementation handles all edge cases in real-world setup.cfg or other INI files beyond the hypothesis-tested scenarios
- Performance characteristics when editing large or deeply nested configuration files
What it is and what it does
imperfect is a CST-based configuration file editor designed to work with files that follow the configparser format (INI-style). Unlike standard configparser, which reads and discards formatting, imperfect parses the file into a tree of nodes that preserves every detail—whitespace, comments, line breaks—so you can make surgical edits and write the file back without losing its original structure and readability.
You parse a file with `parse_string()`, then manipulate sections and entries directly. For simple cases, you can use `set_value()` to add or change a key-value pair. For precise control over placement and formatting, you construct `ConfigEntry` and `ValueLine` objects with explicit whitespace control, then insert them into the tree. The package follows configparser's quirks for compatibility, including lenient section name parsing and specific whitespace handling conventions. It requires Python 3.8 or later and depends only on moreorless for diff utilities.
Use it for
- Programmatically update setup.cfg while preserving developer comments and formatting
- Build configuration management tools that need to edit INI files without destroying readability
- Automated code generation or build-system integration that modifies config files in place
- Testing frameworks that need to verify or modify configuration files while keeping diffs human-readable
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to edit INI-format config files programmatically and preserving formatting matters.
The package is stable, low-friction to install, and solves a real problem that standard configparser cannot. The aging maintenance status (477 days since last release) is not a blocker for a mature tool, but verify it handles your specific INI dialect before relying on it in production.
Install
imperfect on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (moreorless). Maintenance status is aging—last release was 477 days ago, though the repository remains active and stable since its initial 2019 release.
Requires Python 3.8 or later
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
import imperfect
with open("setup.cfg") as f:
data = f.read()
conf = imperfect.parse_string(data)
conf.set_value("metadata", "long_description_content_type", "text/markdown")
with open("setup.cfg", "w") as f:
f.write(conf.text)
Verify before relying
- Whether the CST implementation handles all edge cases in real-world setup.cfg or other INI files beyond the hypothesis-tested scenarios
- Performance characteristics when editing large or deeply nested configuration files
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagemoreorless |
| Maintenance | Aging 477 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 745,667 / month, #5,171 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: imperfect-0.4.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “ini file editor preserving comments”
- imperfectParses and edits configparser-compatible INI files while preserving…
- ConfigUpdaterConfigUpdater reads and modifies INI configuration files while…
- commented-configparserExtends Python's standard ConfigParser to preserve comments and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also codemod-yaml · config-formatter · iniparse · ConfigUpdater · crudini · iniconfig · commented-configparser · untokenize · confection · libcst