GX Developer for Python
Frequently Asked Questions
Python version 2.7 or 3? The Geosoft distribution packages support Python version 3.5 (and later).  Python 2.7 (released in 2010) was the end of development for Python 2.x, and for this reason we have chosen not to support Python 2.7 (or earlier). If you are new to Python, you should start with Python 3.  If you have legacy Python 2 code that you want to run with a Geosoft environment you may need to make modifications to the code to work with Python 3. See https://docs.python.org/2/howto/pyporting.html for information on what may be required to port Python 2 code to Python 3.
Which Python distribution? There are many distributions of Python, but Geosoft uses and recommends the Anaconda distribution (https://www.continuum.io/downloads) as this includes all the packages that are required to work with Geosoft code together with the most important and widely used packages that make up what is considered complete for a scientific application.Â
Which IDE? At Geosoft we use and recommend the PyCharm IDE (http://www.jetbrains.com/pycharm/), which has both a no-cost "Community Edition" intended for education and personal use, and a very reasonably priced "Professional Edition" for professional use. Note that most complete Python distributions also include IPython. Although not strictly an IDE, IPython does provide an environment for rapid algorithm development, experimentation and documentation and can be very effective for research projects.
Modifying the Geosoft Python Modules
As a developer with advanced Python knowledge and familiarity with git and github you may wish to clone (or fork) and modify Geosoft's Python modules. The following describes the development process for modifying your own cloned version of the Geosoft package. Refer to Python Installation and Configuration for simply installing and using the Geosoft packages.
Geosoft maintains the source code for the most current Python module on github:
Repository | Description |
---|---|
https://github.com/GeosoftInc/gxpy | Geosoft gxpy module for Python. This includes both the complete GX API for Python (geosoft.gxapi ) and a "pythonic" interface (geosoft.gxpy ) to the main GX API functions names "gxpy". Over time, we expect geosoft.gxpy  to expand to wrap more of the full geosoft.gxapi  into a simpler and more python-oriented interface. |
You should clone (or fork) the repositories to a location on your system (step 1 below).  If you are unfamiliar with github, see https://help.github.com/.
The following will checkout the gxpy project from Github and set it up for active development with your Python distribution:
Step | What | Comments | ||
---|---|---|---|---|
1 | Clone the Geosoft Python repositories | Open a command shell and go the folder where you want to locate the Geosoft Python files. From here we will clone the Geosoft repositories, which will create sub-folders "gxpy" and "gxpy-examples". These are on the current development branch and stability is not assured, and may depend on a later desktop installation than in available.
If you want a specific stable branch, after cloning the repository checkout the desired branch:
| ||
2 | Setup module for development in your Python environment: |
Note:Â The "develop" option links to the files where you cloned the repository instead of installing it in <PYTHON_HOME>\Lib\packages. This allows a debugger to step into your gxpy repository files rather than those in the Python site-packages directory. |