- Make your diagram in Medelio
- From the model explorer, right click and select XMI --> export
- Browse to a location outside of your workspace and save it with the EMF UML 3.0.0, but unclick adding Modelio notations please! Also save it with the *.uml extension instead *.xmi.
- Now start eclipse and show the Papyrus perspective.
- if you already have a project, that's fine, just start a new Papyrus model.
- Create a folder in your project called XMI and import the files you exported from Modelio - there should be 2 of them, a profile and your model.
- Double click the model that you just created (e.g. model.di) and it should open in the main window, and hopefully you will see it in the model explorer too.
- Right click and select import, then import package from user model.
- In the window that opens, select your profile and model packages, and then import all. I'm not 100% positive that you need to import the profile, but it doesn't hurt, and I had issues when I tried to just copy the model components from the Modelio UML model to Papyrus.
- Ta-daa, you should now see two packages in your model explorer one is the default profile and the other is your Modelio model.
- Now at the top level model, create a class diagram (or any of the 9 UML diagrams). This is the most important step!
- Drag and drop the first class into the diagram window.
- Expand that class in the model explorer and select the class attributes and drag and drop them into the first section of the class below the title.
- Repeat for the operations, but drop them into the second box.
- Drag over any associations.
- You may need to remove and re-add any stereotypes as for some reason they were not showing up in the diagram.
Thursday, August 1, 2013
importing UML models from Modelio to Papyrus
Tuesday, April 16, 2013
JGit & MATLAB Matrimony
I have written a ridiculous wrapper to use JGit in MATLAB that you can clone from Github or download from the MATLAB Central File Exchange. Try my wrapper, but then either contribute or branch out and just use the JGit package. It is surprisingly easy.
NOTE: Did I mention that you do not need to install anything! JGit is your Git client. JGit is not a wrapper for C/C++/Perl scripts. It is a pure Java implementation of Git. That really makes this the one of the easiest way to use Git if you are also using MATLAB.
Enjoy!
Wednesday, January 16, 2013
Django, PyDev, Virtualenv Setup
Django integration in PyDev for eclipse is sweet, and contrary to what my previous post here said, it is not tricky. Although there must have been some reason I made this post right? The only gotcha for me, is that in addition to selecting your virtualenv as the Python interpreter, you must also select the standard Python lib folder so that threading.py and a few other packages that PyDev uses will be available. Luckily, PyDev gives you a nice warning message when you select a virtualenv that says exactly that.
Now selecting this folder should be straightforward but no real guidance is given because each system is a little different. For example on Ubuntu and system installed Python you would add the /usr/lib/python/ while on Windows using the official Python Windows installer, you would use C:\Python27\lib\. And of course you could use any local version of Python that you built yourself, where ever that might be. The easiest way to locate the correct folder is to find the standard Python libraries, threading.py in particular since PyDev specifically mentions it.
Now originally I also had posted an issue with django-admin.py being confused between the system installed version and the version in a virtualenv, but I have not seen that issue with the latest version of PyDev, and I am also using the global site packages in the virtualenv, which also has a different version of Django than the base install. So ... ?
To sum up, assuming you already have eclipse with PyDev installed:
- Install virtualenvwrapper: pip install virtualenvwrapper. This will also install the latest version of virtualenv.
- Make your virtualenv: mkvirtualenv myDjangoProject. This will also switch on your virtualenv.
- Install django in your virtuenv: pip install django. Also install anything else you want, and/or use toggleglobalsitepackages to turn on/off sitepackages.
- In eclipse under the Window menu option select preferences and then from the list of preference settings on the right, select PyDev > Interpreter - Python. Now in the Python Interpreters window, click New, type in a name, then browse to ~/.virtualenv/myDjangoProject/bin/python or %USERPROFILE%\.virtualenvs\be\Scripts\python.exe on Windows, click the open button then OK.
- Generally I don't alter or add any folders or built-ins at this next step; I just accept what PyDev tells me I need. However, as discussed above, when using a virtualenv, the standard python library folder must also be added, so do it now. Check the box for either /usr/lib/python/ or C:\Python27\lib depending on your system. If successful, you should be returned to the Python Interpreters window, and you should see your new interpreter listed with the default one. Voila.
Wednesday, November 28, 2012
Eclipse in ubuntu
With Oneiric and Precise I had successfully used both Ubuntu and eclipse repositories, but with each upgrade there were always snafus; I would have to re-install some plugin and end up losing my workspace settings. Playing the repo shuffle, you never know when Ubuntu might suddenly decide to revoke or add a package, and there are so many eclipse plugins it just makes sense to me to let one system manage the dependencies. Reading up a bit here and there I began to realize that this is an issue eclipse and Linux users have addressed and that eclipse would work out of the box on Ubuntu.
So the first thing I did was completely remove eclipse from my system. I had some false starts, first off Synaptic may be a great tool but it does not remove certain dependencies the same way as the Ubuntu Software Center (USC). Same goes for `apt-get`. Too bad because using USC is slow and tedious because you can only install/remove one package at a time. But unless you want to leave a lot of detritus on disk USC does a better job at killing off orphans. That made me realize another reason for installing eclipse as add-on software, since using the Ubuntu repo installed over 100 packages! I'm trying to keep my machine uncluttered and organized so that's just ridiculous.
I did a few things different than the vast number of sites posting instructions.
- I created a folder called "/opt" in my home directory and untarrred my eclipse download there. I chose the Java EE version for 32-bit Linux because it has the most complete selection of useful plugin preinstalled. I decided on ~/opt instead of /opt because I'm the only user and I didn't want to deal with ownership and permissions. This is a nice compromise that doesn't clutter your system. However, in general I would recommend copying the entire package to /opt and changing ownership to root:root.
- I created a soft symlink to ../opt/eclipse/eclipse called "eclipse" in ~/bin. This folder is already present and is always first on your path. If I had moved eclipse to /opt, then it would be available to all users, and then each user could create a symlink from there to their private ~/bin folder. I didn't have to change the permissions, because it's already 777.
- This next step is the major difference between what I did and what I've seen posted everywhere. I created a desktop file in ~/.local/share/applicatons called "eclipse.desktop" with the following. I looked into both gnome-panel and alacarte (ne main menu), but I ruled them out because the desktop file is so easy to create, and both of these tools are for true gnome desktops not Unity, and also seemed outdated. There is ample help on putting applications in the desktop. A couple of notes: ~ is not expanded, so use your complete path, X-Ayatana is the name of the Unity group, if you want to add extra commands and I had to export the eclipse xpm icon as a png file because it didn't work in the Unity dash.
[Desktop Entry]
Version=1.0
Name=Eclipse
GenericName=IDE
Exec=/home/marko/bin/eclipse
Terminal=false
Icon=/home/marko/opt/eclipse/icon.png
Type=Application
Categories=Development;IDE - I started eclipse from the dash and pinned it to the launcher. Then followed the customary procedures to update and install packages from within eclpse. From the menu select help > check for updates, and then help > install new software. Note: I have started help using the internal browser (default) and it works fine. My system already has both libwebkitgtk-1.0.0 and libwebkitgtk-3.0.0 so I didn't have to install or remove anything; eclipse help just worked out of the box. I have read numerous reports regarding this issue (eclipse crashes when help window opened), so evidently it has been solved.
Monday, November 26, 2012
Install Add On Software and Create GTK+ Desktop File
Linux actually has a protocol for installing software add-ons, if you decide that what's in your distro's repository is not enough for you. There are a few options.
- Find a PPA (Personal Package Archives for Ubuntu), add it and then install the package with apt-get. This will most likely install the package in /usr/, /usr/bin/, /usr/lib/, ... and take care of configuration and creating a desktop file so that you the application will appear in the unity dash (on Ubuntu) and you can add it to the launcher or launch files from Nautilus. This works for Sublime Text 2. PPA's are often listed on Launchpad.
- Build the code from source using autotools and it should install in /usr/local/, /usr/local/bin/, /usr/local/lib/, /usr/local/include/, ... but of course you will need to make sure that the application's dependencies are all satisfied and do not conflict with your distro. This can be a tough row to hoe.
- Find a pre-compiled package and drop it into your system's /opt directory, which is designated specifically for add-on software not provided by the system's package repositories. An alternative often used and actually my preference is to extract the new package into your home directory. This works, but to avoid cluttering $HOME I add a folder called ~/opt and drop the add-ons in there. Again, it is up to you to make sure that the software's dependencies are satisfied. For example, eclipse requires some jdk, whether it is from Oracle or the openJDK project, and it will need to be a version within the range specified by the add-on software, e.g. jdk >= 7.0 in the case of eclipse.
- The easiest thing to do is to run the application from the console, and don't integrate it into your desktop (Gnome) or file system browser (Nautilus), by opening a terminal window and typing ./<executable>. You may need to change the permissions first by using sudo chmod 755 <executable>.
- Another option that doesn't require you to edit your desktop files is to add the folder to your path, however, this may cause problems if there are filename conflicts, e.g. your system already has a libz.a but your new software does too. One safe way to deal with this is to add the new directory to the end of your path, or create a special shell for it. This way your default system files will always be used.
- Create a symlink to /home/<username>/bin/ which is always first on your path. This is my preferred method for several reasons. First it will survive an update because your personal profile is not altered during upgrades. Second, it only affects you, and not other users if you share your machine. Of course if your intent is to make the application usable for all users, then either you need to add it to all profiles or make a symlink to /usr/bin/. However, links in /usr/bin/ will probably not survive an upgrade because this is system file territory
- Create a gtk desktop file in /home/<username>/.local/share/applications/, as described in Desktop files: putting your application in the desktop menus, which again is my preferred method. I wrote a post on eclipse in Ubuntu that has an example of a desktop file. The reasons are the same as above. First it survives an upgrade and second it only affects you. You can customize the desktop file to have as many actions as you want, for example to have an option to open a new window by right clicking directly from the launcher icon, or to list all of your current eclipse profiles so that you can launch them directly. The desktop file is very flexible. You should now be able to find your application in the Unity dash (on Ubuntu) and once it runs you can lock it to the launcher. Also if you add the %f option after the location of the executable in the desktop file, then it will be available to Nautilus as well. Then you can right click and see other applications that can open a file associated with your new application. See this Ask Ubuntu answer on how to install the Sublime Text 2 editor. A lot of people have recommended editing the system wide desktop files, which are in /usr/share/applications/ but I don't recommend this as it will not survive an upgrade.
Monday, August 20, 2012
Python Primer
[UPDATED 2016-08-04] add links to online training and references under learning curve
[UPDATED 2015-07-10] add links to Carl Kleffner's Anaconda/Binstar Repo
[UPDATED 2015-05-18] add Mac OSX section and
site.USER_BASE
usage[UPDATED 2015-04-04] add tl;dr for Python-2.7.9-x64_scidata.zip
[UPDATED 2015-04-04] pip and setuptools are part of official Python since 2.7.9.
[UPDATED 2014-04-18] add anaconda distro
[UPDATED 2013-08-01] Setuptools has been updated and has merged with Distribute.
[UPDATED 2013-04-18] I've added some better tutorial resources and the new Enthough Canopy distribution. I also removed the link URLs, sine they are embedded in the text, and rearranged the heading styles, since they were unreadable (yuk!). Also I couldn't resist linking xkcd antigravity post.

TL;DR
Can't be bothered? For any platform (Windows, Mac OSX and Linux) just download and install Anaconda Python by Continuum IO. No admin rights required! Start by opening the Anaconda Launcher to start Spyder a full featured editor. Anaconda already includes most of the packages you'll need for science, engineering, math and data analysis. That's it. Enjoy!
Getting Started
I put this together for my coworkers, but it could be applicable to anyone. Python is really easy to learn. Got Mac OSX? Then you already have Python-2.7.6. Got Windows? Just download the installer for your system. Some people prefer to install a Python distribution, which has stable versions of the most popular Python packages bundled together in a single installer, often together with a package manager and an interactive development environment (IDE). Official Python, Continuum Analytics Anaconda, WinPython, Enthought Canopy and ActivePython Community Edition offer installers for both 32-bit and 64-bit versions of Python on Windows and Macintosh. If you have a 32-bit computer you must use the 32-bit version, however, if you have a 64-bit version, you can use either. Using a 64-bit version allows you to access more than 2GB of RAM, but you may encounter some hurdles building packages that include extensions. The distributions have already compiled the packages for your version, but if you go with the official Python, then you will probably find yourself at Cristoph Gohlke's website. Mac OSX actually already has Python 2.X built in. IMHO do not install official Python on a Mac. Either use the Python version already installed or use Homebrew to install the desired version.
Python 2 or 3?
Only download 2.7.x, not 3.2.x, since no one uses Python 3 yet. Everything is Python 2. Some exaggeration here, but you get the point.
Python-2.7 will not be maintained past 2020. Please follow Kenneth Reitz's recommendations and use Python-3.6 for all new code.
Windows x64
Using a 64-bit version of Python will let you access more than 2GB of data which may be necessary for many large scientific or engineering analyses. Many packages are distributed for Windows-x64 as "wheels", but for those that are not, you can find them on Christoph Gohlke’s Python extensions page. Package distributions for Windows x64 often are marked as win_amd64. If a package is not distributed as wheel anywhere, then, in order for pip to build any C/C++ extensions in the package from source, you will need to install the Microsoft Visual C++ Compiler for Python-2.7, which is free and does not require administrative rights. See the sections on installing packages using pip and wheels below for more information.
The exception to this rule are packages like NumPy and SciPy that require compiling FORTRAN libraries like BLAS and LAPACK. These libraries are part of the Intel Math Kernel Library (MKL) which is what Professor Gohlke uses, however there are several open source versions such as OpenBLAS, GotoBLAS and ATLAS. Unfortunately, you will not be able to install/compile these packages from source using pip and MS VC compilers for Python-2.7. You must use binary wheels from either Professor Gohlke's Python Extensions website or you can get the from Carl Kleffner's Anaconda/Binstar PyPI Repo or his BitBucket downloads.
Mac OSX
Mac OSX already has Python-2.X installed. Mavericks and Yosemite both have Python-2.7, whereas older versions like Snow Leopard and Lion have Python-2.6. Mac OSX Python also has NumPy and Scipy already installed as well, although it might be quite old. Luckily, there is considerable support for Mac. For example there are precompiled NumPy wheels on PyPI and precompiled SciPy wheels as well. Mac OSX Python sets site.USER_BASE
to ~/Library/Python/2.X
a folder owned by you in your own profile, which allows you to install modules and packages without sudo
using the --user
scheme. First install pip from PyPI and add it to your path by running the following from a terminal ...
~ $ cd Downloads # into Downloads folder ~/Downloads $ curl -Ok https://pypi.python.org/packages/source/p/pip/pip-6.1.1.tar.gz # download pip package ~/Downloads $ python setup.py install --user # install into site.USER_BASE/lib/python/site-packages ~/Downloads $ cd # back to $HOME ~/ $ echo "# add PYTHONUSERBASE to path" >> .bash_profile ~/ $ echo 'export PATH=~/Library/Python/2.7/bin:${PATH}' >> .bash_profile # use single quotes to delay variable expansion
... now test pip by opening a new terminal and using pip to update setuptools ...
~/Downloads $ pip install --user -U setuptools #
... so that packages can be installed into your local Python library with pip using the --user
option as well. You don't need to add it to your PYTHONPATH
, Python adds PYTHONUSERBASE
by default. You will probably need to use Homebrew to install Qt, but for everything else pip will work fine. You will need to get XCode from Apple Developer Program to compile extensions. It should be free. Finally mark my words: Beware of sudo
!. Don't ever use it on Mac OSX.
Learning Curve
Start by going through the official tutorial. It has some boring parts but it gets to the meat pretty quick. After that you will probably find yourself consulting the standard reference library often. Also Google has a great Python reference site. There are several super fun interactive sites like Philip Guo's python tutor and the ever popular Code Academy. For a more comprehensive treatment, there are two great online books: The first is Learning Python the Hard Way and the other is Kenneth Reitz's Python Guide. SciPy has a NumPy for MATLAB users primer in their wiki. For scientific computing, you can view/download the entire Primer on Scientific Programming with Python by Hans Petter Langtangen. Rockstar Fredrik Lundh provides great tips on eff-bot. Another rockstar Doug Hellman is also a resource. There are also about a million blogs on Python.
Here's a list of links to mostly free online Python tutorials in no particular order:
- codeacademy learn Python
- Google's Python Class
- Enthought Python Foundations
- Coursera Python for Everyone
- Continuum online training
- Python tutor
- Official Python Tutorial
- Official Python Standard Library
- Learn Python the Hard Way
- The Hitchhiker’s Guide to Python! by Kenneth Reitz
- Numpy for Matlab users
- Primer on Scientific Programming with Python by Hans Petter Langtangen
- Python Module of the Week
- (the eff-bot guide to) The Standard Python Library
- Writing Idiomatic Python
- Code Like a Pythonista: Idiomatic Python
Getting Set Up
There are individual references for each Python packages (what Python toolboxes are called). You can find links to the references and download the packages from PyPI (aka "the Cheese Shop") or from their individual sites, often on SourceForge.net or Github. Note that pip will automatically download packages from the Cheese Shop first unless you specify a file. The key packages you must have to get started are in the following sections.
Update Setuptools and Pip
Use pip from a command prompt to install new packages. Since Python-2.7.9, pip and setuptools, a dependency, are bundled with official Python but you need to update them to the newest versions.
- Install Python first and make sure you select the option to add
python.exe
and the Scripts folder to your PATH environment variable. - Open a Windows Command Prompt and type
pip install -U setuptools
to update setuptools to the latest version. - To update pip on Windows you must use
python.exe -m pip install -U pip
. If you try to update pip using the script it will fail due because you will be denied access to the pip script itself since windows will be using it.
installing packages
There are some interesting, perhaps updated sections on Installing Python Modules in the official Python docs. Most modules are pure Python and can be simply installed using pip like this:
user@computer ~ $ pip install wheel
Usually pip finds the package at the Cheese Shop, downloads the package and its dependencies, and then installs them for you. If there are any issues, pip is nice enough to roll everything back, so using pip is the safest way to install packages. Setuptools also manages packages with the easy_install
command, but I really don't recommend using it because it isn't nearly as nice as pip. Some packages are distributed as "wheels" because they have platform dependent binaries. You can also install these using pip after downloading the wheel. EG: Say you download NumPy-MKL from UC Irvine Professor Christoph Gohlke Python Extension Packages website; use the following to install it.
user@computer ~/downloads $ pip install numpy‑1.9.2+mkl‑cp27‑none‑win_amd64.whl
Many packages are simply distributed as a tarball or zip-file; pip installs these too, exactly the same way it installs wheels, although you may need the Microsoft Visual C++ Compiler for Python-2.7 for Windows or XCode for Macintosh if the source has any C/C++ extensions, which will be automatically compiled by pip. Very rarely you may need to edit setup configuration to point to shared libraries, which is well beyond the scope of this primer.
Wheels & eggs
Binary distributions of packages can be distributed as "wheels", "eggs" and Windows installers. You can install a wheel using pip, eggs can be installed using easy_install and just double click a Windows installer. Wheels although the newest type of package distribution, are definitely the preferred method. You don't have to install the wheel package to use wheels, but the wheel package can convert other distributions to wheels so it might be useful.
user@computer ~ $ pip install wheel
EG: Say you download pywin32-219.win-amd64-py2.7.exe from SourceForge then you can convert it to a wheel like this.
user@computer ~/downloads $ wheel convert pywin32-219.win-amd64-py2.7.exe
Numpy/Scipy
Mathematics and scientific libraries essential for numerical computing, engineering analysis and mathematics and scientific research. As discussed in the Windows x64 section these packages use FORTRAN libraries and therefore can't be compiled by MS VC Compilers for Python-27, therefore you must install binaries, either wheels or bdist_wininst
distributions. Download individual binary installers from sourceforge for Windows (x86) and Mac OS X. For Windows (x64) download Numpy MKL on Christoph Gohlke's site and Scipy on Christoph Gohlke's site or from Carl Kleffner's Anaconda/Binstar PyPI repo.
pandas
Statistics and data analysis. Think Excel or R. Downloads for all platforms.
matplotlib
Matplotlib is a plotting library that makes beautiful graphics and will be very familiar to MATLAB users. There are downloads for Windows (x86), Windows (x64) and Mac OS.
IPython
Ipython is about as slick as an interpreter gets, with color coding, tab completion and lots of magic. It also can create notebooks using tornado, work in a terminal or a custom Qt shell. It requires Setuptools, PyZMQ, PyQt and Tornado, and on Windows also requires Pyreadline and PyWin32). Download installers from Github for Windows (x86), Windows (x64) and Mac OS X.
Dependencies:- Pyreadline (only Windows) is available from the Cheese Shop
- PyWin32 (only Windows) is available from Sourceforge.net
- Download PyQt4 from their website. Binary installers are available for all platforms.
- PyZMQ is installed using wheels via pip. See the section below on pip and then use it to install wheels. There are installation directions on the ZMQ website. Alternately install the Windows SDK7 for Windows 7 and build PyZMQ from source. It is also available (as are many of these packages) from Christoph Gohlke's website.
Python Distributions
Also if you can’t be bothered to hunt down and install these separately, the you can install a distro. There are several major ones; here are the scientific/engineering/math ones. They vary in size, packages included, and level of customization. I don’t particularly recommend them, although the convenience may get you over the initial barrier to getting started, Python is so easy to use and learn that you will quickly be hampered by the limits imposed by the distros. Also you may find the user experience burdensome EG: having to start a launcher to access your Python apps will quickly become annoying. Also there may be bugs with user supported software that may not be quickly addressed because the smaller community is just a subset of the much larger Python community that address issues in the most frequently used Python source. In particular I have found Python (x,y) to particularly buggy. Finally, any proprietary software limited to a distribution may be a limit to deployment to other user akin to trying to deploy a MATLAB app. You have been warned.
- EPD free is now Canopy
- Anaconda by Continuum Analytics and its lightweight sister miniconda
- Python (x,y)
- ActiveState Community Edition
- Sage
- Pyzo
- Python Bootstrap by me
Portable Python
WinPython and Portable Python are Python environments that run from a USB stick or CD/DVD. These are very cool and can aid in deploying Python apps as stand alone applications!
Development Environments
A good development environment (IDE) will have syntax highlighting, autocompletion and debugging built in.
- Eclipse + Pydev is the best in my opinion, it comes with debugging, a console, git built in, autocomplete and indent, it is very similar to Visual Studio but in some ways way better. Eclipse is a generic IDE that can be used for nearly every programming language.
- Spyder is a very nice Python specific IDE that will be very familiar to MATLAB users. It has a built-in console, variable viewer/editor, help/documentation viewer and debugger! It comes stand alone or bundled with Python (x,y). The developers are very active and responsive.
- PyCharms by JetBrains is a great IDE. I've tried it, and it's as good or better than eclipse. In fact many people prefer it, since its much smaller, focusing only on Python. JetBrains is also responsible for IntelliJ IDEA, the Java IDE that is super popular.
- Sublime Text 2 is a pretty good lightweight IDE written completely in Python, the trial is free but to get rid of the occasional popup cost $60. This has become my personal favorite! It also does syntax highlighting for most major computer languages, and is extensible through plugins that can be managed easily with Package Control.
- Notepad++ also has syntax highlighting for python as well as other languages.
- Vim, a very lightweight but extremely popular terminal editor, also has syntax highlighting for python and other langauges, but it can be tricky to learn. Generally used from a terminal and standard in most POSIX environments, like MsysGit.
- Geany is a lightweight multipurpose IDE.
- Aptana Studio 3 is a preconfigured variant of eclipse + Pydev (I haven’t tried it)
- Atom is a free editor from GitHub. It's available for all platforms. It is similar to Sublime Text 2/3, but it's free, more recently maintained and has many features.
- Ninja-IDE, Ninja-IDE Is Not Just Another IDE, is the latest free newcomer.
- Python Tools for Visual Studio (PTVS), is a mature free extension for Visual Studio 2013, 2012 and 2010. It works with both community edition and desktop express.
- IDLE, part of standard Python, is a basic IDE with syntax highlighting, autocompletion, debugging and more.
- LightTable is a free editor with syntax highlighting, some autocompletion, plugin management and and code evaluation. It looks promising and is the framework for Juno, the Julia editor.
Consoles, Terminals and Shells
A console is a place to enter command lines. Think windows CMD. It can be a convenient place to set up environmental variables such as custom paths. I recommend using ConEmu from Maximus5 GitHub Releases. Another excellent, yet older and apparently unmaintained terminal emulator is Console (v2.00) by Bozho available at Sourceforge.net.
Git Version Control
Version control is essential when writing computer code. Inevitably you will make mistakes and need to go back, you may need to work with others, you may have new ideas that you want to flesh out, or your computer will crash and take your hard drive with it. Theses are issues that version control solves. Git has emerged as the go to version control tool. For Windows msysgit is conveniently packaged with MSYS, a posix environment with many BASH and posix tools that compliments Python nicely. If you need a graphical client TortoiseGit will suffice.
Virtual Environments
I can't conscientiously write a Python primer without at least mentioning virtual environments. Occasionally a project may depend on specific Python packages, and due to threats, real or imagined, of backwards incompatibilities, a Python virtual environment is used to freeze the project dependencies. The virtualenv
package accomplishes this task by creating a Python sandbox that contains only the specific packages desired. A virtual environment can also be used to test out development distributions, or other untested packages that you don't want to install into your system site-packages folder. In particular, Max OSX and Linux users may prefer to use virtual environments since they don't require root. There is also a very convenient wrapper called virtualenvwrapper that makes managing virtual environments a cinch. Anaconda users should use conda
instead of pip
and virtualenv
.
Sunday, July 1, 2012
Setting up eclipse with web platform tools and other plugins on Windows and Ubuntu
On Ubuntu, use the Ubuntu Software Center repository and install every "eclipse-" option, but not the source or sdk, unless you need it. Some of the plugins on Ubuntu include the CDT4 package (C/C++) , the xml package, datatools, modeling and EGit/JGit. Although, you may choose to install Egit/Jgit from eclipse instead, so that you can stay current with the most recent updates.
Then use the following p2 repos to install the WTP and PyDev plugin.
http://download.eclipse.org/webtools/repository/indigo/ for WTP, don't install incubation projects.
http://pydev.org/updates for pydev, but unclick the box that allows it to look for updates from other urls, because this will screw up your installation. See this post.
See this post about updating your eclipse installation on Ubuntu. Basically, if you installed it from the Ubuntu Software Center, then do not update it from eclipse. So be explicit about exactly what you choose to update by selecting its p2 repo url. you can update packages the same way you install them; eclipse will say that it's changing an installation to an update, because of the obvious.
Do *Not* Update eclipse installed from Ubuntu Software Center
[UPDATE 2013-03-05] If you are determined to update your eclipse installation from within eclipse, or if you just want to separate your eclipse installation from the Ubuntu software repository, then you should consider installing eclipse on Ubuntu as add-on software. Trust me, in general you will be much happier!
Eclipse available software windows is blank
Probably a corrupt .metadata file. Make a mental note of your workspace settings, then delete the .metadata file and restart the workspace. Now set up your preferences the way you had them before if you want to.
PyDev internal error "loading bundles"
Note, this isn't my image, but mine was nearly the same.