You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MNT]: Upcoming version of pyparsing will start emitting DeprecationWarnings for legacy pre-PEP8 method and argument names #29722
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.
Reacted by Tim Hoffmann, David Stansby, Oscar Gustafsson and Neil Girdhar
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
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.
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).
Activity
[-][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[/+]dstansby commentedon Mar 12, 2025
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.
ptmcg commentedon Mar 13, 2025
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).
QuLogic commentedon Jun 21, 2025
This seems to have been closed by #29745.
fix pyparsing version to < 3.3.0