Friday, June 24, 2016

PyDev 5.1.2: pytest integration

PyDev 5.1.2 is now out. The major change is in the pytest integration.

For those that don't know about it, pytest (http://pytest.org) is a Python test framework which requires less scaffolding to make tests (you don't need a hierarchy such as in PyUnit, just test methods in a module and asserts for checks suffice, it takes care of providing a reasonable error message -- also, it has an interesting fixture concept which allows structuring the test environment in a way more natural then through an inheritance hierarchy with unittest.TestCase.setUp/tearDown).

If you want to use pytest, in PyDev, the runner in the preferences > PyDev > PyUnit has to be set as pytest.

It's interesting to note that PyDev makes it trivial to just run a single test: you can select the test by using the method navigation (Ctrl+Shift+Up and Ctrl+Shift+Down) and press Ctrl+F9: this will open the outline for selecting which tests to run with only that test selected by default, then you can press Enter to run the test (or Shift+Enter to debug it) -- note that this works with the regular unittest too, not only with pytest.

Thursday, May 05, 2016

PyDev 5.0.0: PyUnit view persists state across restarts, Java 8 now required

PyDev 5.0.0 is now available for download.

The major feature in this release is that the PyUnit view will now persist its state across restarts ( personally, I find this pretty handy as I usually try to leave a failing test to be solved so that I know where I stopped ).

Also, this release requires Java 8 to be used ( if you need an older version, you can access the update site for older versions at: http://www.pydev.org/update_sites ).

As a note, if you're unsure on how to update your system java vm  ( or it's not possible to ), you can dowload a .tar.gz version from http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html, extract it somewhere and point Eclipse to use it following the info from: http://wiki.eclipse.org/Eclipse.ini ( or just use LiClipse, which has the latest PyDev bundled for a hassle-free installation with many extra goodies ).

See: http://pydev.org for more details on this release ( as a note, PyDev 4.6.0 was previously released with the same contents, but was re-released under 5.0.0 to signal the major change on the required Java VM ).

Wednesday, March 23, 2016

PyDev 4.5.5: code-completion, pytest, python 3 parsing, debugger

PyDev 4.5.5 is now available for download.

This release improved code completion was improved so that namedtuple is recognized (although this requires that it's fields are passed in the constructor as  a list of strings without being dynamically created) -- it should've supported super() too, but unfortunately there's still an issue in that feature (which should be solved in the next release).

This version also fixes some issues in the latest pytest integration (PyDev can use the pytest runner by enabling it in the preferences > PyDev > PyUnit and selecting pytest as the test runner), as a few things broke when used with the latest release due to some changes in pytest itself.

Another nice thing is that the parser for Python 3 now handles async and await in a backward-compatible way (as Python 3.5 does), which means it should be able to properly parse files from the Python 3.4 standard library again (which had some issues in the asyncio due to that) and fixes some of the unpacking generalizations from PEP 448 which weren't properly recognized.

Also, the UI now shows that the Python 3 parser is used from Python 3.0 to Python 3.5 (this is mostly because the adoption on Python 3 hasn't been so great so far, but now that it's becoming greater, the idea is that new versions will have a separate parser, so, when Python 3.6 is released, if it requires changes in the parser, a Python 3.6 parser will be created separate from the current parser).

And to finish, this release also fixes some issues in the debugger (the most critical related to an issue dealing with the connection to spawned processes in multiprocessing, which made debugging Celery fail under the debugger).

For LiClipse users, 2.5.4 was just released too with the latest PyDev!

Friday, January 22, 2016

PyDev 4.5.3: Debugger fixes and improvements in PyUnit view

PyDev 4.5.3 is now available for download.

This release was done in such a short notice from the last release because a critical issue was fixed in the debugger (although it also added a few improvements to the PyUnit view, making the history dropdown show more information on the run and providing a way to export the results of a run to the clipboard, which are pretty nice).

As a note, LiClipse users (especially those using dark themes) should benefit a lot from the latest release, as it themes the trees and tables scrollbars (with the support from https://github.com/fappel/xiliary), so, it's a highly recommended download ;)

Anyways, I'll take the chance to talk about the bug which actually triggered this release (which was https://sw-brainwy.rhcloud.com/tracker/PyDev/650):

The PyDev debugger by default will monkey-patch all the calls which create a new process to automatically connect the debugger to the spawned processes if those are also Python processes -- and it also monkey-patches the os.fork to connect the forked process to the debugger.

Now, in os.fork it always connected the new process to the debugger, as it expected the new process to be a Python process, but there's a catch here: on Linux, subprocess.Popen will first fork the current process and then will do an os.execvp to replace the forked process with a new process, but in the latest version this was making the debugger crash (although it's still not 100% clear to me why that same process wasn't crashing before as the debugger already did this in previous versions -- anyways, os.execvp did some incantation under the hood which crashed when the debugger was setup when it was doing something as subprocess.Popen(['uname', '-m']), which first forked the process, connected it to the debugger and then replaced it with the uname executable).

So, the actual fix was detecting that it was forking for a subprocess.Popen and refrain from setting up the debugger if it was not executing a new Python program ;)

Enjoy!

Thursday, January 14, 2016

PyDev 4.5.1: debug faster

PyDev 4.5.1 brings niceties such as an improvement on the code-completion so that properties declared with @property no longer show arguments parenthesis and Ctrl+1 can be used inside a bracketed statement to wrap/unwrap its contents over multiple lines (thanks to yohell). Also, the refactoring, parsing and search had some fixes, but the major changes were in the debugger.

The debugger is much faster and has optional Cython modules for even additional speedups.

In short, the debugger is overall 40% faster without Cython and 138% faster with Cython in the benchmarks created -- although in real world cases I expect even better gains as the benchmarks were done for the cases where the debugger has more overhead than usual.

Graphs with more details on the improvements may be seen at:

https://www.speedtin.com/reports/7_pydevd_cython (performance results with cython).

https://www.speedtin.com/reports/8_pydevd_pure_python (performance results without cython).

Also, the debugger backend is now also available through "pip install pydevd" (https://pypi.python.org/pypi/pydevd), so, it's easier to setup the remote debugging in a different machine (note that users shouldn't need to install the debugger, only if doing a remote debugging session).

As a note, I'd like to thank JetBrains, which helped on sponsoring the performance improvements in the PyDev Debugger (as it's also the debugger backend used by PyCharm).

For LiClipse users, 2.5.1 (just released too) includes the latest PyDev.

Tuesday, October 06, 2015

PyDev 4.4.0 released

PyDev 4.4.0 is now available for download

The main changes in this release include:

  • Improved PyDev Package Explorer to give more information when all elements are filtered -- it seems it was common for new users to end up in a state where there was no working set selected while having a working set filter...
  • Code completion improvements: when a parameter is typed in the docstring, assigning it to an instance gives proper code-completion results when accessing the instance.
  • Fixed issues dealing with ansi colors in the interactive console.
  • When autopep8 is applied as the code formatting engine, the region selected is used to specify the lines for formatting.
  • Minor improvements in the debugger.
For those using LiClipse, there's a critical fix dealing with TextMate/SublimeText bundles (and PyDev has also been upgraded), so, please upgrade...

Thursday, August 20, 2015

PyDev 4.3.0 (improved searching)

PyDev 4.3.0 is out now ;)

The main focus on this release was on ironing out the new search dialog (which makes searching even huge codebases almost instant).

Also, there was a high-priority fix which made the Python 3.x parser accept async and await as regular names and not only keywords.

LiClipse 4.3.0, which had several enhancements in its parsing structure to make the editor even faster was also released to include the new PyDev version.

And as always, thank you very much to the PyDev supporters which help on keeping the PyDev development going strong.