Version 13 (modified by 6 years ago) ( diff ) | ,
---|
Full support of Python 3 in GRASS GIS
Title: | Full support of Python 3 in GRASS GIS |
Student Name: | Sanjeet Bhatti |
Organization: | OSGeo - Open Source Geospatial Foundation |
Mentor Name: | Anna Petrášová and Luca Delucchi |
GSoC proposal: | View proposal |
Link to code: | Code Repository |
Abstract
The current GRASS GIS version has partial support for Python 3. This project aims to update core GRASS components for Python 3 and update all the python modules, libraries and components like script package, python/ctypes, pygrass, temporal, wxGUI, etc. At the end of this project, GRASS GIS will be compatible with both the versions of python, i.e Python 2.7 and Python 3 with its GUI having support for wxPython 4.
Timeline
Time Period | Milestones | |
---|---|---|
Tasks | Status | |
April 23 - May 14 |
| Done |
May 14 - May 20 |
| Done |
May 21 - May 27 |
| Done |
May 28 - June 3 |
| Done |
June 4 - June 10 |
| |
July 11 - July 15 |
| |
June 11 - June 17 |
| |
June 18 - June 24 |
| |
June 25 - July 1 |
| |
July 2 - July 8 |
| |
July 9 - July 13 |
| |
July 9 - July 29 |
| |
July 30 - August 5 |
| |
August 6 - August 14 |
|
Community Bonding Period Report
During the Community Bonding Period I performed the following activities:
Introduction to Community
I wrote an introductory email to the SoC mailing list and grass-dev mailing list and gave a description about my project and shared my wiki page, public repository, and project proposal links.
Create Wiki page
I requested the write access to setup a project wiki page. Then, I created my wiki page detailing the project description, containing link to my GSoC application, a detailed timeline, link to my public repository where all my commits and progress can be followed.
Set up code repository
I have setup my code repository on github for tracking the applied changesets.
Set up development environment
I setup my development environment (Ubuntu 18.04) for two Python versions (Python 2.7.x and Python 3.6.x) for which I am using virtual environments. This was done because I need to make sure that when I update any code it should be compatible with both the versions.
Add links to community wiki pages
I added my project links to the OSGeo's Google Summer of Code 2018 Accepted students wiki page and trac wiki page: https://wiki.osgeo.org/wiki/Google_Summer_of_Code_2018_Accepted and https://trac.osgeo.org/grass/wiki/GSoC.
Discussion with mentors about the libraries tests for the project
I got in touch with my mentors to discuss the right approach to test the code and submit files. We discussed about the python libraries and their testsuites, starting with Python script library.
Get familiar with the testing framework
I followed the wiki page to get familiar with the testing framework(https://grasswiki.osgeo.org/wiki/GRASS_and_Python). I also followed the grass Python Scripting tutorials from this link:
https://github.com/wenzeslaus/python-grass-addon
Update current tests of the python script library, adjust them to work with Python3
I updated the code in the python script library to make it work on Python3 and submitted the patch files for those. I used the standard North Carolina dataset that uses the basic version of the dataset.
(https://grass.osgeo.org/download/sample-data/)
I have looked through the summary reports for the current tests of GRASS which is going to be useful when I will update tests for the libraries in the system. (http://fatra.cnr.ncsu.edu/grassgistests/summary_report/)
Get familiar with the overall working of GRASS GIS and understand Python dependencies in the system
I went through the GRASS wiki pages to get familiar with the working of the system (https://grass.osgeo.org/grass75/manuals/libpython/) and looked through the source code. Also, I found the code dependencies that I will be working with throughout the coding period.
Read documentation
I read some documentation related to GSoC guidelines about working throughout the GSoC period.
I also read GRASS GIS Python library documentation: (https://grass.osgeo.org/grass75/manuals/libpython/)
Practice fixing bugs
I wrote a bug fix related to wxPython(https://trac.osgeo.org/grass/ticket/3510) during Pre-bonding period and submitted the patch file.
Weekly reports
Week 1
What did I complete this week?
- Updated the script for redundant lines in the patch submitted for utils.py
- Tested the patches on Python versions 2.7.x, 3.5.x and 3.6.x
- Read and understood the main differences about Strings, Unicode strings and Byte strings in Python 2 and 3 versions. Wrote some brief differences for quick reference(https://docs.google.com/document/d/18Tvl0vpTSwOfO4xGKXpAo-h6o6WAAZmHX8neYIsHTtA)
- Read python's package futurize's documentation for Py2 to Py3 conversion
- Updated source code in python lib files (uncommitted, still testing)
What am I going to achieve for the next week?
- Finish porting 'script' library to support Python3
- Test the changes for both the versions
- Implement any tests required for testing
Is there any blocking issue?
Not at the moment.
Week 2
What did I complete this week?
- Updated the encode and decode function in utils.py to accept the encoding type
- Ported functions from 'Script' library to deal with unicode/bytes (https://gist.github.com/sanjeetbhatti/6714dff40b8a0a6d30df25ce9e4faa20)
- Tested the changes by running tests (testsuites)
- Tested against the python-grass-addon scripts available from here (https://github.com/wenzeslaus/python-grass-addon)
What am I going to achieve for the next week?
- Write more tests for script library to test the changes
- Look into the issue of running scripts for Python 3.5 and Python 3.6 (some tests fail on either of the versions)
- Port other small libraries and scripts
Is there any blocking issue?
Not at the moment.
Week 3
What did I complete this week?
- Wrote new tests for 'Script' library (https://github.com/sanjeetbhatti/FullSupportPython3/tree/master/grass_trunk/lib-python-script)
- Made changes to the existing source files according to the failing tests (https://docs.google.com/spreadsheets/d/1eAIJtegNWSbBscFChhQzMTl0vmbGPjmrW_013hSw9bI/#gid=0)
- Updated scripts in 'trunk/Scripts' (https://github.com/sanjeetbhatti/FullSupportPython3/tree/master/grass_trunk/scripts)
- Created a spreadsheet to keep track of the status for all trunk/scripts (https://docs.google.com/spreadsheets/d/1eAIJtegNWSbBscFChhQzMTl0vmbGPjmrW_013hSw9bI/#gid=278198865)
- Tested the changes with Python versions 2.7, 3.5 and 3.6
- Cleaned the patches according to the pep8 guidelines and pushed those patches to the repository
What am I going to achieve for the next week?
- After discussion and feedback from the mentors, finish pending work
- Look into ctypes and pygrass libraries
- Discuss with mentors about possible solutions for ctypes
- Test all the changes done for the evaluation period
Is there any blocking issue?
Not at the moment.