Skip to content

[MNT]: Upcoming version of pyparsing will start emitting DeprecationWarnings for legacy pre-PEP8 method and argument names #29722

Closed

Description

@ptmcg

Summary

I'm about to release version 3.2.2 of pyparsing, which will be the last version to quietly accept both PEP8 and non-PEP8 method and argument names (for instance, accepting parseString as an alias for parse_string). In pyparsing version 3.3.0, usage of those synonyms will start emitting DeprecationWarnings. In version 4.0.0 (currently planned not before 2026), the synonyms will be removed, so that usage of the legacy names will begin to raise various Python exceptions.

Proposed fix

Pyparsing 3.2.2 will include a scanner/converter script pyparsing.tools.cvt_pyparsing_pep8_names to report needed name changes, and optionally update Python scripts in place (this utility is already checked in to GitHub if you wish to try it out before that version gets released). The modified scripts should be compatible back to pyparsing 3.0.0, with the exception of those using delimitedList, which will require pyparsing 3.1.0. This script can be added to CI automation as a scanner to detect needed changes, and used manually to actually apply the necessary changes.

In addition, I plan to release at least 1 alpha and 1 beta release of 3.3.0 before a final release, so that the matplotlib team can run it through its paces.

matplotlib is one of the most significant users of pyparsing, and I would like to be sure that I can maintain compatibility with its uses of this package.

Activity

  1. changed the title [-][MNT]: Pyparsing will start emitting DeprecationWarnings for legacy pre-PEP8 method and argument names[/-] [+][MNT]: Upcoming version of `pyparsing` will start emitting `DeprecationWarnings` for legacy pre-PEP8 method and argument names[/+] on Mar 9, 2025
  2. dstansby commented on Mar 12, 2025

    @dstansby
    Member

    Thanks a lot for opening this in advance! I ran the auto-conversion script, and the results are here: #29745. It looks like there's not much to change, and I'm hoping that with a bump of our minimum supported pyparsing to 3.0 it should be pretty easy to merge the changes soon.

  3. ptmcg commented on Mar 13, 2025

    @ptmcg
    Author

    I also discovered that there are several non-PEP8 attributes on ParserElement, specifically resultsName - which has a couple of referenes in matplotlib. As I did not set up the PEP8 synonyms for that attribute (or several others), it will unfortunately remain. (Since it has no leading underscore, it is fair game for users to assume it is part of the public API - an important lesson learned...)

    I'll implement the synonyms for resultsName and the other non-PEP8 public attributes in 3.3.0, but they will not emit the DeprecationWarnings until at least 4.0.

    I mentioned on your PR but will also note here that upgrading your pyparsing dependency to these later versions may also incur update requirements on Python version. I'll add a table to pyparsing's CHANGES file to reflect Python version dependencies by pyparsing version (so people don't have to go fishing through my repo history to try to figure this out).

  4. QuLogic commented on Jun 21, 2025

    @QuLogic
    Member

    This seems to have been closed by #29745.

  5. added this to the v3.11.0 milestone on Jun 21, 2025
  6. added a commit that references this issue on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions