Skip to content

Replace the pgclirc ConfigObj parser with configparser - #1635

Open
jackwalkerlabs wants to merge 7 commits into
dbcli:mainfrom
jackwalkerlabs:replace-the-pgclirc-configobj-parser-while-prese
Open

Replace the pgclirc ConfigObj parser with configparser#1635
jackwalkerlabs wants to merge 7 commits into
dbcli:mainfrom
jackwalkerlabs:replace-the-pgclirc-configobj-parser-while-prese

Conversation

@jackwalkerlabs

Copy link
Copy Markdown

Closes #1634. This is the separate follow-up requested in the review of #1631.

The main pgclirc reader now uses stdlib configparser, with an adapter for the existing typed settings and named-query persistence interface. The compatibility findings and intentional restrictions are documented in docs/config-compatibility.rst.

The main differences from using configparser directly are:

Existing Pgcli/ConfigObj behavior Handling in this change
Case-sensitive names, literal %, ordinary [DEFAULT] section Preserve them explicitly; disable interpolation and default-section inheritance.
Outer quotes, comma-separated lists and typed accessors Parse existing syntax and retain the accessors used by Pgcli.
Triple-quoted named queries Preserve their exact contents, including blank lines, comment-like lines and indentation.
Comments during saves Update the original file's value spans and retain surrounding comments.
ConfigObj root options and nested [[sections]] Intentionally unsupported, with explicit errors. Single-bracket dotted sections remain supported.

ConfigObj remains a dependency because the PostgreSQL service-file parser still uses it on the current base branch. This PR leaves that separate migration and #1631 unchanged.

Validation: 52 selected configuration/startup/DSN/named-query tests and all 16 additional compatibility characterizations passed in Factory's clean, offline Python 3.11 verification container, with Ruff lint/format checks. The compatibility characterizations were also run successfully against unchanged upstream code before becoming required checks. The full live-PostgreSQL integration suite and other supported Python versions were not run in this environment.

Prepared and verified through FactoryChief, run FC-20260911-5DE277. The run history includes the failed candidates and operator-guided repairs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace the pgclirc ConfigObj parser while preserving configuration compatibility

1 participant