Sunday, March 27, 2011

PyDev 2.0

First the latest news: PyDev 2.0 is released.

The main features introduced are:

* TDD actions similar to those available in the Eclipse Java Development Tools (i.e.: create class, method, field, module with Ctrl+1 quick fixes);

* Code-coverage support has improved a lot (note that it relies on having the coverage module from http://nedbatchelder.com/code/coverage/ installed).

The full release notes may be found at: http://pydev.org

Click the image below to see a short video showing these additions -- among a few other things that can be handy for those aiming to be productive using PyDev...

PyDev 2.0

Unfortunately I couldn't be at PyCon to represent PyDev this year -- where there was a panel on Python IDEs -- so, at least I got to do a video with the presentation I'd do there :)

Another nice thing is that PyDev won the “Best Developer Tool” award from the Eclipse Foundation!

Friday, March 04, 2011

PyDev is a finalist in the Eclipse Community Awards

Actually, this is something that's already old news (announced more than a week ago) but I couldn't manage to get time to post about it sooner, as I'm pretty busy coding for the next PyDev release ;)

PyDev has been named one of the finalists for the Best Developer Tool in the Eclipse Community Awards (the other finalist in this category is Diver).

So, just wanted to share the good news for PyDev :)

Wednesday, February 09, 2011

Git on the command line

[Update]: When dealing with multiple repositories I now use what's described in: http://pydev.blogspot.com.br/2012/07/git-multiple-repos.html

Yes, sometimes I still use the command line for git (even with EGit getting better).

This is an update to a previous post about git (with msysgit).

[Update] October 31st, 2011: Improved gitdd command a bit
[Update] February 6th, 2012: Adedd command to preview incoming changes on a branch

1. Configure running shell

Usually I use TCC/LE as a shell, so, there's an alias to start the git bash shell from it (tcc allows editing the a 4START.BAT which will run when it's started, so, the configuration may be added there):

alias gitshell=path_to_git/bin/sh.exe --login -i

Other aliases:

alias git1=git log --graph --oneline --decorate

Shows the log with nice graph.

1a Use pageant/plink so that the password does not need to be entered all the time

Download pageant/plink, set environment variable GIT_SSH to the plink location, start pageant and load the private ssh key with pageant.

1b Global git configurations

git config --global user.name "fabioz"
git config --global core.autocrlf input

2. Fix history behavior

I find it annoying that the default history completion behavior (when up/down is used) is always getting the previous command instead of completing based on what's already there. To fix that, create a .inputrc file in your user home directory and set the following contents to it:

## By default up/down are bound to previous-history
## and next-history respectively. The following does the
## same but gives the extra functionality where if you
## type any text (or more accurately, if there is any text
## between the start of the line and the cursor),
## the subset of the history starting with that text
## is searched (like 4dos for e.g.).
## Note to get rid of a line just Ctrl-C
"\e[B": history-search-forward
"\e[A": history-search-backward

$if Bash
## F10 toggles mc on and off
## Note Ctrl-o toggles panes on and off in mc
"\e[21~": "mc\C-M"

##do history expansion when space entered
Space: magic-space
$endif

## Include system wide settings which are ignored
## by default if one has their own .inputrc
$include /etc/inputrc


3. Diff changes

Using mu-repo (https://github.com/fabioz/mu-repo/) with WinMerge.

3a. WinMerge tree view

I also always like to see things as a tree in WinMerge (Menu view > Mode: Alt+V M) and also expanded (Menu view > Expand All Subfolders: Alt+V X). It'll store the configuration to show as tree, but unfortunately it needs to be expanded all the times when doing a compare (i.e.: no auto-expand).

4. Show things in a compact way

git config format.pretty "%h %ct %ad %Cgreen%aN%Creset %s"
git config log.date short

#Make git log show comments wrapped.
git config --global core.pager 'less -r'

5. The commands used to get the contents of a pull request (create local branch, merge, get dev, merge with dev):

git checkout -b PullFromBranch-dev development
git pull https://github.com/pull_from_user/Pydev.git PullFromBranch
git checkout development
git merge PullFromBranch-dev --no-commit --no-ff

Then, to accept the merge do a commit or to reject it do:
git merge --abort
or
git merge --reset


6. When creating a feature in a branch:

git checkout -b FeatureBranch-dev development
git checkout development
git pull FeatureBranch-dev --no-ff


7. Preview incoming changes:

Create a bash file with the contents below (usually just hardcoding the ${current-branch} to the development branch). The command below will create 2 branches from the current branch, update one of those, diff it, compare with external tool and revert changes again.

echo Saving local changes just in case... git stash apply may be done later!
git stash
git checkout -b preview-branch
git checkout -b preview-branch2
git pull origin ${current_branch}
git checkout preview-branch
git merge --no-ff --no-commit preview-branch2
gitdd
git reset --hard
git checkout ${current_branch}
git branch -D preview-branch
git branch -D preview-branch2


8. Common commands

git status
git commit -a -m "Message"
git push origin master
git checkout
git shortlog -4 -w
git log -n 6
git log -n 3 --format=full
git commit --amend (change last commit message)
git show (see what happened on a commit)

And some of the commands I had to discover how to use in the msysgit bash are:

Alt+Space+E+K: mark contents for copy
Insert: paste contents
Alt+Backspace: erase until whitespace


Doing a merge:

Steps: create a new branch based on the current development, pull the merge request into that branch, then checkout the development branch, merge it there without commiting (to do a proper review) and then accept or reject the merge.

git checkout -b branch_to_do_merge_dev development
git pull https://github.com/user/Pydev.git jonahkichwacoders:branch_to_do_merge
git checkout development
git merge branch_to_do_merge_dev --no-commit --no-ff

Then, to accept the merge do a commit to reject it do:
git merge --abort
or
git merge --reset

Thursday, February 03, 2011

Pydev 1.6.5 released

Pydev 1.6.5 is already available for download.

The major features added in this released where:

1. Code generation for classes and methods

* It's now possible to select a given token and press Shift+Alt+S C to create a class for it or Shift+Alt+S M to create a method

* In some undefined variable, do Ctrl+1 and select create method or create class.

Note that this is an initial implementation of the idea, aimed as those that use a TDD (Test Driven Development) approach, so, one can create the test first and generate the classes/methods later on from using shortcuts or quick-fixes (which is
something that those using JDT -- Java Development Tools -- in Eclipse should be already familiar with). This feature should be already usable on a number of situations but it's still far from being 100% complete.

2. Syntax highlighting is now available for (), [], {} and operators.

Aside from those, a number of bug-fixes were also made available (particularly nasty was a bug that prevented the interactive console from working with some of the Python 3.x versions).

Tuesday, January 18, 2011

Appcelerator, Aptana & Pydev

Well, as publicized already, Aptana was acquired by Appcelerator (http://www.appcelerator.com/appcelerator-acquires-aptana/).

So, I thought I'd write a bit about it...

First thing to note is that (as the rest of the team) I've joined Appcelerator, and the plan is to keep Pydev going forward (as it has been going since I had joined Aptana). However, unlike the rest of the team, I'm still based on Brazil :)

I think that the only difference in focus is that now, aside from the support for Django and Google App Engine, Titanium (which is Appcelerator's platform for developing desktop and mobile applications) will also have some special attention, although I still don't have more details on what exactly this means...

All in all, I think this was a good thing, as one of the things that Aptana was looking for was something to support (as the plans were always about giving Aptana Studio for free and making money on something else), and Appcelerator will have a nice improvement in terms of a better coding environment :)