Registry / serialization / commented-configparser

commented-configparser

JSON →
library3.0.0pypypi✓ verified 82d ago

A custom ConfigParser class that preserves comments and most formatting when writing loaded config out. Version 3.0.0 supports Python >=3.9. Release cadence is irregular.

pip install commented-configparser
INSTALL
IMPORT
SIG · COMMENTED-CONFIGPA
C
commented-configparser
serializationpythonv3.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CommentedConfigParser
from commentedconfigparser import CommentedConfigParser
from commented_configparser import CommentedConfigParser

Read, modify, and write an INI file preserving comments and formatting.

from commented_configparser import CommentedConfigParser config = CommentedConfigParser() config.read('example.ini') # Modify or add values config.set('section', 'key', 'new_value') # Write back preserving comments with open('example.ini', 'w') as f: config.write(f)
Debug
Known issues
breakingVersion 2.x to 3.0.0 dropped Python 2 and older Python 3 versions; requires Python >=3.9. Also, the internal storage changed; any custom subclasses relying on internal data structures may break.
fix
Upgrade to Python >=3.9 and adapt any custom subclasses to new internal representation.
affects: >=3.0.0
gotchaComments are preserved only if you use the same CommentedConfigParser to read and write. Using the stdlib ConfigParser will lose comments.
fix
Always use CommentedConfigParser for both reading and writing if you want to preserve comments.
affects: all
gotchaMultiline values may not preserve original formatting (e.g., indentation) after writing. The library attempts to preserve but edge cases exist.
fix
Check the written file if exact formatting of multiline values is critical.
affects: all
Upgrade
Version history
3.0.0latest on PyPI · released Jun 22, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
commented-configparser — pip install commented-configparser · libregistry