github pyscaffold/configupdater v4.0

3 hours ago
  • Breaking: Drop support for Python < 3.11, the minimum supported version is now
    Python 3.11, PR #150
  • Add support for Python 3.15, PR #160
  • Simplify type hints using Python 3.11 features (typing.Self, X | Y unions)
    and remove compatibility code for older Python versions, PR #150
  • Add add_before_skip_comments to Section for inserting blocks before the
    comments that directly precede a section, issue #117
  • Fix add_section gluing the new section header to the last line when the file
    does not end with a newline, issue #126
  • Fix None being written as delimiter when assigning a value to an option that was
    parsed without a value (allow_no_value), issue #141
  • Port the option regexes of Python 3.15's configparser (CPython gh-146333). The
    old ones backtracked quadratically, so a long line with many spaces could stall
    the parser for minutes, PR #161
  • Fix navigating, detaching or inserting at the wrong position when a container holds
    several equal comment or blank-line blocks, issue #140
  • del section[key] (and thus section.pop(key)) now applies optionxform
    like section[key] does, PR #148
  • Document that a custom optionxform must be idempotent, PR #152
  • Build with hatchling and hatch-vcs, with all metadata in pyproject.toml. The
    wheel is now tagged py3-none-any (instead of py2.py3-none-any), and the
    license is declared as a PEP 639 expression. The testing extra is removed;
    development dependencies are dependency groups, e.g. uv sync, PR #156
  • Complete the type annotations of the public API, now checked with mypy in strict
    mode, and fix the NoneValueDisallowed warning under python -OO, PR #158
  • Fix NotAttachedError, AlreadyAttachedError and AssignMultilineValueError
    failing with an AttributeError under python -OO, PR #163
  • Correct the NoneValueDisallowed message. It claimed that an option without a
    value is written with an empty value, but the option is omitted since version 3.0.1,
    PR #163
  • add_before.option and add_after.option pass delimiter and
    space_around_delimiters on to the new option instead of silently ignoring all
    keyword arguments. Other keyword arguments now raise a TypeError, PR #163
  • Breaking: An explicit space_around_delimiters of an Option (also given
    to add_before.option, add_after.option or Section.create_option) now
    takes precedence over the syntax options of the ConfigUpdater, so False
    writes key=value even with the default space_around_delimiters=True.
    Option defaults to space_around_delimiters=None, i.e. it follows the
    ConfigUpdater it belongs to: Option("key", "value") now writes
    key=value into a ConfigUpdater(space_around_delimiters=False) instead of
    key = value. Options created with section[key] = value or set keep
    following the ConfigUpdater they are copied to, PR #166
  • Breaking: key in section, section.has_option(key) and
    section.get(key) now apply optionxform to key, like section[key]
    and ConfigParser do. With the default str.lower, "KEY" in section is now
    True and section.get("KEY") returns the option instead of None, PR #153
  • Breaking: Section.set and ConfigUpdater.set keep the given spelling
    when they create a new option, like section[key] = value does. For example,
    updater.set("metadata", "Name", "x") now writes Name = x instead of
    name = x, PR #153
  • ConfigUpdater.set, get, has_option and remove_option apply
    optionxform only once instead of transforming already transformed keys again,
    PR #153
  • Fix wrong code examples in the usage guide and the README, which are now tested,
    PR #164
  • Fix update_file writing the file with the platform's default encoding instead
    of the encoding it was read with. read and read_file remember the encoding
    (read_file takes it from f.encoding), PR #165
  • ConfigUpdater.read and Parser.read call io.text_encoding like
    ConfigParser, so with -X warn_default_encoding the EncodingWarning points
    to the caller (PEP 597), PR #165

Don't miss a new configupdater release

NewReleases is sending notifications on new releases.