Friday, December 10, 2010

Improved unittest support in Pydev

Pydev 1.6.4 is still not released, but the first nightly with the new support for unittest is now available (see http://pydev.org/download.html on instructions for getting the nightly).

The major features added are:

1. A PyUnit view is now available to show the results of unittests
2. The nose and Py.test test runners are now also supported





The interesting features related to seeing the tests are:

- The results of tests are shown, along with a green/red bar (or if you're with Aptana Studio, following the color theme)
- The time a test took to run is shown (and may be used to sort the tree)
- The errors/output are shown by selecting the test run or just hovering over the items
- A filter to show only errors is available

And there are some interesting actions in that view too:

- A test session can be rerun
- A new test session can be created to rerun only the errors of the current run
- The test session can be stopped
- The results of a previously run test session can be seen again

And at last (but not least), the test runner can now be configured, so, one can use the test runner bundled in Pydev, Nose or Py.Test.

The preferences page to configure it can be accessed in the 'Configure test runner preferences' in the PyUnit view.





Enjoy!

Sunday, November 21, 2010

What's next in pydev?

Ok, this release is taking more time than usual. What happened is that the main target of the release changed after I started working on it (due to popular demand).

So, the next 2 releases will be targeted at those that use unit-tests a lot -- such as myself :)

I won't put on more details right now, but as soon as things are ready for testing (probably at mid-end December) I'll post again about it.

In the meanwhile, critical bugfixes are being fixed and nightly builds are being issued with those fixes if anyone needs those. So, the current nightly is actually the last stable version + bugfixes -- new things are in a branch called 'nose' -- which should give a hint on what's being worked on from its name :)

Tuesday, October 05, 2010

Pydev 1.6.3 released

Yes, Pydev 1.6.3 is out.

This is mostly a bug fix release, but there are still some noteworthy things, such as new icons, a better editor preferences explaining how to properly configure the themes when using Aptana themes and an improved code-completion for keywords.

See the full details at http://pydev.org/

Enjoy!

Tuesday, September 07, 2010

Pydev 1.6.2 released

The latest Pydev version is out.

The Django Templates Editor is the major thing in this release, supporting html files with html, css and javascript.

The current Pydev is now also integrated in Aptana Studio 3, so, a full download where Pydev (with the Django templates editor) is already pre-installed is available at: http://aptana.com/products/studio3/download.

Also noteworthy is that the Python 2.7 grammar is fully supported (and a bunch of bug fixes have been made available).

Thursday, August 19, 2010

Django Templates Editor

Note: The new recommended way of having a Django Templates Editor is by using LiClipse: http://brainwy.github.io/liclipse/ (which is a commercial counterpart made to keep PyDev supported, as such it has PyDev standalone and a bunch of other goodies builtin).

Aptana Studio 3 still has PyDev and its own Django Templates Editor, but the bundled PyDev version is not kept up to date.

Below are more details on the integration on Aptana Studio 3 (using the Aptana Themes)






The highlighted tokens are the ones defined in the templates in the "Django tags" context (so, tags to be highlighted can be added or removed).





Also, there's code completion based on templates for the django-templates related stuff and pretty nice html completions inherited from the Aptana html editor.

The image below shows the html completions, a django-templates template completion and its result and a django-templates template completion for the filters.




That's it for now. Please grab it and let me know if it's working or if there's a bug lying around there so that it can be fixed before the official release :)

Tuesday, August 03, 2010

Pydev 1.6.1 released

This release was anticipated a bit because of a critical fix to the debugger, which was not working in python 3 (the thread module was renamed to _thread and this wasn't properly dealt with).

Also noteworthy in Pydev 1.6.1:

There are actions to restart the last launch (Ctrl+Shift+F9 in pydev editor) and terminate all launches (Ctrl+Alt+F9 in pydev editor). Buttons were also added in the console output view of pydev launches to activate those (so, it's now easier to restart a given launch after code-changes).

2to3 is now integrated in pydev. To use it right click a folder or file and choose the menu "Pydev > Apply 2 to 3".

Enjoy!

Sunday, July 18, 2010

Code-completion in debugger (Pydev 1.6.0: testers needed)

Pydev 1.6.0 should be released on Tuesday (if no bugs are found until then).

The major work in this release was on the debugger, with:

1. code-completion in the console (as the image below shows)



2. Code entered is evaluated on a line-by-line basis (previously an empty line had to be entered before the evaluation)

3. There's a way to work with the stack of unhandled exceptions in the debugger. There's still no way to add it in the gui, so, one has to call pydevd.set_pm_excepthook() from within the program to handle those (the module will be there whenever running in debug mode). Note that if sys.excepthook is already changed within the program, this call has to be done after that change (it will call that function and show it in the pydev stack frame right after that)

Aside from that, pydev is now compatible with Aptana Studio from 2010-07-12 and there's a fix for one really annoying bug in the compare editor when applying a patch.

Wednesday, June 23, 2010

Preparing for Pydev 1.5.8 (testers needed)

Pydev 1.5.8 is now in polish mode for a new release, so, anyone wanting to test it, this is a good time (and it should be pretty stable already). Just grab the nightly to test it: See: http://pydev.org/download.html for instructions.

The major change is that Pydev now takes advantage of the newest features in Aptana 3 (beta).

Noteworthy features incorporated:

1. Theming: The colors in the chosen theming (Preferences > Aptana > Themes) are properly used.



2. Find Bar: Instead of the default Find/Replace dialog, a find bar is shown at the bottom of the editor for doing common searches (and the next Aptana release will also add replace actions to that bar).



Some other niceties include:

- An additional choice for the title of django editors, showing a different icon but still adding the regular name of the file to the title was added.

- Jars are now signed (some people were getting corrupt installs with problems when downloading pydev, so, this will hopefully fix that).



- A bunch of bug-fixes :)

Thursday, May 06, 2010

Pydev 1.5.7 released

It's just out and it's an almost required update (a critical bug was fixed in the debugger which could make it skip breakpoints).

Aside from that, many other niceties were added:

- Performance for really large files got considerably better
- The interpreter configuration will only update what's needed (duh)
- Editors have a unique representation considering all editors currently open
- Etc. See: http://pydev.org/ for details.

Enjoy!

Wednesday, April 21, 2010

Identifying your editors

Now that Django support is available, there are some niceties being added to make life more pleasant when dealing with files with the same name, which are very common when developing with Django (or any other application in the case of __init__.py).

There are 2 levels of support for those cases:

1. Really common files (__init__.py or in Django projects models.py, tests.py and views.py) have a special option in which the title of the editor is no longer the file name, but the name of the package containing that file, while a different icon is shown for those files (as the image below shows).





2. If there are 2 files that would be shown with the same name, PyDev will change the title of both to contain not only the name of the file, but also the name of the parent package.





Those options can be tweaked at the preferences (hope those are self-explanatory):





And with the icon available you already know it's Python right? -- So, there's an option to hide the file extensions from the tab title.

Those features are already available in the current nightly build (and will be available in the 1.5.7 release).

Hope you enjoy!

Wednesday, April 07, 2010

Pydev and virtualenv

A doubt that arises sometimes is how to use Pydev with virtualenv, so, here we go...

For those that don't know about it, virtualenv is a Python tool that allows one to configure a new Python interpreter that's 'sandboxed' based on an existing interpreter.

Sample use of virtualenv:

Say you have an interpreter in d:\bin\python26 (with easy_install in place).

You could do d:\bin\python26\scripts\easy_install.exe virtualenv to install virtualenv and later do:

d:\bin\Python26\Scripts\virtualenv.exe d:\bin\Python26django, which would create a new Python install at d:\bin\Python26django.

Later, you could add new libraries just at that Python install without disturbing the base install.

E.g.:
d:\bin\Python26django\Scripts\easy_install-2.6.exe django would install django at that interpreter without changing the default one.

Now, as far as Pydev is concerned, there's nothing special in configuring a regular interpreter or an interpreter available through virtualenv. It's just a matter of following the default steps (available at http://pydev.org/manual_101_interpreter.html) but pointing to the interpreter created by virtualenv (in this case d:\bin\Python26django\scripts\python.exe).

Note: For linux users, the instructions should be similar, but the created folder by virtualenv doesn't put the interpreter at a 'scripts' folder, but at a 'bin' folder.

Update: Note that when selecting a virtualenv interpreter, the folders from the base install won't come checked by default when adding the interpreter, so, those have to be manually selected.

Thursday, April 01, 2010

Pydev 1.5.6 released / Django integration available

Pydev 1.5.6 has just been released (it's the same version as the last nightly build, so, if you were already in the last nightly build, there will be no upgrade available).

As commented before, the major highlight in this release is the Django integration.

There are more details on that at: http://pydev.org/manual_adv_django.html

Other additions worth commenting are:

* The go to definition (F3) now works with unsaved buffers

* Some improvements were done in the auto-edition to automatically close literals

* On backspace, the closing literal or parenthesis may be deleted

* Ctrl+2+s word to search can be used to search for a string in open editors (and that can no longer be done through the find/replace dialog)

Enjoy.

Tuesday, March 23, 2010

Django on Pydev (take #2)

It's nice that the previous post on Django on Pydev made so many people happy :)

There were many comments and I decided for writing a separate post to answer those and explain a bit better what should be the final state of the integration.

1. Django templates

There will be a special editor for that, but this will not be in the next release. This editor will be based upon the new Aptana Studio 3 (if you don't know about it, there's a preview explaining it at http://vimeo.com/channels/radrails#9895797). Initially it may be simpler (at least syntax highlighting and outline) and it should shape to have code-completion and other features in the future.

2. Custom Django actions

A new nightly has just been pushed with support for any custom action to manage.py. There's still room for improvement, like automatically going through the manage.py help and executing a command or asking help on that, but this won't be available for the upcoming release.

3. Code Analysis of Django

Most things should work as it is now, but I'm waiting for bug-reports saying what exactly Pydev fails to acknowledge on Django.

And that's it for the current plans... if there are more suggestions, they're very welcome!

Sunday, March 21, 2010

Django on Pydev

The current nightly build (which will be 1.5.6) is already providing some special support for Django (special thanks to Leo Soto for providing a good base for building upon).

There are still some details until the final release, but I'd like to get some feedback before that.

The special support goes in the following:

1. Create a 'Pydev Django' project (will use django to create a manage.py, settings.py and urls.py)



2. For an existing project, just right click it and choose 'Pydev > Set as Django project)'




3. Custom Django actions can be accessed right clicking a project with the Django config and choosing Django > action.



4. Note that the Shell with django environment will create a shell properly configured with your settings, providing the default features from the pydev shell, such as code completion, history, context assistants (ctrl+1), etc (see: http://pydev.org/manual_adv_interactive_console.html for more details)




5. Run as Django/Debug as Django are available (note that they set the --no-reload by default, otherwise the debugger may have some issues and other processes may be kept alive when closing the process spawned by Pydev).



And that's it. It's all there in the nightly build already (I still have some features and minor adjustments to do, but that should already give a good idea of what will be available, and I'm waiting for feedback to know if there's something missing that really should be there).

Tuesday, March 02, 2010

Preparing for upcoming release (testers needed)

Pydev 1.5.5 is getting near a new release. The current nightly build (1.5.5.2010030222) should be the released version if no critical bugs are found until Thursday.

The major highlights for this release are:

1. The contents of the interpreter PYTHONPATH are all shown in the Pydev Package explorer (so, the contents of those modules can be seen, including zip file contents)

2. Predefined completions can be used in Pydev. Those are plain Python 3.0 files with the interface for modules, and there's a choice where Pydev creates those files from QScintilla .api files (see: unpublished instructions at git for more details)

3. The find/replace dialog in Pydev has a new button which can be used for finding the current string being searched for in the currently opened editors (although because of an Eclipse limitation it doesn't work on external files, just editors opened with files under a project).

4. Improved hover support for compiled modules.

Well, that's it for this release.

For the next release, the focus will be on a special Django integration in Pydev.

Leo Soto has been working for some time on it already and I was eagerly waiting for it (available at http://github.com/leosoto/Pydev/tree/bingo), so, the next release will be integrating that branch into Pydev and making it as smooth as possible for Django developers inside of Pydev.

Wednesday, January 20, 2010

Pydev 1.5.4 released

Yes, Pydev 1.5.4 is out already.

The most noteworthy things done in this release were:

It's now possible to create your own template variables through Jython scripting.

A bug that could deadlock Pydev in a race condition was fixed.

Aside from that, many little things were done:

There are now actions to copy the qualified name of your current context to the clipboard and go to the matching bracket.

The wrap paragraph is now also available in the source menu (it seems many didn't know it existed), and Ctrl+2 will bring up a dialog with the available options (although it can still be completed as before -- in fact, there's a delay in bringing up the dialog so that it doesn't bother if you already know what to choose).

The hover is improved and will actually show the code related to the variable being hovered as well as a link to the definition if hovering over a method or class.

Several minor bugs and enhancements in the grammars used for Python parsing as well as in code analysis and code completion were also done.

The complete details can be seen at http://pydev.org/

Saturday, January 09, 2010

Templates on Pydev (with Jython scripting)

One really nice feature that has just been added to Pydev (available in the nightly build) is the possibility of extending the variables that are available for templates through Jython scripting.

It opens lots of possibilities, as when it's resolved it has access to the python code being edited (and all the available modules and Pydev APIs).

Some default templates were added already taking advantage of that (see: pytemplate_defaults.py as a reference -- the docstring explains how to create your own templates).

The image below shows the variables created in the defaults (already using Jython scripting -- note that when multiple superclasses are available, the ${superclass} variable enables the user to choose which one to use):





This enabled the print template to work as expected (giving only 'print ' in python 2.x and 'print()' in python 3.x, as it can 'know' which grammar you are using).

To finish, 2 other templates were creating taking advantage of the context:
super : super(MyClass, self).CurrentMethod()
super_raw : MySuperClass.CurrentMethod(self)

If anyone has other 'must have' template suggestions now that this is available, those are very welcome.

On a side note, the current nightly build is pretty stable (and should be the new released version unless there's some critical error lying there found in the next 2-3 days), so, it should be safe to get it to experiment with those.