| 441 | |
| 442 | === Week 13 - Final Report === |
| 443 | **Title:** Full support of Python 3 in GRASS GIS\\ |
| 444 | **Community:** GRASS GIS - OSGeo |
| 445 | |
| 446 | **Abstract:**\\ |
| 447 | This project updates the GRASS GIS software to support Python 3, where earlier it only worked with Python 2.7 version. All the libraries, modules and components of the system have been updated to include the latest changes that have been introduced in Python 3. One of the important updates was a way to deal with unicode and bytes strings that helped in making GRASS compatible with both the versions of Python by properly encoding and decoding the strings. Additionally, the ctypes library, which was only working with Python 2.7, has been upgraded to deal with Python 3 which further helped in modifying the temporal and pygrass libraries. The pydispatch and guinittest modules has also been altered to properly deal with unicodes while the trunk/scripts have been modified and tested by writing new testsuites for them. The GUI module of GRASS is built with wxPython Classic version, which now with the help of wrapper classes works well with the latest wxPython 4 - Phoenix version. |
| 448 | |
| 449 | **The state of the art BEFORE start of GSoC:**\\ |
| 450 | Before the start of the project, GRASS GIS had partial support for Python 3. The ctypes library failed to compile with Python 3 whereas a lot of code in other modules was incompatible with Python 3 syntax. The GUI module worked with wxPython 3 (Classic version) but not with the latest wxPython 4 (Phoenix). There were lot of assertion errors and deprecated code warnings that were seen when GRASS was coupled with the wxPython 4. |
| 451 | |
| 452 | **The state of the art AFTER GSoC:**\\ |
| 453 | After the GSoC, GRASS can now be compiled with Python 3 version. The different libraries and components of GRASS have been updated and are thus compilable with Python 3.\\ |
| 454 | The GUI module now has support for both the versions of wxPython, i.e. Classic (3 or older) and Phoenix (4). |
| 455 | |
| 456 | **Challenges:**\\ |
| 457 | The biggest challenge in updating GRASS was dealing with the ‘ctypes’ library. The official library has not been updated since some time now and the Python 3 support is not complete. It was a major hurdle to get it working in GRASS to compile other modules/libraries that are dependent on the ‘ctypes’. After making the desired changes in the library, the GRASS system is able to compile but there are some lingering issues that make it hard to fix the issues that persist in the temporal and pygrass libraries. |
| 458 | |
| 459 | **Next Steps:**\\ |
| 460 | The next step would be to discuss ‘ctypes’ issue in further detail with mentors and the development community. Even though some issues related to ctypes have been solved in this project, it still requires some significant efforts and time to make it fully compatible with all Python versions. Moreover, fixing ctypes will help in solving all the remaining issues in other GRASS modules that are closely dependent on this library. |
| 461 | |
| 462 | **Permanent Links:**\\ |
| 463 | Code Repository for GSoC:\\ |
| 464 | https://github.com/sanjeetbhatti/FullSupportPython3 |
| 465 | |
| 466 | Weekly Reports:\\ |
| 467 | https://trac.osgeo.org/grass/wiki/GSoC/2018/FullSupportPython3 |
| 468 | |
| 469 | Python 2 - 3 and wxPython compatibility guidelines for developers:\\ |
| 470 | https://trac.osgeo.org/grass/wiki/Python3Support |
| 471 | |
| 472 | Image for project representation:\\ |
| 473 | https://raw.githubusercontent.com/sanjeetbhatti/FullSupportPython3/master/GSoC-final-report-project-pic.png |