Note: Recent versions of (either/both) Pycharm & Kivy (Pycharm 3.0 & Kivy 1.8.0 at least) have changed so that /usr/local/bin/kivy, which is (now?) a shell script that executes your default python, can not be used as a python interpreter within Pycharm
If you're a Mac-based Pycharm python developer, it may see like you can't use it to develop using the Kivy framework, due to there being no official support -- but setting up Pycharm as a Kivy IDE is very easy, once you realize that
/usr/local/bin/kivy ~= /usr/bin/python
Ok, let's do this!
After installing Kivy.app on your mac:
1. Preferences > Project Interpreter > Python Interpreters
Create a virtualenv. I couldn't figure out how to make it directly, so I made on from 2.7.1 and then edited it. I tried navigating to /usr/local/bin/kivy when I needed to choose the interpreter, but it didn't work.
Edit Python Interpreter
Interpreter Path: /usr/local/bin/kivy
It doesn't really matter what you name it. It just matters that you know which virtualenv is where.
Kivy is already its own virtualenv/custom python distribution (type the kivy cmd in a terminal, it's a python shell), so pycharm needs to look at
/usr/local/bin/kivy instead of
/Library/Frameworks/Python.framework/Versions/Current/bin/python (or whatever) for code inspections, libraries, eggs, etc.
Note that you must have run the make-symlinks script that came with the Kivy.app installer for this to work. If you didn't/can't run make-symlinks, try changing the path to kivy to
2. Make sure Kivy is your project interpreter
After you create the kivy interpreter, set it as your kivy project interpreter in Preferences > Project Interpreter.
Apply and Ok, and confirm that the skeletons generate (or at least mostly, I had some errors) and that your project looks a bit like this:
Note that my python system library is horribly polluted, so if yours is clean it will look different.
3. Add .kv support
You can save the below XML file to this directory: ~/Library/Preferences/PyCharm20/filetypes/
<?xml version="1.0" encoding="UTF-8"?> <filetype binary="false" default_extension="" description="Kivy " name="Kivy Files"> <highlighting> <options> <option name="LINE_COMMENT" value="#" /> <option name="COMMENT_START" value="" /> <option name="COMMENT_END" value="" /> <option name="HEX_PREFIX" value="" /> <option name="NUM_POSTFIXES" value="" /> <option name="HAS_BRACES" value="true" /> <option name="HAS_BRACKETS" value="true" /> <option name="HAS_PARENS" value="true" /> <option name="HAS_STRING_ESCAPES" value="true" /> </options> <keywords keywords="@;Canvas;Label;Rectangle;app;canvas;root;self" ignore_case="false" /> <keywords2 keywords="center_x;center_y;font_size;id;pos;size;source;text;top" /> <keywords3 keywords="on_press" /> <keywords4 keywords="*args;ctx" /> </highlighting> <extensionMap> <mapping ext="kv" /> </extensionMap> </filetype>
I made it pretty quickly, it's missing a lot but at least it will color a lot of the main words. Feel free to improve it and re-share.
4. Add a Run Config
Make a run config like normal, just make sure the Kivy interpter is selected so that pycharm will use /usr/local/bin/kivy instead of your standard python (/usr/bin/python or whatever)