virtual environment for developing Ableton Live Midi Remote scripts in PyCharm


I'm an experienced Java/Groovy developer, employed as such even.  But I'm brand new to Python.  My sole motivation for diving in now is customizing midi controller scripts for Ableton Live. 

I'm trying to set up a "virtual environment" in PyCharm to support my Ableton Live Midi Remote Script scripting project(s), but I've hit a wall and need help.  I'm not sure which section of my vast supply of ignorance is responsible.

The only instructions I have are in a file buried deep in the Ableton Live folder structure.  Of course, the instructions make project setup seem easy as 1, 2, 3.

* Working on abl.webconnector

 - create and activate a virtualenv (e.g. with virtualenvmanager)
 - install in the virtualenv the Python site-packages that we ship with Live:

#+begin_src bash
$ find $LIVE_REPO_ROOT/modules/python/site-packages/ -type d -name *.egg -not -name setuptools* -exec easy_install {} \;

 - install requirements for development:

#+begin_src bash
$ pip install -r dev_requirements.txt

 - run nosetests:

#+begin_src bash
$ cd $LIVE_REPO_ROOT/products/live/Live/AppWebConnector/Python/abl.webconnector/
$ nosetests -s  --with-progressive --logging-clear-handlers tests

Unfortunately, I suspect these are instructions for programmers with access to the full git repo at Ableton for the Live product, rather than instructions for users like me.  For example, the path to site-packages is different in my installation.  I probably could have scripted something to mimic the 'find' command. But I ended up creating Run/Debug configurations to run that "easy_install" for each of the "*.egg" folders not named "setuptools*" in that directory.  After that I ran the 'pip install dev_requirements.txt' command in my PyCharm console (git-bash).  After that I ran the nosetests in my PyCharm console.  I made several minor changes before all tests passed.  The changes were:

# * removed --with-progressive arg (didn't exist)
# * installed a module named 'mock'
# * edited line 33/34 to the correct (local) path
# * added file to tests/data/  (copy of and compiled it to foo_py25_mac.pyc
# * -- error was at line 115 because foo_py25_mac.pyc wasn't in tests/data/ like and

However, even though all 124 tests are passing in the console, it seems something is still not right in the project environment.  I can see the "eggs" listed in the "virtual environment" but sys.path in the python console doesn't also show any of those "egg resources"; and, when I open code files, import statements that reference any of those specific "Ableton Live" components are flagged as errors. (things like import Live, or import MidiRemoteScript)

It feels like I am so close yet so far away.  My question here is, can anyone tell from this description whether or not my problem at this point is my ignorance of Pycharm and Python in general, or if its ignorance of the Ableton python API and how it works?  If it's a Python/PyCharm issue, what is the issue and how do I fix them? lol


Please sign in to leave a comment.