Filed Under (Editors, Python) by Marcin Kuźmiński on November-20-2009

Few days ago there was again a major update on pydev eclipse plugin.
The version 1.5.1. Comes with new refactoring engine PEPTIC, it’s way better than any one before.
Complete list below: visit http://pydev.org for download.

Release 1.5.1

  • Improvements in the AST rewriter
  • Improvements on the refactoring engine:
    • No longer using BRM
    • Merged with the latest PEPTIC
    • Inline local available
    • Extract method bug-fixes
    • Extract local on multi-line
    • Generating properties using coding style defined in preferences
    • Add after current method option added to extract method
    • A bunch of other corner-case situations were fixed
  • Bug-fixes:
    • Minor editor improvements
    • Adding default forced builtins on all platforms (e.g.: time, math, etc) which wouldn’t be on sys.builtin_module_names on some python installations
    • Adding ‘numpy’ and ‘Image’ to the forced builtins always
    • Ctrl+1: Generate docstring minor fixes
    • Ctrl+1: Assign to local now follows coding style preferences properly
    • Exponential with uppercase E working on code-formatting
    • When a set/get method is found in code-completion for a java class an NPE is no longer thrown
    • Backspace properly treated in block mode
    • Setting IRONPYTHONPATH when dealing with Iron Python (projects could not be referenced)
    • No longer giving spurious ’statement has no effect’ inside of lambda and decorators
    • Fixed new exec in python 3k
    • Fixed NPE when breakpoint is related to a resource in a removed project
    • Fixed import problem on regexp that could lead to a recursion.
    • No longer giving NPE when debugging with the register view open
    • List access be treated as __getitem__() in the list — patch from Tassilo Barth
    • Fix for invalid auto-self added when typing


Filed Under (Editors, Python) by Marcin Kuźmiński on November-15-2009

I installed new eclipse on ubuntu 9.10, and noticed that manu of FINISH,
NEXT buttons are not working correctly ( you can’t click them).

So it found out it’s eclipse bug, but fortunately there is a simple
solution to this problem.

Write a startup script:

#!/bin/sh
export GDK_NATIVE_WINDOWS=1
/path_to_eclipse/eclipse

Save it as eclipse-run.sh make it +x, and the buttons will work now if you
run your eclipse via the run script.



Filed Under (Mercurial, Nginx) by Marcin Kuźmiński on November-15-2009

Today is a great day ;) i switched my repos from svn to mercurial.
I was still thinking about GIT but there where three key points that made me choose mercurial

Cons: it’s slower than GIT ( but who cares :D )

So after installing mercurial and moving my svn repos with history with hgsvn ( which can also do push to svn )
I started to setup easy access to the repository using nginx. I’ll show you how to setup an SSL http based repository to do PUSH/PULL/CLONE what ever.

Firstly we have to make self signed ssl certificates.
I found on of the easiest tutorials available you can find it here: http://www.akadia.com/services/ssh_test_certificate.html

OK when we have the ssl certificates for our server. Put it somewhere on the server so nginx can access it.
We have to setup a new virtual host for nginx that will only do ssl connections
and have basic auth additionally.

Here’s the example config:

server {
    listen          443;
    server_name     hg.yourserver.com;
    ssl    on;
    ssl_certificate    /home/ssl_certs/hg_cert.crt;
    ssl_certificate_key     /home/ssl_certs/hg_cert.key;
    access_log      /var/log/nginx/hg.log;
    auth_basic      "mercurial server";
    auth_basic_user_file    /etc/nginx/.htpasswd;

    location / {
        proxy_pass      http://127.0.0.1:8001;
        #here's where the hg server runs
        include         /etc/nginx/proxy.conf;
    }
}

Few thing to notice.
.htpasswd file has to be in a format <username>:<cryptPassword> if you don’t have apache
installed you can use my password generator for generating crypt password. This username
and password will be used to do pull/push from console and eclipse.
Another important thing is that when you run hg serve you must specify the -a 127.0.0.1 option which is
for the address the mercurial server runs. Hg serve default is to start at all interfaces
so you have this port open outside and your ssl/passwd protection is for nothing…

I run my using hg serve –webdir-conf=/etc/hg/hgweb.conf -d -p 8001 -a 127.0.0.1

The hgweb.conf should be with

push_ssl = false
#since nginx is doing the SSL
allow_push = * #NGINX  is doing the auth
style = gitweb

O and one more thing remember that your repo should be accessible to hg serv.
I made a mistake and run hg serve as www-data and my repo was to my home user,
and i had internal server error when trying to do push to server.

So now you can have your repo via http with SSL and nginx authentication.



Filed Under (Editors) by Marcin Kuźmiński on September-6-2009

The creator of PyDev together with aptana released the version 1.5 of PyDev.This major release contains PyDev along with previously commercial non free PyDev extensions.
This is from now a Open Source project you could find on sourceforge
Pydev Extensions is a plugin that adds many other features to Pydev such as…

* code-analysis
* code completion with auto-import
* better implementation of go to definition
* remote debugging
* ‘quick-fixes’
* mark-occurrences <- this one is great :)

Before the PyDev extension was a paid plugin for aptana or eclipse.Now you could download it as PyDev 1.5 which is pyDev + pyDev extension merged together as a free open source project.
Great to here that :)

In order to install the pyDev 1.5 just update your eclipse repository to new update address which is http://pydev.org/updates

I think the nightly builds are yet not in 1.5 so I’ll use this repo for now.

Also i found a great link for PyDev functionality.

http://pydev.org/manual_adv_features.html

i did not know eclipse provide the ctrl+/ functionality (text auto completion emacs style…) This one is very handy !!

Enjoy new even better pyDev



Filed Under (Editors, Python) by Marcin Kuźmiński on June-25-2009

Today is Eclipse Galileo release day. So i made my new PyDev + eclipse compilation with some customizations.

I remove all the unnecessary stuff for java IDE since we program in python we don’t need java stuff in there( and it loads faster to :D )
replaced splash screen with the one from pyDev site, and throw some nice (Python) window icons.

Here’s the main window:
Screenshot-Pydev - Eclipse

Here’s what you have to do to have my setup:

  • Get the newest version of eclipse for java IDE (not the EE) use this direct link if you want download eclipse
  • extract folder eclipse to you hard drive and rename it to let’s say PyDev ;]
  • DON’T RUN ECLIPSE !! please
  • Ok here’s what you have to remove to get rid of all the java stuff
    (i have nothing against java, but we’re talking python here)
  • from folder features remove org.eclipse.jdt_3.5.0.v20090527-2000-7r88FEeFJePyvYeA33DjZ_c1
  • from folder plugins remove
    org.eclipse.jdt.debug_3.5.0.v20090526
    org.eclipse.jdt.apt.core_3.3.200.v20090528-1135.jar
    org.eclipse.jdt.apt.pluggable.core_1.0.200.v20090526-2130.jar
    org.eclipse.jdt.apt.ui_3.3.200.v20090528-1135.jar
    org.eclipse.jdt.compiler.apt_1.0.200.v20090528-1135.jar
    org.eclipse.jdt.compiler.tool_1.0.100.v_963.jar
    org.eclipse.jdt.core.manipulation_1.3.0.v20090603.jar
    org.eclipse.jdt.core_3.5.0.v_963.jar
    org.eclipse.jdt.debug.ui_3.4.0.v20090527.jar
    org.eclipse.jdt.doc.user_3.5.0.v20090603-1530.jar
    org.eclipse.jdt.junit.runtime_3.4.100.v20090513-2000.jar
    org.eclipse.jdt.junit4.runtime_1.1.0.v20090513-2000.jar
    org.eclipse.jdt.junit_3.5.0.v20090526-2000.jar
    org.eclipse.jdt.launching_3.5.0.v20090527.jar
    org.eclipse.jdt.ui_3.5.0.v20090604.jar
    org.eclipse.jdt_3.5.0.v200906111540.jar
  • Firstly i decided to remove epp.package.java but this really screws up eclipse and the icons so don’t do it
  • Now download this pydev icons  package pydev_icons and extract it somewhere
    if you don’t need the eclipse icon replacement you can skip this.
  • Copy and replace splash.bmp to folder plugins/org.eclipse.platform_3.3.200.v200906111540
    and paste rest of images to folder in plugins/org.eclipse.epp.package.java_1.2.0.20090619-0620
  • In case of newer eclipse builds (3.5.2) just copy everything to plugins/org.eclipse.platform_*.*(version number) and remove the gifs, so eclipse will load png
  • Your done !

Now run eclipse save you workspace and setup pydev as in this post:

http://www.python-blog.com/index.php/2009/06/20/python-ide-pydev-best-choice/

Enjoy lighter version of newest eclipse galileo with Pydev and some nice icons :)

UPDATE: I changed the splash screen in pydev icons to be the same size as original one.



Filed Under (Editors, Python) by Marcin Kuźmiński on June-20-2009

I went through many of python editors, and always came back to PyDev. Pydev in an plug-in to eclipse it comes with load of features, among them:

  • Package Explorer showing outline for python modules
  • Mylyn integration (separate feature: org.python.pydev.mylyn.feature)
  • Jython and Python support!
  • Support for scripting Pydev with Jython
  • Nice PYTHONPATH configuration!
  • Project and module creation wizards
  • Ctrl+Shift+O: Organizes imports or sorts selection alphabetically
  • Ctrl+Shift+F: Autoformat your code (preferences can be set)
  • Python 2.4, 2.5, 2.6, 3.0 syntax supported
  • Pydev builders can be disabled
  • Syntax highlighting
  • Spell checking (depends on JDT for Eclipse 3.3)
  • Hovering in errors shows descriptions
  • Matching brackets highlighted.
  • Parser errors marked in the task list
  • Outline view with imports/functions/classes
  • Tabs or spaces preference
  • Smart indentation (indent and dedent)
  • Navigation: keyboard shortcuts to previous or next function. Default: (Ctrl+Shift+Up and Ctrl+Shift+Down)
  • Comment and uncomment commands (on the popup menu) and keybindings. Default: (Ctrl+3 and Ctrl+Shift+3)
  • hyperlinks over functions//import statements
  • Code folding
  • Refactoring with bicycle repair man.
  • Code Completion (Ctrl+Space)
  • Templates Completion (Ctrl+Space Too)
  • Go to definition with F3 (powered by bicycle repair man)
  • Content Assistant (Ctrl+1)
  • Code Coverage
  • Pylint
  • TODO tasks
  • Background and current line color chooser.

I highly recommend using Pylint in pydev it really helps to keep the code good quality. Pylint analyzes your code and shows unnecessary variables and imports, provides helpers to clean up the code and many more.

To install pydev just add http://pydev.sourceforge.net/updates/ http://pydev.org/updates (see update below) link to eclipse by using software updates and addons option.
I’m using the nightly builds for eclipse (http://nightly.aptana.com/pydev/) because they always come with new features earlier than the main release but remember use it on your own responsibility. You can find how to setup pydev here. When your up and running with pydev download pylint from here don’t forget the necessary dependencies i.e: logilab-astng, logilab-common, links are on the pylint download site. The turn on pylint you have to add a path to lint.py file in pylint tab on pydev options in eclipse. After restart of eclipse you should see output from pylint on the eclipse console anytime when you save a python file.

Now enjoy the most powerful python IDE available :-)

UPDATE: since PyDev release 1.5 now the package have integrated a pyDev extensions… the new repository for eclipse containing the version 1.5 is :http://pydev.org/updates
I also added a post about the PyDev extensions see it here http://www.python-blog.com/2009/09/06/pydev-extension-now-open-source/