-
Notifications
You must be signed in to change notification settings - Fork 9
[WIP; do not merge] Py3 update #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Add Black formatter and configuration - Add Flake8 linter with config - Create pytest structure with basic tests - Set up Travis CI configuration - Improve README documentation - Add pyproject.toml for modern packaging - Create requirements-dev.txt for development dependencies
- Document modernization plans - Include specific tasks and priorities - Add references for implementation
- Mark completed modernization tasks - Add detailed future implementation plan - Organize improvements into phases - Add specific next steps with priorities
- Create comprehensive migration strategy - Document testing approach and recovery procedures - Add step-by-step migration process - Include common Python 2 to 3 migration issues - Setup incremental testing procedures
- Create py_compatibility.py for cross-version compatibility - Fix inspect.getargspec -> getfullargspec for Python 3 - Update string formatting to use f-strings - Handle exception raising syntax changes - Make dependencies soft-fail instead of hard-fail - Update numpy.seterr() call syntax for Python 3 - Create and run basic import tests
- Add STRICT_DEPENDENCIES flag to toggle dependency checking behavior - Update all dependency checks to use the flag for future strict mode - Add fallback implementations for contracts and memoize_simple - Use f-strings for string formatting - Fix exception handling - Clean up code for Python 3 compatibility
- Add Python 3 version of memoize_simple_py3.py - Create indent_utils.py to avoid contracts dependency - Update string_repr.py to work with Python 3 - Fix pickle and StringIO imports in debug_pickler.py - Add compatibility code for Python 2/3 in memoize_simple_imp.py - Add unit tests for memoize_simple functionality
- Add UTF-8 encoding for string to bytes conversion in hash functions - Use f-strings instead of % formatting for format_list function - Improve variable naming (l -> items) for better readability - Add comprehensive docstrings - Create and verify tests for all functions
- Use f-strings instead of % formatting - Add comprehensive docstring for the duration_compact function - Create tests to verify the functionality - Fix edge cases in the tests to match actual behavior
- Add detailed progress report in py3_migrate_details.md - Document all migrated files and their status - Include recovery strategies and workarounds - Update main migration plan with completed tasks - Document next steps for continuing migration
- Fix PyContracts dependency through fork with Python 3.8+ fixes - Update fileutils.py with proper string/bytes handling - Enhance natsort.py with improved natural sorting - Update safe_pickling.py with Python 3 pickle protocol support - Improve safe_write.py with encoding support for text modes - Update my_yaml.py to handle both old and new ruamel.yaml API - Add comprehensive Python 3 compatibility tests - Update migration documentation
- Update mcdp/development.py to import all_disabled directly - Update string_repr.py to import indent directly - Update debug_pickler.py to import describe_type directly - Update mcdp_utils_misc/__init__.py to use memoize_simple_py3 directly - Update migration documentation with progress on challenges - Identify quickapp's imp dependency as a remaining issue
- Create patched version of compmake to replace imp.reload with importlib.reload - Fix inspect.getargspec usage in compmake with inspect.getfullargspec for Python 3 - Fix escape sequence warnings in compmake - Add setup_py3_deps.sh script to install patched dependencies - Update migration documentation with progress on dependency issues - Successfully run tests with patched dependencies
- Document the ZLogger import issue - Explain the root cause and the impact on our migration - Present multiple solution options - Recommend keeping STRICT_DEPENDENCIES=False for now - Provide implementation details for a future fix if needed
- Document changes made to PyContracts for Python 3.8+ compatibility - Document changes made to compmake for Python 3.8+ compatibility - Document changes and remaining issues for quickapp - Include detailed explanations of the issues and their solutions - Provide installation instructions for the patched dependencies
- Update timing.py to use time.process_time() instead of time.clock() - Update string formatting to f-strings for better readability - Fix collections import in locate_files_imp.py - Enhance error handling in memos_selection.py - Add comprehensive tests for all utility modules
- Update metaclass syntax for Python 3 compatibility - Convert string formatting to f-strings - Replace time.clock() with time.process_time() - Fix for-else clause in space_meta.py - Add clearer class docstrings - Create migration progress tracking file This commit updates the core infrastructure of the mcdp_posets module, including: space_meta.py, space.py, poset.py, utils.py, and find_poset_minima directory.
- Migrate uppersets.py with proper f-string formatting - Migrate rcomp.py with improved f-strings - Migrate nat.py with sys.maxsize replacing sys.maxint - Update progress tracking file with completed modules These changes bring the core poset implementations into Python 3 compatibility while preserving their mathematical semantics. The changes include string formatting improvements, removal of Python 2 specific long type, and explicit handling of reduce() which is no longer a built-in function in Python 3.
|
Started migrating dependent modules needed to properly test mcdp_posets: |
1. Exception Handling FixesFixed Python 2 style exception re-raising by updating:
2. Collections Module CompatibilityUpdated imports to support Python 3.12's removal of ABC classes from collections module:
3. String/Bytes HandlingFixed string vs. bytes handling for Python 3:
4. Print Statement Conversion
5. Pyparsing Compatibility LayerCreated a comprehensive compatibility layer to handle differences between pyparsing 2.x and 3.x:
The library now attempts to use the installed pyparsing 3.x when available, falling back to the bundled version only when necessary. Known Issues
|
|
After fiixng many things in the dependent libraries, I migrated the complete mcdp_posets module to Python 3 with the following changes:
Testing is blocked by dependencies requiring migration (mcdp_library module).