Software Setup - CP1404/Starter GitHub Wiki

Software Setup

CP1401/5639 - Programming 1

Students in CP1401 ONLY need Python 3 and PyCharm:

  1. Download and install Python 3 ​from: https://www.python.org/downloads/
    (Windows) Choose the option ​Add Python to PATH​ when you install.

  2. Install PyCharm

  • Download and install PyCharm. You do not need the Pro subscription.
  1. That's it. You do not need to install Kivy or Git.

CP1404 - Programming 2

Students in Programming 2 need the following installed:

  • Python (3.9+)
  • PyCharm
  • Kivy (2.0+) - note that Kivy < 2.0 is not compatible with Python > 3.7
  • Git

Each of these tools have their own instructions available online, but this guide is an attempt to compile all of the basic details you require in one place.
Things change and your system might be different, and sometimes you'll find a different/better way is needed.

GitHub:

If you do not have one already, create a GitHub account.
Go to https://github.com and sign up with your JCU email address. Be sure to use a username that easily identifies you.

Note: GitHub do not accept our my.jcu.edu.au addresses as student proof because non-student alumni also have these addresses.
So, in the following step, please choose the option that lets you upload proof, and upload a photo of your current student ID card with the date on it.

Go to https://education.github.com/discount_requests/new and enter your details so you can get free private repositories and your GitHub 'pack' with a bunch of free bonuses: http://education.github.com/pack

Git:

Download and install git from https://git-scm.com/download
There are a number of options for things like git-bash and what console you want to use... All of the defaults should be fine.

Python:

Download and install Python 3 ​from: https://www.python.org/downloads/
Choose the option ​Add Python to PATH​ when you install.
The Windows default location can be hard to find, so I recommend changing this to something more obvious and memorable like C:\Python. Choose to customise your installation:

Choose to customise your Python installation and add to PATH Choose a simple folder location for your Python installation

PyCharm:

After you have installed Python...

If you would like the Pro subscription for JetBrains software:
At last check, JetBrains doesn't accept my.jcu.edu.au addresses as proof of student status, so you will probably need to provide official documentation, not just your email address.

PyCharm Project & Configuration

[!NOTE]
Your version of PyCharm may look different from our images and instructions below, but hopefully they are close enough for you to follow.

A PyCharm project is a folder on the computer that contains Python source code files and related resource files to make your program run... but it's more than that.
Always do your coding in files that are part of a project - NOT just individual files you open.

To make a new PyCharm project, click on Create New Project (not notebook) and choose Pure Python.
PyCharm lets you choose where to store your new project and what interpreter to use.

  • the location can be changed to any place you have access to. Use a folder that you will be able to find later

  • the interpreter is the version of Python used to run our code.
    Select "Custom environment" and "Select existing" for Python 3.

New project window - select existing interpreter

To add a source code file to the project:
Right-click on the project name and select
New > Python File
New file

To run a program, right-click in the code editor window and select the run option.
Run Program

If you see an underline, move your mouse over it (but don't click!) to see what the issue is, and look at the action PyCharm suggests to fix it for you. Example:
Highlight suggestion in PyCharm

If you don't see underlines for formatting warnings, change the following setting:
File (or PyCharm on Mac) > Settings > Editor > Inspections
Search for "PEP" and select "PEP 8 Coding Style Violation" then change the severity to "Weak Warning" as in this screenshot: Inspections settings in PyCharm

[!WARNING] We love being productive, and we don't want you to waste time, BUT...
We're not just trying to get through this work as quickly as possible. What we really want is to learn.
With this in mind, we are purposely choosing NOT to use AI in this subject at all.
So, turn off PyCharm's very handy AI full line completion now.

Open the settings:
File (or PyCharm on Mac) > Settings > Editor > General > Inline Completion
Untick "Enable local Full Line completion suggestions"

PyCharm Full Line completion settings

Kivy:

Kivy is a Python package, and you can install it and any other packages via PyCharm.

[!IMPORTANT] You must use the same interpreter for your projects as you install packages in. If you know what you're doing using a Virtual Environment, or are keen to learn, then you are welcome to use one.
If you always use the existing system interpreter instead of a virtualenv, you may find this easier.

With a PyCharm project open, you can install the Kivy package as you would any Python package via PyCharm:

  • Windows: File > Settings > Python > Interpreter
    Mac: PyCharm > Settings > Python > Interpreter)
  • Click the + button to install
  • Search for "Kivy" and click Install Package

Install Kivy package in the Settings window

Add KV language auto-completion and syntax highlighting. This is needed because PyCharm does not know about KV language by default:

Test Your Setup

To test it's all working, create a PyCharm project (if you haven't already), making sure to select the interpreter where you installed Kivy.

Create a new Python file, and enter the code from https://github.com/CP1404/Starter/blob/master/check_setup.py (or download this file to your project folder.
Run it by right-clicking in the code window and choosing "Run..."
If it works, you should see a nice big hello world button.
Celebrate!

You can also test your Git & GitHub setup by using PyCharm to clone a repository and run the code:
Select VCS > Get from Version Control > GitHub
Then login with your GitHub credentials. Enter our starter repo URL: https://github.com/CP1404/Starter in the prompt, clone it to a new folder and open this as a new project.

If you need help, please ask.

Advanced

If you get an error like the following when using pylint with Kivy code:

Kivy: Instance of 'Button' has no 'bind' member

This means that pylint is not able to find the bind method because it comes from cython code.
Set pylint configuration to check this code. See Stack Overflow Q&A

If you don't have a .pylintrc file, create one with the terminal command:

pylint --generate-rcfile > ~/.pylintrc

Edit the file, find the line with 'whitelist', and change it to:

extension-pkg-whitelist=kivy