Configuring PyCharm to Work With Enthought Canopy and GitHub

Work Like Charm with PyCharm, Enthought Canopy and GitHub

Introduction

               This article raised from my own need to find an easy to use guide with all the information related to setting up a Python working environment using PyCharm, Enthought Canopy and GitHub at a single source.

               This article assumes that you know the theoretical aspects of version control and you want to put that knowledge to practical purpose using Git. This article is divided in to various parts. In the first part we will see how to install Enthought Canopy. We will go through the steps of installing PyCharm in the Second part. Finally we shall install GitHub and show how to use GitHub from within PyCharm.

               This entire set up is tested on Windows 7 Professional Edition. It should work on Windows 8/10 as well.

INSTALL ENTHOUGHT CANOPY

          We make use of Enthought Canopy, which provides a comprehensive Python analysis environment for easy installation of the core scientific analytic and scientific Python packages [1]. Download the latest Version of Enthought Canopy Express from https://store.enthought.com/downloads/

Step 1: Click on canopy-1.5.1-win-32.msi (Your version number may be different).

Step 2: Click Next on the Wizard

Step 3: Accept the License Agreement

Step 4: Click Next

Step 5: Click Install and wait for the installation to complete

Step 6: Click Finish and Launch Canopy

Step 7: When you launch Canopy for the first time, a screen with default path to install the Canopy environment will be displayed. Select the default directory.

Step 8: Select Yes radio button when asked whether you want to make Canopy your default Python Environment. Then click on Start Using Canopy button.

Step 9: Click on PyLab short cut seen on the desktop. You will see a set of messages appear on the console screen. (You should not skip this step)

Step 10: Then go to run ⇒ type cmd ⇒ type python on the console screen. Again you will see a set of messages.

INSTALL PyCharm

          PyCharm is the most popular Integrated Development Environment used for programming Python [2, 3]. It supports code analysis, graphical debugging, versioning, web development and various other features. Download the latest version of PyCharm Community Edition from https://www.jetbrains.com/pycharm/download/

If you have downloaded 32 bit version of Enthought Canopy then download 32 bit version of PyCharm. Do the same for 64 bit version.

Step 1: Click on pycharm-community-4.0.4.exe (Your version number may be different).

Step 2: Click Next to Continue

Step 3: Stick on with the default destination folder and click on Next

Step 4: Select both the options: Create Desktop shortcut and Create Associations. Then click Next

Step 5: Then click on Install and wait for the installation to complete

Step 6: When the installation is complete, Click Finish and Run the PyCharm Community Edition

Step 7: When you see the below screen, select the second radio button

1

Step 8: You will be asked for PyCharm Community Edition Initial Configuration. Accept the default Settings. Click on OK button.

Step 9: On the Quick Start pane, click on Configure Button (Below Screen shot)

2

Step 10: Click on Settings

3

Step 11: On the left pane click on Build, Execution, Deployment ⇒ Console ⇒ Python Console

Step 12: On the right pane click on Interpreter Options pull down menu. Select the first highlighted path and click on OK button.

4

INSTALL GitHub

GitHub is a popular web based Git repository hosting service. It provides both free and paid services. It’s the largest code host in the world. Download the latest version of GitHub for Windows from https://github.com/

Step 1: Go to httts://www.github.com and create an account. When asked to choose your personal plan, select free option and finish sign up.

Step 2: Download GitHub for windows and click on the exe file. Ensure you are connected to internet.

Step 3: Click on Install Button. Wait for some time for the installation to complete.

Step 4: Click on GitHub shortcut on desktop.

Step 5: On the Welcome screen give your Git registered User Name and Password and click on Log in.

Step 6: Give Git registered Name and Mail Id to configure your Git. At this stage leave all the default options as it is.

Step 7: Open your PyCharm editor (If it is already open, then close and open again). On the Welcome screen select Configure ⇒ Settings ⇒ Version Control ⇒ Git ⇒ Set the path to Git executable (below figure).

5

Step 8: Test the configuration and click on OK button.

The above steps ensure that you have full-fledged working Python environment with Git enabled from within PyCharm.

PyCharm + GitHub

Now Let us see how we can leverage GitHub from PyCharm. If PyCharm is already open, then close and open it again.

On the Quick Start pane, click on Create New Project ⇒ Give a Project Name. For demo purpose, we have created a project called PythonPrograms. You will be taken to a new screen. On the left pane you will see your project name.

Right Click on the project name and select New ⇒ Python File. Give appropriate file name. Let’s say we have given the file name as HelloWorld. Once you click on OK button, you can see the file name with .py extension on the left pane.

Type the following line:

print “Hello World”

On the menu bar click on Run ⇒ Run

You will see the output in the bottom pane.

On the menu bar, go to VCS ⇒ Import into Version Control ⇒ Create Git Repository ⇒ Click on OK button (The directory where the Git Repository needs to be created is selected by default). This creates local Git repository on your system.

Now again go to menu bar. Click on VCS ⇒ Import into Version Control ⇒ Share Project on GitHub.

You will be asked for Login and Password. Supply your GitHub registered Login and Password and click on Login button.

After this stage, you will be asked to Setup Master Password. It is highly recommended that you enter a password. You need to remember this password. Setting up of this Master Password happens once. On subsequent creation and upload of other projects to GitHub, you will be prompted to enter this master password.

Enter the Repository Name and give a description of your Project.

In the next window (Add Files for Initial Commit Window), write a comment under Commit Message section and press on OK button (Leave all the Checked files as it is).

Now Log in to your GitHub account using your favorite browser. You will be able to see the project which you have uploaded.

6

Let’s add a new line to our source code. Add the following line under existing line.

print “I have done a change”

On the right pane, Right Click on the Python source file ⇒ Select Git ⇒ Commit File ⇒ Write a message under Commit Message section in the Commit Changes Window ⇒ Click on Commit button.

Again on the right pane, Right Click on the Python source file ⇒ Select Git ⇒ Repository ⇒ Push ⇒ Click on Push button on the window which appears.

In your browser, you will be able to see the changes in the repository.

7

We have just scratched the surface. In the next article we will see how to clone repositories, create Git branches, merge those branches and other advanced Git concepts.

References:

[1] https://www.enthought.com/products/canopy/

[2] https://www.jetbrains.com/pycharm/

[3] http://en.wikipedia.org/wiki/PyCharm

[4] https://github.com/

Leave a Reply

Your email address will not be published. Required fields are marked *