-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Overview:
Migrate the entire codebase of radproc from Python 2 to modern Python 3 (>=3.8 recommended). This will ensure ongoing support, compatibility with widely used libraries (numpy, pandas, etc), and improved maintainability.
Migration Tasks
- Update
setup.pyto support Python 3 only (add python_requires, modernize classifiers) - Remove all
from __future__ import division, print_functionstatements (now default in Python 3) - Review and update all iteration methods (e.g.
.iteritems(),.itervalues(),.iterkeys()→.items(),.values(),.keys()) - Replace any
basestring/unicodewithstrand check string/byte conversions ("u''" → no longer needed) - Verify and update file I/O for bytes/str issues, especially in binary/gzip/tar/HDF5 reads
- Ensure all usage of print functions are Python 3 compatible
print() - Update any exceptions for new syntax (
except Exception as e:vsexcept Exception, e:) - Remove/update any other obsolete Python 2 idioms
- Confirm all dependencies support Python 3 and update
requirements.txtif needed - Migrate GIS workflow from ArcMap arcpy syntax to ArcGIS Pro arcpy
- Run all unit/integration tests under Python 3.8+ and fix incompatibilities
- Update documentation (README, docstrings, etc.) to reflect Python 3 as required
Examples of Code Updates:
Update classifiers and python_requires in setup.py:
# Replace Python 2 classifiers:
# 'Programming Language :: Python :: 2',
# 'Programming Language :: Python :: 2.7',
# With Python 3 classifiers, and add python_requires:
setup(
...
python_requires='>=3.8',
classifiers=[
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
...
],
...
)Remove future imports:
# Remove these imports:
from __future__ import division, print_functionUpdate dictionary iteration:
# Python 2 style:
# for k, v in d. iteritems():
# Python 3 style:
for k, v in d.items():Print function:
# Python 2:
# print "Hello"
# Python 3:
print("Hello")String/byte distinction:
# Python 3 requires explicit encoding/decoding:
with open(filename, 'rb') as f:
content = f.read().decode('utf-8')Type checks:
# Python 2:
# isinstance(s, basestring)
# Python 3:
isinstance(s, str)Optional improvements:
- Add type hints and use
f-stringsfor formatting - Use
pathlib.Pathfor file operations instead of string paths
Acceptance criteria:
- All core features pass under modern Python 3 (3.8+)
- CI pipeline for Python 3 is green (if available)
- Python 2 compatibility is dropped and no longer advertised
References:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request