Introduction
This post explains how to clone Karttur’s GeoImagine Python project from GitHub.com with Eclipse. The advantages include that the project is directly linked (imported) to Eclipse and that you can easily access Framework upgrades from within Eclipse, but you can not push any changes back.
The alternatives are to clone or download a complete copy of the Framework using GitHub Desktop or the Git commandline tool and then either import the complete Framework or build a backbone project and copy selected packages. The advantage with the latter solutions is that you then separate the cloning and working with the code, and GitHub Desktop is better than Eclipse for handling GitHub repositories, and if you prefer the command line, git is the natural choice.
The remaining part of this post is similar to the post Clone PyDev project from GitHub in the blog on Install and setup SPIDE.
Prerequisits
You can clone Karttur´s GeoImagine Python project as described in here as long as you have Eclipse installed. To create a fully functional GeoImagine Framework you must also have installed the Spatial Data Integrated Development Environment (SPIDE) as outlined in the blog Install and setup spatial data IDE.
Add GitHub repo to Eclipse
There are many online tutorials for cloning GitHub projects into Eclipse, but I have not found any that deals with cloning a PyDev project. And that is what is outlined in the rest of this post.
Clone GitHub repository with Eclipse
Start Eclipse. Once in, click the Open Perspective icon and select Git, or start writing “Git” in Quick access textbox.
If you get different options for which perspective to select, click the alternative for Git and then
it.The view Git repositories should open (if not use the Quick access textbox and type Git, then select ). In the Git repositories view you should click the alternative Clone a Git repository (if no text appears slide the cursor over the icons to get the alternative Clone a Git repository and add the clone to this view).
In the dialogue window for Source Git Repository, fill in the url to the repository (you can copy the path from your GitHub.com account). Leave all other options with their defaults values (including empty).
Click the Branch Selection view. Make sure master is selected and again click .
button. This will take you to theThe next view is for Local Destination. Either accept the default or navigate and select your preferred destination path. The destination folder does not necessaily need to have the same name as the online repository (kt-gi-test01 in the example), but it is recommended. Click to continue.
When ready, click Git Repositories view.
and the GitHub remote repository should be cloned to your local machine. If it worked properly you should see the cloned repository in theImport GitHub project to Eclipse
Once imported, switch to the PyDev perspective. The perspectives available are in the upper right corner of the Eclipse window.
If the Python icon is not included among the predefined perspective icons, go via the menu system:
In the options window that opens, select PyDev and then clock
Managing GitHub submodules
You should now have Karttur´s GeoImagine Framework installed on your local machine, added with a cloned copy from Karttur’s GitHub repository. If your project sub-packages are missing or have no content, you have to run an update on the submodules.
Update submodules
The GitHub repo that holds the complete GeoImagine Framework is just an empty container with links to other repos that hold the actual codes (one repo per submodule or PyDev package). This is a special case, and requires that you update the submodules from inside Eclipse to clone the actual content of each submodule (and fill the packages with the actual code).
Switch perspective in Eclipse main window by clicking the Git icon in the upper right corner. If the icon for Git perspective is missing follow the same menu path as outlined above for switching to the PyDev perspective.
In the Git Repositories view, expand the project (i.e. click the filled arrow to the left of the project) to see the content (see figure below). You should then see the folder for Submodules. If you look inside a submodule, it is most probably empty. That is, as mentioned above, because the Framework repo is just an empty container that links to the repos with the actual code. To clone the complete content of the submodlues (i.e. the Python packages that build up the complete Framework), right click the Submodules and select Update Submodule from the pop-out menu.
It will take a while for the data to download, but then should have a complete copy, or clone, of the PyDev project repo from GitHub.com.
Karttur´s GeoImagine Framework
If you want to continue with Karttur’s GeoImagine Framework there are some additional steps required. As these steps are very specific they are covered in a separate blog on Karttur’s GeoImagine Framework. To continue directly from here in that blog, go to the post on prepare the database connection.
A note on editing the code
You can work with the cloned code and develop/improve it. But you can not push the changes back to the GitHub online repository (unless you have the login and password for Karttur´s GitHub pages). If you could, it would mean that the code of the master branches of the individual packages would change. All changes (updates) on the GeoImagine Framework is done using branches in each package repository, for which I have yet to write the instructions.