create iniparser in python #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implementation Spec for Issue #1
Objective
Create a Python package named
inipythat parses.iniconfiguration files, supporting sections, key-value pairs, and comments.Requirements
.inifiles and return a structured dictionary-like object[SectionName])#and;prefixes.iniformatpyproject.tomlpytestFiles to Create
pyproject.tomlsrc/inipy/__init__.pysrc/inipy/parser.pysrc/inipy/exceptions.pytests/test_parser.pyREADME.mdStep-by-Step Implementation Plan
Step 1 — Initialize package structure:
pyproject.tomlwith src layoutStep 2 — Define exceptions:
src/inipy/exceptions.pywithIniParseErrorStep 3 — Implement core parser:
IniParserclass insrc/inipy/parser.pywithparse(),loads(),dumps()Step 4 — Expose public API:
src/inipy/__init__.pyexportsStep 5 — Write tests:
tests/test_parser.pywith pytestStep 6 — Create README: usage documentation
Acceptance Criteria
pyproject.tomlexists with valid metadata and pytest dependencyIniParserclass parses a valid.inifile into a Python dictloads()parses INI from a stringdumps()serializes dict back to valid INI stringIniParseErroris raised for malformed linestests/test_parser.pypass withpytestpip install -e .Notes
Spec confirmed from existing comment. Implementation:
src/inipy/__init__.py— package init withIniParserandIniParseErrorexportssrc/inipy/parser.py—IniParserclass:parse(),loads(),dumps(),_cast(), with regex-based line parsing (section headers[section], key-valuekey = value, comments#/;, blank lines)src/inipy/exceptions.py—IniParseErrorwithlinenoandlineattributespyproject.toml— setuptools build, Python >=3.9, pytest dev deptests/test_parser.py— 13 unit tests covering parsing, sections, comments, casting, round-trip, error handlingTests: 13 passed. Package installable.
Work is on the current branch (cloned from the empty repo). No additional spec comment needed — the existing comment #29705 already documents the plan.
Test results: 13 passed, 0 failed.
All acceptance criteria met. Implementation complete.
Implementation complete for issue #1 — create iniparser in python.
Summary:
inipycreated withIniParserclass supportingparse(),loads(),dumps()#/;), blank linestrue/false), integers, stringsIniParseErrorexception with line/linenoFiles:
pyproject.toml— setuptools build, Python >=3.9src/inipy/__init__.py,parser.py,exceptions.pytests/test_parser.pyREADME.mdInstall:
uv pip install -e .Test:
pytest tests/