Migrate to pyparsing 3.x and drop Python 2.7 support #337
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR migrates pyhocon from pyparsing 2.x to pyparsing 3.x, updating all deprecated API calls to use PEP8-compliant naming conventions. As pyparsing 3.x requires Python 3.6.8+, this also removes Python 2.7 and EOL Python 3.x versions (3.4-3.6) support.
Motivation
DeprecationWarningfor old camelCase method names (e.g.,parseString,setParseAction)Changes Made
Dependency Updates
>=2,<4to>=3.0.0API Migrations (pyparsing 3.x)
Method Names (camelCase → snake_case):
parseString()→parse_string()setParseAction()→set_parse_action()setDefaultWhitespaceChars()→set_default_whitespace_chars()replaceWith()→replace_with()Parameter Names:
caseless=→case_insensitive=escChar=→esc_char=unquoteResults=→unquote_results=parseAll=→parse_all=Code Cleanup
basestring/unicodecompatibility shimsurllib2fallback (now usesurllib.requestdirectly)globfallbackimpmodule usage (now usesimportlib.util)strinstead ofunicode)Files Modified
setup.pytox.inipyhocon/config_parser.pypyhocon/period_parser.pypyhocon/config_tree.pypyhocon/converter.pyTesting
pyhoconcommand)Test Results
Breaking Changes⚠️
This PR introduces breaking changes for end users:
What Breaks
What Doesn't Break
ConfigFactory.parse_file()still works)Migration Guide for Users
For Users on Python 3.7+
No code changes required. Simply update dependencies:
For Users on Python 2.7 or 3.4-3.6
You must upgrade Python first:
Or pin to the last compatible version:
Release Notes Suggestion
Version: 0.4.0 (suggest major/minor bump due to breaking changes)
Breaking Changes
Changes
Improvements
Checklist
Additional Context
References