Skip to content

Modular interpolation in configparser #54708

Closed

Description

@ambv
BPO 10499
Nosy @freddrake, @birkenfeld, @rhettinger, @merwok, @ambv
Files
  • configparser_interpolation.diff: Refactoring to enable modular interpolation
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ambv'
    closed_at = <Date 2010-12-03.16:29:45.449>
    created_at = <Date 2010-11-22.03:16:24.286>
    labels = ['type-feature', 'library']
    title = 'Modular interpolation in configparser'
    updated_at = <Date 2010-12-03.16:29:45.447>
    user = 'https://github.com/ambv'

    bugs.python.org fields:

    activity = <Date 2010-12-03.16:29:45.447>
    actor = 'lukasz.langa'
    assignee = 'lukasz.langa'
    closed = True
    closed_date = <Date 2010-12-03.16:29:45.449>
    closer = 'lukasz.langa'
    components = ['Library (Lib)']
    creation = <Date 2010-11-22.03:16:24.286>
    creator = 'lukasz.langa'
    dependencies = []
    files = ['19767']
    hgrepos = []
    issue_num = 10499
    keywords = ['patch', 'needs review']
    message_count = 4.0
    messages = ['122078', '122537', '122744', '123258']
    nosy_count = 6.0
    nosy_names = ['fdrake', 'georg.brandl', 'rhettinger', 'eric.araujo', 'lukasz.langa', 'asolovyov']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue10499'
    versions = ['Python 3.2']

    Activity

    1. ambv commented on Nov 22, 2010

      @ambv
      ContributorAuthor

      SUMMARY
      =======

      This is a refactoring of configparser raised from discussions on bpo-6517 and bpo-9876. It solves both issues and makes the code quite elegant. Best part is, it's fully backwards compatible [1].

      In the patch I basically did:
      a) move the interpolation functionality out of the parsers
      b) deprecate RCP and CP in favor of SCP
      c) refactor the resulting code to get rid of duplicates

      This means that actually despite the generalization and introduction of deprecation warnings, configparser lost 22 lines in the process. The implementation is complete and unit tested.

      WHAT'S LEFT TO DO
      =================

      1. Obviously the new interpolation init argument needs docs. This includes the docstrings on *Interpolation classes that describe how the algorithms work.

      2. ExtendedInterpolation class implementing the buildout syntax, that would satisfy the request from bpo-9876.

      3. Once we have more interpolation implementations new test cases will be added to test_cfgparser.py.

      Will do all three when I have any opinions on the current direction.

      REVIEW HINTS
      ============

      I need some thumbs up or advice on the design decisions made.

      1. interpolation now takes a class, init instantiates an object on its own. Do tell if taking an object upfront would be a better approach.

      2. *Interpolation classes have methods which take the parser as an argument. Do tell if making it an object attribute would be a better approach.

      All other points of interest during a review naturally apply here too.

      [1] Assuming _names are private and can be moved around when needed.

    2. self-assigned this
      on Nov 22, 2010
    3. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Nov 22, 2010
    4. ambv commented on Nov 27, 2010

      @ambv
      ContributorAuthor

      Patch reposted here for review: http://codereview.appspot.com/3309043/

    5. freddrake commented on Nov 28, 2010

      @freddrake
      Member

      Review posted.

    6. ambv commented on Dec 3, 2010

      @ambv
      ContributorAuthor

      Committed in rev 86976.

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions