DidRocks' blog

apt-get install freedom

Aller au contenu | Aller au menu | Aller à la recherche

Mot-clé - quickly

Fil des billets - Fil des commentaires

vendredi, août 17 2012

Quickly reboot: Q&A session wrap up!

Last Wednesday, we had our Quickly reboot on air hangout, welcoming the community to ask questions about Quickly and propose enhancement.

Here is the recording of the session:

As for the previous sessions, we had a lot of valuable feedbacks and participation. Thanks everyone for your help! Your input is tremendous to shape the future of Quickly.

We are making a small pause in the Quickly Reboot hangouts, but we will be back soon! Meanwhile, you can catch up on the session notes, and provide feedback/ideas on this wiki page! Follow us on google+ to ensure to not miss any annoucement.

mardi, août 14 2012

Quickly reboot: Q&A sessions!

The previous Quickly reboot session about templates was really instructive! It started a lot of really interesting and opened discussions, particularly on the Quickly talks mailing list where the activity is getting higher and higher. Do not hesitate to join the fun here. :)

As usual, if you missed the on-air session, it's available here:

I've also summarized the session note on the Quickly Reboot wiki page.

Next session: Q&A!

But we don't stop here, the next session will be hold this Wednesday! If you read through the previous links, you will see a lot of pending questions we have still to discuss about, this will be used as the base conversation of the session. However, in addition to those topics, all of your questions will be taken into account as well! You can jump during the session on #quickly on freenode, while watching the show on ubuntuonair. You can as well prepare your questions and new ideas for Quickly, and post them to the google moderator page. There are plenty of ways to participate and help shaping the future of Quickly. Do not miss this session and subscribe to it right now.

Also, ensure you won't miss anything about Quickly and its reboot by subscribing to our google+ page.

lundi, août 6 2012

Quickly reboot: developer feedback wrap up and templates content

Previous sessions

The first two hangouts on Quickly reboot about developer feedback were really a blast! I'm really pleased about how much good ideas and questions emerged from those.

If you missed them, the hangouts on air are available now on youtube. Go and watch them if you are interested:

I've also taken some notes during the sessions, here are what I think was important and came from them: hangouts notes. It's a wiki, if you do have any feedback/questions/other subjects you want to get discussed, don't be shy and edit it! Quickly is a fully community-driven project and we love getting constructive feedbacks/new ideas from everyone. ;)

I've also added on it some nice spot of discussions for future sessions, and speaking of sessions…

Next step: default templates

Next session is a really important one: what should be the default templates in Quickly? From the previous discussions, seems that python + gtk, a html5 one and the already existing unity-lens ones are the good candidates. If so, what should be in every of each of those? How should look the default applications? Which framework (if any) in the case of html5 should we use? Should we make opinionated choices or just providing a default set? What should we provide as tools for them, and so on…

Join the conversation, I'm sure it will be a lot of fun! We plan to have the hangout at 4PM UTC on Wednesday. Ensure to follow it either by jumping in the hangout itself or by following the onair session. Mark it to down to you calendar not miss it!

Do not hesitate to follow the Quickly google+ page to not miss any future events and enhancements to Quickly.

lundi, juillet 30 2012

Time for a Quickly reboot?

Quickly is the recommended tool for opportunistic developers on ubuntu.

When we created it 3 years ago, we made some opinionated choices, which is the essence of the project. We had back then a lot of good press coverage and feedbacks (Linux Weekly NewsarstechnicaZdnetMaximum PC reviewShot of jak and some more I can't find on top of my head…)

Some choices were good, some were wrong and we adapted to the emerging needs that happened along the road. Consequently, the project evolved, the needs as well and we tried to make them match as much as possible. Overall, my opinion is that the project evolved in a healthy way, and has strong arguments seeing the number of projects using it successfully for the ubuntu developer contest. Indeed, from the ~150 submitted projects, most of them were created with Quickly and seeing the few support we needed to do, it means that most of things are working quite well! Also, the comments on the developer contest seems to be really positive about Quickly itself.

So? Time to go the beach and enjoy? Oh no… Despite this great success, can we do better? I like that sometimes, we can step back, look around, and restate the project goals to build an even brighter future, and I think now is this time and that's why I want to announce a Quickly reboot project!

quickly_reboot.png

Why a reboot?

We will need to port Quickly itself to python3, we have no hard deadline right now on it, but it's something (especially with unicode versus string) that I want to do soon. As this will ask a lot of refactoring, I guess it's time to evaluate the current needs, drop some code, completely use another direction to attract more 3rd party integrator (like do people want to integrate Quickly with their favorite IDE?), encourage template developers, make everything even more testable than today to avoid regressions… A lot of things are possible! So a reboot, meaning "let's put all aside, list what we have and what we want to do" is the appropriate term. :)

!Do you have a detailed plan right now of what is coming?

No… and that's exactly what I wanted! Well, of course, I have some ideas on papers and know globaly where I want the project to evolve, but the whole plan is to get the community contributing ideas, experiences before the first line of the reboot is even written.

I'm sold! how to participate?

I will run some google hangouts from the Quickly Google+ page. Those will be hangout on air (so you can just view them live or after the hangout without participating), asking questions/suggestions on #ubuntu-community-onair on freenode (IRC) for answering live, or you can jump in and ask directly during the show. :)

The current hangout will be also available (with an IRC chat box) on this page.

Those hangouts will be thematic to focus the discussion, and will be announced on the google+ Quickly page, this blog, the Quickly mailing list and so on…

First step… feedbacks, 2 chances to join!

The first step to build this Quickly next gen[1] is to gather some developers feedback. So, if you are a developer who used Quickly (or not!) and make softwares for ubuntu, in the context of the app showdown (or not!), we will love to ear from you! The goal of the session is not to point to any particular bug, but rather to share how the experience was for you, what template did you use, what template you would have used if it existed, what went well or bad with the workflow, when did you need to ask a question about a particular subjects? Of course, we are not limited to those questions.

You can directly jump into the hangout to ask your question live or just assist to the hangout on air and add a comment to the live event to get it read during the show.

The two first sessions will be live on different hours next Thursday and Friday: See those events are on the Quickly Google + page: subscribe to those hangouts on air to be sure to not miss them!

Next sessions?

Next topics in the following weeks will be:

  • listing the existings requirement
  • from the feedback from the first session, what needs to be added/dropped?
  • what need to be changed in Quickly to met it? Technical considerations (use of pkgme, templating system…)

all of this will be published on this blog and on the google+ page soon. I hope you are as excited as we are and will massively join us.

Note

[1] Term which seems to be use by the cool kids

jeudi, juillet 26 2012

Quickly: a path forward?

Seeing the amount of interests we saw around Quickly the past last years was really awesome!

Now that we have some more detailed view on how people are using the tool, it's time to collect and think about those data to see how we can improve Quickly. With all the new tools available like hangouts on air, it can be also now time to experiment how we can use them and use this opportunity to have a very open collaboration process as well as trying to attract more people to contribute to it. 

More on that next week. To ensure to not miss anything, please follow the Quickly Google+ page. :)

Lire la suite...

vendredi, avril 23 2010

Quickly 0.4.1 is out!

0.4.1 is a bug fixing release and will be the one in lucid final. Quickly 0.4.1

It contains of course all the goodness of 0.4 version plus some bug fixes that early users encountered:

  • remove ~/.selected_editor detection. Introduced confusion for users who doesn't understand why (nano, most of the time), was triggered instead of gedit (LP: #565586). It's still possible to override the choosen editor with EDITOR or SELECTED_EDITOR environment variables.
  • fix gpg key creation with no email address. Fortunately, new Quickly user won't have to bother that much with gpg key anymore (see 0.4 blog post to see what's still needed to be done)
  • fix again some tutorial issues which had been lost during html -> docbook transition
  • better message and user help when ppa not found
  • add more debugging info in --verbose mode for gpg keys
  • updated translations

0.4.1 should be building soon on the ubuntu builders, keep it hot! ;) Release tarballs are available as usual on Launchpad

Kudos to Lutin for the photo :)

jeudi, avril 15 2010

Quickly 0.4 available in lucid!

I'm proud to announce the availability of Quickly 0.4 in lucid. This new release brings shiny new features (more than 6 months of heavy development), lowering again the barrier for opportunistic developers. Development should just be easy and fun! Quickly Logo

Thanks to all awesome contributors making this release happened: Philip Peitsch, Petar Vasić, Jens Persson, Łukasz Jernaś Brian, Jonathan Lange and Shane Fagan. Special kudos to Rick Spencer for his continue devotion to opportunistic development and making quickly-widgets.

What's new in 0.4?

Well, a lot of stuff, but more precisely, let's me highlight some special features from the NEWS file content, containing the full story.

The core

  • One of the main matter for a lot of user was to use space and dashes as their name project. This wasn't available due to a lot of technical and packaging issues. This is part of past now! You can create your awesome "FoO bAr" project and enjoy it!
  • What's new in the core is template inheritance. You can now create a template picking commands from other templates. That made possible releasing the ubuntu-cli template with 0 line of code! Just shipping a new boiler plate. We hope that would help people in their template creation. Of course, it's still possible to override some commands locally.
  • We also check and recreate your credential if you deleted it in Launchpad inadvertently. Less thing to care about for you! Let's focus on your app!
  • Did you remember how sweet is Quickly regarding shell completion? Now the same has been extended to Quickly option itself.
  • An apport hook for Quickly itself. To report bugs on Quickly, do not hesitate 'ubuntu-bug quickly' on Ubuntu to fetch all needed information on our side.
  • The core now support -- arguments for subcommands like quickly run -- -help won't run help from Quickly itself but from your app.
  • A Quickly API is available, for people wanting to communicate or integrate Quickly to an IDE, it's fully possible to embed Quickly in your app, spread the Quickly love!

The ubuntu-application template and derivatives:

ubuntu-project renamed

One of the main feature of 0.2.x was the ubuntu-project template. This one has been renamed to ubuntu-application. Your app will be transitioned automatically to this new template thanks to the core supporting upgrade in templates and projects now[1]

Consequently, no more quickly create ubuntu-project fooby, but quickly create ubuntu-application fooby!

GPG key setup

What seemed to have given a lot of trouble to Quickly users in 0.2.x was the gpg key setup. For those who don't know, this key is needed when you upload your package to launchpad. Now, Quickly is more clever about this and doesn't bring random bits to create your email address. This happens in two steps:

  1. collecting all available email addresses that Quickly can find and order them in the best possible order (DEBEMAIL, EMAIL, the AUTHOR file, setup.py your Launchpad emails account…). The thing is that some of those addresses may not be yours if more than one person works on the project, that's where step 2 occurs.
  2. compare with all available local GPG key and those uploaded to launchpad.[2]. This enables us to know who YOU are and what key you should use to sign your package. This part involved patching Launchpad and fun hack evening with jml ;)

Another patch for ssh key has been approved in Launchpad too, bit we will integrate the client side in 0.6. Easy and fun, didn't I say that already?

Choosing and sharing to multiple ppa and bzr branches.

You can now choose to which ppa you want to share/release your code. You can use Use --ppa ppaname or --ppa team/ppaname (shell completion even work with that! I must admit if it's very slow (more than 10s) due to a lot of requests to Launchpad). You can setting that up definitively by quickly configure ppa <ppa_name>.

The same with bzr branch is also possible (quickly configure bzr <bzr_branch>).

Easier licensing

Previously, license command asked you to fill a Copyright file which can contain tweaked copyright and author names. Now, this file has been removed and we keep only one AUTHORS file where you put your name and those participating in the project. You can create your own COPYING file[3] for your own licence, otherwise, it will license with command line supplied license (MIT has been added). At first share/release, the license is now automagic if you didn't licensed previously, and it will take your name/email and license your proect under GPLV3. Each share/release command still update the license to all your files as in 0.2.x.

Again, all your project created with 0.2 will be migrated automatically to this scheme. Don't bother about about licensing if it doesn't interest you. Quickly is doing the right thing (at least, we try) for you.

Automatic about dialog

The about dialog is now fiddled automatically with up-to-date information at each "release" command. It will add your logo, the current version of the program, home page, the copyright, the authors, license… No more need to care about having this updated manually ! (the Credits show the authors, the licence… the licence :))

A Propos de... Quickly 0.4

hum, it seems that Rick is already enjoying using spaces in his project name ;)

New versionning scheme

The ubuntu-application template brings a new version scheme to avoid errors on failed share or release package (the critical section has been narrowed). So, if you release this month (April 2010), your applications would be 10.04. If you release a new version again in the same month, it will be 10.04.1 and so on… When you share, it just takse the last version and adds -publicX like 10.04.1-public1, then 10.04.1-public2 and so on. Of course, it's still possible to provide your own version as a parameter of quickly release or quickly share, but you won't have the full sweet safety field of Quickly for avoiding rejected package :)

Enhanced release command.

Making a release is quite tedious. In addition to push your code in your branch and the package (well, that's the goal of the ubuntu-application template after all), you should also release an upstream tarball, signing it, pushing those, create a milestone, attaching them and also provide a list of what's NEW for the release note. Seems a long task, no? Well, good news is that quickly release does all of this for you! for completing and releasing the changelog as a release note, it takes relevant message from quickly save "your message" or manual bzr commit to create a changelog with all those information. Next step in 0.6 will be to make a Launchpad announce the new release automatically, but this requires again extending the API, so, some Launchpad hacking[4].

You can have a look here for a dummy example (see "Series and milestones").

Adding dependencies

python-distutils-extra rocks at detecting with a lot of magic your python dependencies. Unfortunately, it can't detect the dependencies for non python stuff and manually launched commands. It's now possible to provide a manual list of dependencies for your app. For this, quickly configure dependencies is your new sweet friend.

Silent create/package/share/release commands

All those command now will show some dots about the progress (--verbose for full log), but filter annoying output to only focus on what matters. If some warnings and errors are encounters, it will print them in a summary asking you if you wish to continue

$ quickly release

Récupération de la configuration Launchpad

Connexion à Launchpad réussie

......................

--

Command returned some ERRORS:

--

ERROR: Python module slip_coverconfig not found

--

Command returned some WARNINGS:

--

WARNING: the following files are not recognized by DistUtilsExtra.auto:

bin/slip-coverc

--

Do you want to continue (this is not safe!)? y/n: y

Paquet Ubuntu créé dans le répertoire debian/

......

This is to avoid the whole bunch of information that can lost people in focusing on the important ones.

Apport and Launchpad Integration

Now, all projects will contain an apport hook and a launchpad integration in the menu. Of course, they only appears if you have the current package integrated. So, the project will still work on other distros, just not showing the integration.

Currently this only works for installed package (so, you can't run that for trunk). Existing project are updated as well to get this goodness. Some more work are waiting approval to get it work from trunk too (liblaunchpad waiting merges) Launchpad Integration

New debug command

Just run quickly debug for some sweetness in the debug world with winpdb!

Misc

  • Some commands have been renamed, to avoid cluttering you with multiple commands and being more descriptive:
  • quickly glade is now quickly design
  • quickly lp-project-change is now quickly configure lp-project (configure is used for bzr, dependencies, lp-project, ppa)
  • quickly dialog is now quickly add dialog to enable later boilerplate addition.
  • The tutorial is now in docbook format and ready for translation
  • The boiler plate is now fully i18n compliant

ubuntu-cli template

So, with the importing tempate feature, here is a new template resulting from some requests about building command line only application. Again, there is 0 line of code, just importing commands from ubuntu-application template!

after running quickly create ubuntu-cli "my CLI app", I got a new fresh my-cli-app program showing: quickly run foo

I'm launched and my args are: foo

You also have a full of default binded option like:

$ quickly run help

Usage: my-cli-app options

Options:

--version show program's version number and exit

-h, --help show this help message and exit

-d, --debug Print the maximum debugging info (implies -vv)

-v, --verbose set error_level output to warning, info, and then debug

-f FOO, --foo=FOO foo should be assigned to bar@@

those are good examples to see how to handle debugging level and random command line options (with eventually, parameters, counting occurrences of a parameter, …).

Of course, only a subset of ubuntu-application commands are available in this template (no quickly add dialog, neither quickly design, for instance ;)). Hope that will bring fun for making CLI application too!

ubuntu-pygame template

Who said developers don't have fun? Rick provided a new template for developing games:

ubuntu pygame template

Like ubuntu-cli, ubuntu-pygame shares a large part of ubuntu-application commands and is just a new boilerplate (no command written, again). You should check out the full and complete tutorial available at quickly tutorial

What's next?

Well, that was only a subpart of what was backed out in Quickly 0.4. We have tons of fixes and small enhancements that would have deserve to be put there. This post is already quite long so, I won't continue on. Check out the NEWS file if you want the full story!

Now, let's see what will be in 0.6. We will discuss the new features at next UDS, hope you can join either in person or by IRC. One of the next features will be nautilus integration thanks to the API. Some prototypes are already available as you can see them below. Launching a dedicated gedit session with some plugin enabled is also on track.

Nautilus outside any project nautilus inside an ubuntu-application project

Let's keep it hot and don't hesitate to comment on the new features. Also, what do you think should be added to 0.6 (maybe renamed to Quickly 10.10)?

We have already a good bunch of documentation for Quickly, even if some like my blog posts should be refreshed for 0.4, the wiki page is still a good starting point, and I heard that there will be soon some new videos available…

Hope you will enjoy 0.4 and we always welcome your feedback on #quickly on freenode!

Notes

[1] so, you will understand that once running 0.4, you won't be able to switch back to 0.2.x due to this transition (a lot of things will happen the first time you will either launch a command or use shell completion in your existing project. The good news is that, you don't have even to care about this ;)

[2] it'll create one for you if you don't have any. However, it won't still upload it to Launchpad as it raises some security concerns by the launchpad guys. We will try to tackle those issues at Maverick UDS with them to have clearly nothing to do for 0.6.

[3] no more LICENCE one

[4] should be easier than the gpg/ssh stuff though

vendredi, septembre 25 2009

Build your application quickly with Quickly: Inside Quickly part 9

We are now almost ready to land! Here is the last part of this long suit of blog posts about Quickly.

Packaging your project

It's the last, but not the least issue when you are writing your software: once your application is functional, you surely want to enable other users to install it. Well, you can give it into a tar.gz and run from a trunk, but what about creating a nice package, containing all dependency information for you[1]? Let's see how to achieve this automagically.

Build your project locally

First good idea (even if it's not compulsory) is to try to build it locally. Just issue this command for that:

$ quickly package

It will creates a debian binary package (deb) from your project. The first time, quickly package creates the packaging too. Before running the package command you can edit the Icon and Category entry of your <project_name>*.desktop.in file.

Note that if you didn't run quickly release, quickly share or quickly change-lp-project you may miss the name, email and some other entries in setup.py file. So, you won't have those metada in your package. You can edit them if you don't want to use any of these commands afterwards. Those changes are not mandatory at all for testing purpose.

Quickly package will retrieve all dependencies on your project for you and then build the package locally. You will get a .deb file in the upper folder of your project directory and can install it for testing purpose.

In addition to giving a lot of hints to setup.py, default ubuntu-project enables you to have some automation to specify a data directory that works both from trunk or specified location. If you know a little about python packaging, you can build and install your own local version with python setup.py build -homedir </usr/local/...> (or -rootdir) and this (and any other path) is taken into account at build time.

Debian package description is taken from setup.py where you can change them by editing

description='UI for managing …',
long_description='Here a longer description',

licensing

Stop! Before packaging and making it available to whole world, you really should license your project

Hum, I know what you think "licensing is boring, I never know what I must do and ship in my package" (how many upstreams never shipped the GPL vanilla file in their tarballs). That's an old story with Quickly. Just launch

$ quickly license

to create a GPL-3 project, shipping all desirable headers to all files as well as the right LICENSE and AUTHORS file.

It will warn you that you should modify "# Copyright (C) YYYY <Your Name> <Your E-mail>" in Copyright file if you "$ launch quickly license" the first time before launching "$ quickly share" or "$ quickly release" (in the other case, all files are licensed automatically with GPL-3 and name/email are taken from Launchpad). So, edit it manually in the former case.

But well, you are going to tell me that you don't want to license under GPL-V3? Shell-completion will reveal your all supported licenses by Quickly:

$ quickly license [Tab][Tab]
BSD     GPL-2   GPL-3   LGPL-2  LGPL-3

Quickly always ship the right files and put the header in an according form. Be aware[2] that you can relicensed your project with another license once if you have already licensed it. It will just override your previous license and clean all files accordingly.

If you want to put your own Quickly unsupported License, put your own license text in Copyright file between the tags ### BEGIN AUTOMATIC LICENCE GENERATION and ### END AUTOMATIC LICENCE GENERATION. Then "$ quickly license" does the trick and will add your personal license to every files.

Adding new licenses is really easy, if you think that another license ought to be included in ubuntu-project, do not hesitate to open a bug against Quickly.

So, no more mess when licensing your project. It also updates setup.py and next "$ quickly package" (or "$ quickly release/share) will update the Debian packaging too.

sharing

I guess that your are now ready to enable the world to discover an early beta of your application without publishing this version (or intermediate release) as stable one?

Launchpad ppa are great for that and avoid releasing an official version. It's as easy as:

$ quickly share

It updates your PPA with the the latest saved project changes.

So, before running "$ quickly release", you should: create your account on http://launchpad.net and add a PPA to your launchpad account. Quickly will check that you have an ssh and gpg key. We hope to be able to add advanced support to that in later release.

The first time the command is issued (and that "$ quickly release" was not issued before), it will ask to open a webpage for identifying your Launchpad account so that you can bind Quickly with Launchpad. This is done once by machine (that is to say, all projects on a host share the same launchpad account).

Then name, email and version setup.py will be automatically changed. Version will be <current_release~publicX> where X is incremented at each "$ quickly share" execution before a new release is done.

If "$ Quickly package" was not issued before, it will run it. Same for licensing, updating name, email, license to every part of your project. No more unlicensed file.

Then, it pushes a source package to your ppa. Just wait for Soyuz (in Launchpad) builds your package and you can make your friend discover your project!

releasing

Well well well, when you have tested throughly your package, it's time to release it, isn't?

$ quickly release <release_number> notes about changes

<version> and <description of the release> are optional. Let's see first without them:

$ quickly release

This command first ask for a Launchpad account if you didn't run "$ quickly share" before in any other project. Then, it will propose you to bind your project with an existing Launchpad project, search it with some keywords and then enter the number corresponding to your project. That will be done once per project and finally, if you didn't packaged it previously (neither with quickly package, nor with quickly share), it will do it (same with license issue).

If you didn't put any release version, Quickly will then release it with current number in setup.py (0.1 when you create your project and then, incremented by +0.1 each time the command is issued). If you previously used "$ quickly shared" publicX will be dropped to release <current_release> version (as <current_release>~publicX is less than <current_release> in packaging world).

If you feel the current version is an "0.8" release (without respecting the +0.1 order), your can launch:

$ quickly release 0.8

to enforce this value.

Then, Quickly will save the current state (with the optional notes about changes commit message), add a tag to it and bind your bzr branch with the corresponding project in Launchpad (pull and push). Finally, it will create the source package and upload it to your ppa before bumping the revision (+0.1), ready for next changes.

Of course, some setup.py values are updated too like setting project url, pushing it to debian/control, and so on.

And that's it, you have now a new rocking release, updated with all licensing and packaging issues done for you. Enjoy!

Change Launchpad project

If you want to unbind and bind again your project with another Launchpad one, you can issue this simple command:

$ quickly change-lp-project

It enables you to set or change the Launchpad project binded with the current ubuntu project.

Summary:

Ok, that's it for the tour, I hope you enjoyed it and it gave you some desire to use Quickly for your own project, develop new templates, and give new ideas!

In a nutshell, in two commands:

$ quickly create ubuntu-project myproject
$ quickly release

you can have a release of your project, licensed, packaged, under proper revision control. Easy and quick isn't?

Get Things Done Right and... Quickly!

More info on Quickly:

  • Previous part of the tour:
  1. Part 1: introduction
  2. Part 2: general concepts, core and templates
  3. Part 3: getting help
  4. Part 4: shell-completion
  5. Part 5: miscellaneous core stuff
  6. Part 6: creating templates
  7. Part 7: ubuntu-project template presentation
  8. Part 8: ubuntu-project template code editing

Press review:

Notes

[1] thanks to distutils-extra and amazing pitti's work

[2] that is to say, take care about legal form there

mercredi, septembre 23 2009

Build your application quickly with Quickly: Inside Quickly part 8

You have now your amazing and remarkable new Quickly "ubuntu-project" templated project but don't know how to start hacking on it? Here are some tips for you, just there, keep on!

Modifying your ubuntu-project

edit command

Quickly edit is a convenient command to open all of your python files contained in your project in your default editor, ready for editing. Just run:

$ quickly edit

anywhere in your project tree.

It will most likely open them on gedit, apart in case you put other values in EDITOR or SELECTED_EDITOR environment variables. Consequently, if you previously configured your editor with sensible-editor, this one will be chosen[1].

glade command

This command enables you to open all generated UI files in Glade, so that you can modify your interface. UI files are where your interface is described and Glade is here to give you some handy way of defining it.

$ quickly glade

Note that If you just run Glade from the Applicatons menu it won't work with Quickly. Indeed, what Quickly does is assume that there is one UI file for each Python class for each window type instead of a single big ui file that defines all of the UI for the whole project. This allows each class to derive from window, and most importantly from Dialog. Quickly needs to generate some xml files to tell Glade about these classes and if you just load Glade from the Applications menu, Glade doesn't get to see those UI files and won't load the UI files rather than risk corrupting them.

dialog command

This command helps you to create a new dialog into your project.

$ quickly dialog <dialog_name>

where <dialog_name> is one or more words separated with underscore.

This will create:

  1. A subclass of gtk.Dialog called DialogNameDialog in the module DialogNameDialog.py
  2. A glade file called DialogNameDialog.ui in the ui/ directory
  3. A catalog file called dialog_name_dialog.xml also in the ui/ directory

The default opened file is the main window for your application. You can switch to others under the "Projects" menu.

save command

Ok, you should rather save your project at regular interval, using a revision control system (enabling you to revert back to any point in time, to share with other your code and merge their work into your). Quickly save enabling taking this kind of snapshot of your project:

$ quickly save notes about changes

where "notes about changes" is optional text describing what changes were made since the last save.

It basically commits all changes since the last save to bzr, using a default text if you don't specify one. If you need revert or otherwise use the revision control, use bzr directly.

Note that it does not push changes to any back up location.

Well, that's almost it. You can now really begin to work on your project using all the Quickly goodness. Next subject will be the last one: sharing your finished product and packaging it as easy as pie.

Notes

[1] bryce told me "I was surprised that for once, I had my files opened with emacs" :-)

lundi, septembre 21 2009

Build your application quickly with Quickly: Inside Quickly part 7

We previously saw the general concepts around Quickly and more particular its core.

So, now, it's time to dive into the different commands of the first Quickly template which is ubuntu-project.

What brings me ubuntu-project template?

To make programming easy and fun, we've made some opinionated[1] choices about what tools, apis, etc.. to use.

In a nutshell:

  • Python for the language
  • pygtk for the UI framework
  • Glade for the UI editor
  • Gedit for the code editor (though this is easy for you to change if you choose another one)
  • bzr for version control
  • Launchpad for code hosting
  • desktopcouch for storage/database (!)

ubuntu-project template adds some glue there to all those technologies to lower the barrel and facilitate the learning curve.

create command

The first command you will certainly use is to create an ubuntu-project "templated" project. You can just execute the following line to get a working project directory:

quickly create ubuntu-project Myproject

This causes a bunch of info to be dumped to the command line, but ends with the application being run. What Quickly does is to copy over basically a sample application, and do some text switcheroos to customize the application with the name provided.

Here is the obligatory screenshot of a newly created Quickly application without any change:

Quickly default image

Note that in addition to the main dialog, you get a preferences and also an about dialog.

Under the hood, the command initiate a bzr repository and make a first commit to your project, this will enable you to track your changes and revert them later if needed, sharing the code on Launchpad, and so on... So, here it is, your project uses all previously described technology and is under revision control. You also have a nice .desktop file for showing your application in desktop menus for free. Enjoy! \o/

Then, we considerate that all subsequent commands will be run from a ubuntu-project "templated" project folder.

run command

If you've closed the application and want to run it again, change to your project directory, and use:

$ quickly run

This will run your project as a subprocess.

tutorial command

This command gives you the definitive must-have tutorial to know, indicating you what to do once your project is created, what can be changed, how to build it, etc. It goes also in some desktopcouch-db tweaking.

$ quickly tutorial

It will launch your default web browser and point you to a bunch of documentation to realize a successful ubuntu application.

Note that you can launch this command outside any project[2] too by spawning:

$ quickly tutorial ubuntu-project

or:

$ quickly -t ubuntu-project tutorial

That's enough for today. It was rather short, but you have now plenty of stuff to discover by yourself: you can now create your own project and play with it. We won't cover here what lines to change into the default code of your project or how to add new couchdb storage as all of this is already described in the tutorial. We will rather focus on commands.

Next stop will be on how to edit/change the content of your software, and save your stuff at regular interval.

Notes

[1] *very* opinionated would say Rick Spencer ;)

[2] just a quick reminder for those who didn't follow previous parts ;)

vendredi, septembre 18 2009

Build your application quickly with Quickly: Inside Quickly part 6

This post will make a little pause in Quickly features reviewing to focus on the template creation. Ever wanted to create your own Quickly template, or to modify slightly the existing ubuntu-project template to make different choices? This part is for you!

If you aren't interested, we will begin the ubuntu-project template description next week, see you there!

Quickly Templates

General stuff

Templates can be written in whatever language you want. They are just a set of commands in a directory, containing commands to copy images, documents and interacting with the user.

Adding a command is quite easy: just drop it into the root template directory and make it executable. Quickly will know by this way that the current file is a command that Quickly Core can launch. Consequently, if you need additional internal commands that can be launched only by your own commands, just create a subdirectory in your template and add it there!

Ready to see how to create a template? Remember than template can be created for everything: generating advanced music list, managing LaTeX files, doing anything without any project (just having all commands that can be launched outside project), etc. You can even create a template with commands written in C to help users design a perl application. :)

Template paths

Quickly will retrieve template in multiple paths. To know which template paths are detected, you can use:

$ quickly --version
Quickly 0.2.3
  Python interpreter: /usr/bin/python 2.5.2
  Python standard library: /usr/lib/python2.5

  Quickly used library: /home/didrocks/Projets/quickly/quickly
  Quickly data path: /home/didrocks/Projets/quickly/data
  Quickly detected template directories:
          /home/didrocks/quickly-templates
          /home/didrocks/Projets/quickly/data/templates/

Copyright 2009 Canonical Ltd.
  #Author 2009 Rick Spencer
  #Author 2009 Didier Roche
https://launchpad.net/quickly

quickly comes with ABSOLUTELY NO WARRANTY. quickly is free software, and
you may use, modify and redistribute it under the terms of the GNU
General Public License version 3 or later.

What is interesting for us are the following lines:

  Quickly detected template directories:
          /home/didrocks/quickly-templates
          /usr/share/quickly/templates/

/usr/share/quickly/data/templates/ is what you should see if you installed Quickly with your package management system. That is the default location for templates.

If you built Quickly yourself and add some options like home= or root= (standard distutils options to specify a different home), your will find them in $your_targeted_directory/templates.

The first path (in my home folder), only appears if you have installed at least one template. This is the place for your personal templates that you don't want to share with user, or just for experimentations.

There are additional checks and possibles paths for people using trunk too, but that's not the point. :)

Create a template from scratch

The best way is to declare your template under ~/quickly-templates by creating a directory into it, like "my-awesome-template".

In it, create scripts/executable files and they will became commands. Easy, isn't it? :) The command name is the command script name without the extension (if present): foo.py becomes foo command, bar.sh will be bar, foobar remain foobar command.

Create a template from another template

But if you are found of an existing Quickly template but you disagree on the choice of a particular technology and want to modify it to apply it to your needs, there is an easy way to achieve this.

You don't have to copy yourself the corresponding templates, but instead, run:

$ quickly quickly <origin template> <new template>

So, for instance:

$ quickly quickly ubuntu-project kubuntu-project

It will create (if it doesn't already exist) ~/quickly-templates, the corresponding subdir and makes some additional checks.

The most important thing is that templates aren't binded: you can modify it independently than the one used at creation time. It's an easy and convenient way to start from existing work.

Little brain breaker

How to complicate it a bit? Oh well, if you really understood the previous parts, you can know how to do that differently:

wherever/you/are $ quickly -t ubuntu-project quickly kubuntu-project

or:

quickly/project/dir $ quickly quickly kubuntu-project

to copy the template associated with current project.

Quickly Core does the hard work for you

If you are using python or not to create your template, Quickly Core does already some part of the work for you. This enables you to relax and know that you are always launched in good conditions. Let's see what's automated.

If you didn't understood part 3, I urge you to read it again, you will need it to follow the next 2 sections :-)

Command launch context

By default, all template commands (contrary to builtin ones) can be launched only in a project "templated" with your project. I guess you remember that there is some additional attributes that you can specify to change that behavior.

All the little black magic is in the commandsconfig file that has to be in the root directory of your template (its presence is not compulsory). Here is the example for the ubuntu-project template

# define parameters for commands, putting them in a list seperated
# by ';'
# if nothing specified, default is to launch command inside a project
# only and not be followed by a template
COMMANDS_LAUNCHED_IN_OR_OUTSIDE_PROJECT = tutorial
COMMANDS_LAUNCHED_OUTSIDE_PROJECT_ONLY = create
COMMANDS_FOLLOWED_BY_COMMAND =

As in every configuration files, you can add comments with #, and use ATTRIBUTE = value format. Quickly Core supports as well list in this format : ATTRIBUTE = command1; command2; .... Of course, we are quite tolerant about the format (extra spaces, comments on the lines, etc.)

So, in that example, I can launch "quickly create ubuntu-project ..." outside a Quickly project only. As it's a template command that can be launched outside a project, it's a project followed by template (read chapter 3 again to see what it implies).
All unlisted commands have the defaults: command not followed by a command nor a template and they can be launched inside a project only.

Also, COMMANDS_FOLLOWED_BY_COMMAND is almost self explanatory. Think about the help builtin command presented in part 3. (Not sure if any other command will need it, but well, all the logic is implemented in a generic way, so, let's get it available if some people need it) :)

Then, Quickly Core will do every checks to ensure that the command is in the good context and has the right parameters to be launched (or to propose this template if not specified for this command, etc.).

Shell completion

Basic one

The good news if you followed the previous section is that you have nothing to add. Shell completion automatically understands if the command should be available or not considering the current context (inside a project or not, a template already provided with the --template option on the command line, etc.) and propose you what you can use.

Same for templates proposal if you are executing a command out of a project. It will as well propose another command if you specified the right attribute. Also, if a command name is in more than one template, it will automatically fetch to show you what is available to the user as previously described in part 4.

Add advanced completion

Ok, but I know, you want more than basic completion for your awesome template. For instance, the license command in the ubuntu-project template display available licenses.

Here, the logic is "logically" outside of Quickly Core as it shouldn't integrate template-specific stuff. So, once the basic completion will give no more solution (that is to say, context is ok, templates are specified, commands too if needed...), it will launched the script with shell-completion as the first argument, and then, what has been specified on the command line.

Let's take an example:

$ quickly -t ubuntu-project licence [Tab]

(Note that -t ubuntu-project is not compulsory if you are in a ubuntu-project "templated" project)

It will launch licence.py of ubuntu-project template project with shell-completion "" parameters.

$ quickly foo bar test [Tab]

It will launch foo script with shell-completion bar test ""

$ quickly foo bar tes[Tab]

However, this latter will launch foo script with shell-completion bar tes. (as last parameter isn't empty, you know on which word tab completion is launched). But you still can show all candidates, like "you, should, test, it" and Quickly shell-completion script will fetch with current parameter (to choose here "test", only candidate which matches "tes").

Ok, but how to tell Quickly that "those results are values that can be used in shell-completion"? Easy, just print it! In the previous case, you can just execute in your code: print "you should test it" (or echo, or printf depending on the chosen language...). a blank space is needed but no order is required (it will be reordered automagically with TabTab)

So, keep in mind that we can launch script with shell-completion parameter each time the user spawn shell completion. Conseuqnetly, design your commands accordingly (see later for a tools to help you with that if you are writing your template in python)

Help to figure out help

The help system use a similar feature. You just have to print the help when Quickly Core call your command with help parameter. Again, a convenient function will be described later for Quickly templates in python.

Command line treatment

Quickly Core is stripping all known options and arguments like templates (when following command like in command followed by templates without the -t option or not in a Quickly project) to have always the same state for the command.

With this, you are assured to have your own parameters to treat, not Quickly specific ones and no context to deal with. Focus on template coding, don't deal with this mess, Quickly Core does it for you :)

Special option that we saw in previous chapter is provided on commodities function for python (see below) or in environment variable. For instance, there will be a staging string in QUICKLY environment variable if the user used the --staging option or exported directly the variable. Same system is used for verbose mode. Quick reminder: multiple values are separated by ":".

Launching from root project directory

You can always consider your command is launched from project root directory, even if the user is in a subsubsubdir (or even deeper in the directory tree hierarchy) of the project. Quickly Core in all its cleverness and goodness guide your script to change their current working directory. :)

The only restriction is for commands that can be launched outside a project and that are actually launched in this context (outside of any project). This is a normal behavior, as they are specifically design to be launched outside a project. :)

This is the case, for instance, for the create command in the ubuntu-project template: there is a pre-hook executed (see below) and then, we launch the template in the parent dir of the project directory. Be aware of that. :)

Hook system

Quickly supports some hooks. It enables to have some specific automation (part of code) executed before and/or after an execution of a command. They are Quickly Core builtin. Now, we just have one: pre_create, launched before any create function.

You can note that hooks aren't execute when calling the script for shell-completion and help.

pre_create creates the directory specified in the create command line and handle more complex cases like $ quickly create template folder1/folder2/projectname. Also, pre_create filters acceptable project names and populates .quickly file in the new project directory to put some generic parameters needed for Quickly Core compatibility handling.

So, if your template needs a Quickly project, you really should consider adding a create command which can be launched outside a project only. It will be a bad idea to create a project within an existing project, even if Quickly Core supports it. :)

.quickly?

This file should be located in the root project directory (it's how Quickly Core detects it, to be honest). The basic pre_create hook creates a file like that:

project = foo
template = ubuntu-project
format = 0.2.3

With that, we can store project name (which can differs with the folder case), template names, and Quickly format (corresponding to Quickly version) to handle migration.

You can add your own key/values pairs (again a convenient function is given if you develop your template in python) to help you in your template needs. The file format is the same than for quicklyconfig template file (comments, extra spaces, etc.).

tools to help you (if your template is in python)

Most of them are in quickly/templatetools and quickly/configurationhandler.

access and modify .quickly

configurationhandler is your friend for this one :)

The basic way is to import the module and load the content of the .quickly file:

from quickly import configurationhandler
if not configurationhandler.project_config:
    configurationhandler.loadConfig()

Here, we avoid to reload the configuration. You can do it if there are pending changes you want to forget. Then, you have an associated array called "project_config" and use it to retrieve some values:

print(configurationhandler.project_config['project'])

(if the key doesn't exist, it will return the usual no index found).

You can then add new values that you need in your own template by:

configurationhandler.project_config['foo']=bar

To save it, you can finally call:

configurationhandler.saveConfig()

All modifications will be stored by .quickly file within the current project.

handling easily help and shell-completion

For that, we have a handle_additional_parameters which takes function as optional parameters. Those functions should print help and handle shell_completion method. In the following examples, the functions are names "my_help" and "my_shell_completion", but that doesn't matter.

from quickly import templatetools
def my_help():
    print _("""Usage:
$ quickly change-lp-project

Enable to set or change the launchpad project binded with the current
ubuntu project.
""")
templatetools.handle_additional_parameters(sys.argv, my_help)

As you notice, some parameters are optionals. Here is the example will both functions:

def my_shell_completion():
    if len(sys.argv) == 3:
        print " ".join(get_supported_licenses())
def my_help()
     print("foo")
templatetools.handle_additional_parameters(sys.argv, help=my_help, shell_completion=my_shell_completion)
Get formated Quickly name of a project:

Very easy function to get your project name compatible with Quickly Core (this is the same one which is put in .quickly file)

from quickly import templatetools
print(templatetools.quickly_name(project_name))

An error is issued if the input is not supported currently by Quickly Core.

apply file permission to another file

This has been handy in the license command of ubuntu-project, it can interest others:

from quickly import templatetools
templatetools.apply_file_rights(fcopyright.name, fcopyright_out.name)

It applies to the second file path the permission of the first path file.

Launchpad and bzr

Disclaimer: we put support in Quickly Core itself for Launchpad and bzr, but nothing is loaded until you explicitly need it (and consequently, specify it) in your template. We will be happy to add other support from widely used system for template creator convenience. So, do not hesitate to propose your own binding.

We have some generic tools now for binding to launchpad project and creating/using credential so that template's developers don't become crazy if they want to use Launchpad in their template.

Basically, to setup launchpad credential and bind to a project (or use it afterwards), the code is:

# connect to LP (this create credential if needed, either, retrieve it)
from quickly import launchpadaccess
launchpad = launchpadaccess.initialize_lpi()

Once the user created his credential (or was connected automatically if it's not the first time it's called within Quickly), you have your launchpad python object to perform whatever you wish. It automatically targets staging if it was specified on the command line or by environment variable. It also setup bzr whoami if it was not done before.

All the "first configuration" step is done only once in Quickly: the credential is shared within every templates.

# get the project (choose and bind to one if not already done)
project = launchpadaccess.get_project(launchpad)

With that code, once connected to Launchpad, you will bind your project to a launchpad project. It will ask the user (the first time it's launched within a project) to what existing project he wishes to be bound, make a search with the string provided and propose some candidates to him. When done, you can play with the "project" python object in your template!

Staging stuff is also supported without any extra work. If you really need to know if you are on staging server, you can launch: ///launchpadaccess.lp_server/// (it can be "staging" or "edge"). No need to parse environment variable. :)

verbose mode

It's really easy to figure out if you are in verbose mode or not (specified by the user by environment variable or by using command line option):

from quickly import templatetools
if templatetools.in_verbose_mode():

in_verbose_mode() will be True of False, it's self-explanatory!

Well, Quickly Core is not so tiny as we can infer at first glance and a lot is covered under the hood too. It's not only a dummy command line parser as we are used to present it for simplicity, but you have been able to see that it has some advanced function as well.

Next week, we will see the first created template for Quickly. You already know some part of this one as I took it a lot of times as an example: yes it's the one called ubuntu-project! Back again to the user wave. :)

mercredi, septembre 16 2009

Build your application quickly with Quickly: Inside Quickly part 5

That will be the last part for user on the Quickly Core itself. Before jumping on the ubuntu-project description road, we will see miscellaneous stuff that I couldn't classified later.

Miscellaneous

Well, Quickly options are quite sparse for the moment (as we don't need more as of today), so, here are what can be useful for you:

Help

$ quickly --help

Of course, as the man page, this will give you the most important information you will certainly need :)

Version

$ quickly --version
Quickly 0.2.3
  Python interpreter: /usr/bin/python 2.6.2
  Python standard library: /usr/lib/python2.6
  
  Quickly used library: /usr/lib/python2.6/dist-packages/quickly
  Quickly data path: /usr/share/quickly/data
  Quickly detected template directories:
          /home/didrocks/quickly-templates
          /usr/share/quickly/data/templates/

Copyright 2009 Canonical Ltd.
  #Author 2009 Rick Spencer
  #Author 2009 Didier Roche
https://launchpad.net/quickly

quickly comes with ABSOLUTELY NO WARRANTY. quickly is free software, and
you may use, modify and redistribute it under the terms of the GNU
General Public License version 3 or later.

This one is very important: it gives you some internal and useful informations like Quickly version, python version, what paths for library are used by Quickly, template paths. Well, it's a good idea for every bug report to add those information. We are currently working on an apport hook to integrate it each time Quickly crashes.

Verbose mode

quickly --verbose <command>

This enables Quickly to be more verbose. It's pretty limited at this time, but will be developed later (for instance, we remove current glade warning about unknown icons). Verbose mode switch back default behavior. It will be neat if we will integrate more verbose debugging and verbose informations (planned for 0.4 release).

If you want to use verbose mode for more than one command without specifying each time a --verbose option, you can export QUICKLY variable and set it to verbose like this:

export QUICKLY=verbose

Then, all commands will be executed in verbose mode.

Specific values like staging launchpad server

Using --staging switch enables you to execute all related Launchpad stuff without reaching the real Launchpad server, but staging one instead. This is more focused on testing and is dedicated to specific command that needs Launchpad (share and release command, for instance, in ubuntu-project template). In a similar way, we can add support to other "staging" or equivalent system with that command.

As for verbose, you can export an environment variable to avoid specifying --staging in each command:

export QUICKLY=staging

But I want to use both of them

Don't panic! You can of course, add the two options like in every command line, but you still can export a QUICKLY environment variable. The field separator is ":" (as in PATH), so just add the two strings separated by it, like in:

export QUICKLY=verbose:staging

This will enable us to extend those functionalities in the near future if the Core or some templates needs it. We don't want to add too many clutter in environment variables, that's why we have only choosen QUICKLY environment variable and use IFS to separate values. Of course, that's only if you have a long suit of commands using this option, otherwise, using the corresponding option is a lot easier. All those values can be retrieved by templates: it's easier if you use a python based template, but it's transposed in environment variable whatever what was used (option or environment variable). We will detail that in next chapter.

Ok, that's it for the user side of Quickly Core. But I'm sure you have now an idea of an awesome template and you are eager to create it. You probably miss some information on that. Consequently, in next session, we will see how to create our own template. This will finish the Quickly Core tour itself. :)

lundi, septembre 14 2009

Build your application quickly with Quickly: Inside Quickly part 4

Yeah! It's already the 4th zoom of your Quickly trip and it's about shell completion.

Complete everything quickly

Quickly has an advanced shell completion tool. Currently, it's only binded to bash but plans are up to catch other shells (it's very easy, just call quickly shell-completion $0 from a script and perform little black magic to know the context).

You can reread part 2 if you want to understand every cases described below. Ensure as well you have Quickly 0.2.3.

After installation

Once Quickly is set up, you have to launch a new bash to get the bash completion working. This hasn't some workaround and it's the same with other tool (bzr, quilt...)

Ok, let's try a basic example:

Outside any project

quickly [Tab][Tab]
awesome commands    create      getstarted  help        quickly     tutorial

-> We get there all builtin and template commands which can be launched outside a project.

Here, commands, getstarted, help and quickly are builtin commands. Create and tutorial are ubuntu-project template commands.

Now, let's try a basic builtin command:
$ quickly commands [Tab][Tab]
<file list of my current folder>

Ok, that means that we have no parameter to specify or that the commands command don't support more advanced completion.

Testing a template command which can be launched outside a project:
$ quickly tutorial [Tab][Tab]
footemplate               ubuntu-project

This is because the tutorial command is (in my personal installation) present in two templates, so as this command can be launched outside a template, you need to specify a template.

Then, picking one template:

$ quickly tutorial ubuntu-project [Tab][Tab]
<file list of my current folder>

That means that tutorial command doesn't have advanced shell completion either

Note that you can also do:

$ quickly --template ubuntu-project tutorial [Tab][Tab]
<file list of my current folder>

This time, as you have already defined a template, Quickly Core won't bother you to propose a template after the tutorial command.

Advanced!

You should understand why this doesn't display more commands:

quickly -t ubuntu-project [Tab][Tab]
commands    create      getstarted  help        quickly     tutorial

What's the difference with the first example? There is no awesome command[1]! It only lists builtin and ubuntu-project commands that can be launched outside a project. So, awesome command is certainly from another template than ubuntu-project in this case.

Inside a project

Common case

Let's give it a try:

$ quickly [Tab][Tab]
change-lp-project  getstarted         package            save
commands           glade              quickly            share
dialog             help               release            tutorial
edit               license            run

The list is made from builtin and associated template (here ubuntu-project template) command that can be launched inside the project (for instance, the create command is not listed).

From another template

As for help and launching a command, I can see commands from others templates, being in the same directory, that I can launch:

$ quickly -t footemplate [Tab][Tab]
commandfoo  getstarted  package     run
commands    help        quickly     tutorial

Here, I get builtin and footemplate commands that I can launch inside a project. Easy!

Advanced completion

As previously said, some commands can have advanced completion.

Command defined

They can defined it themselves (apart from the template part and command which is automatically handled by Quickly Core).

For instance, the license command from ubuntu-project defines an advanced (optional) parameters which is the license, Using shell-completion enable to discover every available licenses supported by ubuntu-project template:

Inside a project:

$ quickly license [Tab][Tab]
BSD     GPL-2   GPL-3   LGPL-2  LGPL-3

Command followed by command (headaches inside)

Do you remember part 2? I discussed about attributes on commands and we see before command followed by templates. There are also commands followed by another command. As of today, only the help builtin command has this attribute. But remember: help command is also a command followed by a template. Seems to be an interested case for testing shell completion behavior, isn't?

Outside a project
$ quickly help [Tab][Tab]
commands        help            toto
getstarted      quickly         ubuntu-project

help completion propose you with what you can get some help:

  • directly builtin commands which can be launched outside any project
  • available templates (for later completion)
$ quickly help ubuntu-project [Tab][Tab]
change-lp-project  edit               license            run
commands           getstarted         package            save
create             glade              quickly            share
dialog             help               release            tutorial

Here you get help on all builtins and commands from ubuntu-project template (as see in previous part for the help command)!

For bonus point:

$ quickly -t ubuntu-project help [Tab][Tab]
change-lp-project  edit               license            run
commands           getstarted         package            save
create             glade              quickly            share
dialog             help               release            tutorial

Same thing than previously, but using the -t option.

Inside a project

In this cas, help command completion will behave as expected after reading last chapter:

$ quickly help [Tab][Tab]
change-lp-project  edit               license            run
commands           getstarted         package            save
create             glade              quickly            share
dialog             help               release            tutorial

You have there all builtins and ubuntu-project template commands (given the fact that you are in a ubuntu-project "templated" project).

Bonus, for people who likes to complicate their life:

$ quickly -t footemplate help [Tab][Tab]
awesome     commands    getstarted  package     run
commandfoo  create      help        quickly     tutorial

Here, you are in a ubuntu-project "templated" project and you get help on all builtins commands and those from footemplate.

Miscellaneous

Option completion

Option benefit of course from completion:

$ quickly -[Tab][Tab]
-h          --help      --staging   -t          --template  --verbose   --version
Template completion

In addition to previous case of template completion, the -t/---template command has its own completion!

$ quickly --template [Tab][Tab]
footemplate               ubuntu-project

Good news is all of that is generically implemented in the Quickly Core itself. So, if you plan to create a Quickly template, you can get it also for free if you put right attributes to your personal commands (we will see that in a chapter 6).

Hope you will like this advanced completion setting (it gave me quite some headaches and a lot of trial/refactoring phases before getting it generically working and the code not being too ugly). Remember again that we will see how command can add to this completion their own level, as for help. :)

In next part, we will see miscellaneous things on the Quickly core itself.

Notes

[1] this does not imply that the listed command aren't awesome ;)

vendredi, septembre 11 2009

Build your application quickly with Quickly: Inside Quickly part 3

Here we go for another topic on Quickly tour! This chapter will be really fast to read compared to last one.

Getting some help with Quickly



Quickly has an builtin help command that can help you to retreive help from whenever command.

Inside a project

You can search directly help for builtin command and the ones from the associated template of your project.

template commands

In a ubuntu-project "templated" project, simply do:

$ quickly help release

to get some help from the release command of ubuntu-project template.

builtin command

$ quickly help commands

give some help on the builtin commands command.

commands from another template

As for launching commands, you can get help from other template command by:

$ quickly --template footemplate help awesome

This will print the help associated to the awesome command of the footemplate template. Nice, isn't?

Outside a project

There, you can get help from builtin command and still from template command

builtin command

As previously:

$ quickly help getstarted

template commands

From the last part, you should be able to guess what's the attribute of the help command... You got it! It's a command followed by template (but also, as I said too, a command followed by command, cf previous example)

Taking, again the example of ubuntu-project and getting some help from the release command:

$ quickly help ubuntu-project release

If you followed all the previous concepts successfully, how can I do that differently?

$ quickly -t ubuntu-project help release

got it!

$ quickly help -t ubuntu-project  release

and

$ quickly help release -t ubuntu-project

works as well!

Note that in the last case, you don't have shell-completion for the "release" field (as the template is defined after the help command)

As usual, completion is there to help you in all those cases.

All is done by the core itself, if you develop a template, you will get all those automation from Quickly Core for nothing! Great, isn't?

Next chapter will be on the shell-completion itself! It will help you to understand that the expression "all is guided through bash-completion" is not a wild dream.

NOTES:

  1. no, quickly help help as "googling google" doesn't make the world dying from entropy creation cycle.
  2. yes, quickly quickly exist. What does it do? $ quickly help quickly to know it, of course :)

mercredi, septembre 9 2009

Build your application quickly with Quickly: Inside Quickly part 2

This session is giving some fundamentals on Quickly, let's dive into them!

Two components: core and template

There is mainly two parts in Quickly: Quickly Core is a command line parser and context checker. It has builtin commands and can handle and launch template commands. Quickly templates are group of commands and files that are used on a certain purpose: you can create templates to manage your documents, a LaTeX skeleton, or to easily create projects gathering a certain number of technologies.

Consequently, using templates, you can create a project which will be binded to your templates. Templates can be written in whatever language you wish. That's the reason why we don't use optparse in Quickly Core component.

The application can be extended to run on other systems, and use different tools, etc... There is nothing stopping you from doing that. However, if you stray off the chosen path, some of the commands may no longer work for you.

We would love to see, for instance, a fedora-project template, gnome-project one, plasmoid-project, zeitgeist-plugin... and this tour will give you some trick to help you create one (in part 6).

But again, consider that you can create your template for everything, like managing your documents (without even creating any project). You can give some commands to create a new "company's set of documents" for a secretary ; he/she will complete them and then "quickly share" (for instance) for uploading it in the company's sharing documentation server. Quickly Core is not binding into developing only, power is completely given to template developers.

The ubuntu-project templates

The ubuntu-project template is the first template released today (some more coming for creating gedit plugins and ubuntu-game template).

The ubuntu-project template enables you to easily create a project using a given set of strong opinionated chosen technology ubuntu's people are mostly using:

  • Python for the language
  • pygtk for the UI framework
  • Glade for the UI editor
  • Gedit for the code editor
  • bzr for version control
  • Launchpad for code hosting
  • desktopcouch for storage/database

The idea is to make choices (as Ubuntu make choices in their default applications list) for developers wondering what technology is "good to use for...". Choosing in a technology jungle can sometimes be a mess. Nevertheless, this is just a the skeleton: nothing prevents you for removing the desktopcouch part if you don't want to use it for instance (same for other pieces of technology).

It's also easy to create your own template from ubuntu-project to remove what part you don't want (if you are found of git and don't want to use bzr, for example). More on that in next sections.

Also note, there is no Quickly runtime or base class library. Using the Ubuntu Project won't bring in any dependency on Quickly itself.

Templates, context and command management.

General

So, we have builtin and template command and you can also be inside or outside a project. All that forms a context.

A project created with the create command will be associated with the template used in the create command like in:
$ quickly create ubuntu-project foo[1]
This command can only be launched outside any Quickly project and needs a template to be specified on the command line.

Then, when you are in a project, you can launch $ quickly <command> to launch the <command> from the binded templates or Quickly builtin command. No need to specify a template.

Also, you can launch any command wherever you wish in the project hierarchy (subfolder, subsubfolder...), the command will behave the way it's designed.

Get the list of all available commands.

Nothing more easy, just run wherever you wish:

$ quickly commands
[builtins]      commands
[builtins]      getstarted
[builtins]      help
[builtins]      quickly
[ubuntu-project]        change-lp-project
[ubuntu-project]        create
[ubuntu-project]        dialog
[ubuntu-project]        edit
[ubuntu-project]        glade
[ubuntu-project]        license
[ubuntu-project]        package
[ubuntu-project]        release
[ubuntu-project]        run
[ubuntu-project]        save
[ubuntu-project]        share
[ubuntu-project]        tutorial

builtins are... builtins command and others are templates owning commands. You can even check there that commands is a builtin one.

Choosing the template

You can still launch commands from another template in your current project. Let's say you need the "awesome" command from the bar template to be launched in your current ubuntu-project "templated" project, you still can with $ quickly --template bar awesome[2]

Attributes of commands/Advanced brain breaker :)

WARNING: this part can be seen as quite tricky. It's needed if you really want to understand the template and builtin commands behavior or want to create your own template. If you don't understand/want to read it, don't desesperate and just jump into the "Ok, you killed me, what do I really need to know?" section :-)

Command attributes

As already said, some commands (templates and builtin ones) can either:

  • be launched outside a project only (case of "create" from ubuntu-project template command, for instance)
  • be launched inside a project only (case of "release" from ubuntu-project template command, for instance)
  • be launched outside or inside a project (case of "tutorial" from ubuntu-project template command, "commands" builtin command, for instance)

The check is done during command launch (and shell-completion filtering as well) to ensure user doesn't perform any mistake (as users make some mistakes sometimes, don't they? ;)). For instance, if you try to launch a command which can only be launched inside a project: didrocks@laptop:~/not_a_quickly_project$ quickly --template ubuntu-project release
ERROR: Can't find project in /home/didrocks/not_a_quickly_project.
Ensure you launch this command from a quickly project directory.
Aborting

Template command launched outside a project must be followed by a template if not specified as an option. Of course, this enables Quickly Core to know in which template to find the command. This will give:

$ quickly create ubuntu-project foo
                 ^^^^^^^^^^^^^^ ^^^
                     template  command arg

or:

$ quickly -t ubuntu-project create foo
          ^^^^^^^^^^^^^^^^^        ^^^
          template as an option  command arg

Same for tutorial command, which is an ubuntu-project command:

$ quickly tutorial ubuntu-project
                   ^^^^^^^^^^^^^^
                   template following command

or:

$ quickly -t ubuntu-project tutorial
          ^^^^^^^^^^^^^^^^^
         template as an option

Note: -t templatename can be set wherever on the command line.

As we will see in a later part, shell-completion automatically propose template commands that can be launched outside a project if you are outside a project, or inside if you are ... in a project folder. :)

As builtin commands are generalists, most of them doesn't need any template. But some have the attribute "followed by template" which will need also a template (example: 'help', 'quickly') specified on the command line.

An additional attribute we will se later is "followed by command" (case of the help command). There will be a dedicated part of the help.

Launch a template command outside a project

In case you launch a template command which is part of a template without specifying the template (either with -t option or following the command), you will have a message like that:
$ quickly tutorial
ERROR: tutorial command must be followed by a template and no template was found on the command line.
Candidates template are: footemplate, ubuntu-project
Arborting.

That means that both footemplate and ubuntu-project templates have a tutorial command and Quickly in all its kindness found them to help you. :)

So, then, you can try to launch (if quickly tutorial doesn't take any additional argument, which is the case): $ quickly tutorial footemplate or $ quickly tutorial ubuntu-project.

Ok, you killed me, what do I really need to know?

Phew, this was the harder part of Quickly's concept. Now, the following will seem to be really easy once you get this. In any case, shell-completion will only propose in the current context what you need/can launch (we will discuss that later). So, if you are lost, just let you guided by it, it will propose whenever template/command args you need to specified in the current context. :)

Only knowing what is a template and a project should be sufficient for a daily (and happy? ;)) Quickly user.

Next part will be on getting help on commands.

Notes

[1] foo can be also path/to/foo if path/to exists

[2] -t instead of --template if you are lazy :)

lundi, septembre 7 2009

Build your application quickly with Quickly: Inside Quickly part 1

Here is a suit of little blog posts regarding the Quickly application.

Quickly Logo Even if an awesome presentation by Rick Spencer has been done during last Ubuntu Developers Week, we will get there a little deeper on Quickly's technical side and possibilities. We won't enforce the tutorial side as well as there is already a rocking one in Quickly itself.

First, what is Quickly?

Taken from Launchpad:

Quickly helps you create software programs (and other things) quickly. You can select from a set of application templates and use some simple Quickly commands to create, edit code and GUI, and publish your software for others to use. Quickly's templates are easy to write. So if you are a fan of language foo, you can create a foo-project template. Or if you want to help people making plugins for your killer app, you can make a killer-app-plugin template. You can even create a template for managing corporate documents, creating your awesome LaTeX helpers The sky is the limit!

Given the richness and variety of the Linux platform, programming on Linux should be easy and fun. However, it's not easy and fun because it is too hard to learn. It is too hard to learn because there are too many choices, and too much information to wade through. Quickly strives to make programming easy and fun by bringing opinionated choices about how to write different kinds of programs to developers. Included is a Ubuntu application template for making applications that integrate smoothly into the Ubuntu software infrastructure.

GTD is easier with GTQD (Get Things Quickly Done)!

In a nutshell, creating application should be FUN and EASY.

Obligatory screenshot

Ok, I think you are eager to see a sexy screenshot of Quickly. Impatient? Here it is: Quickly Capture

Oh, didn't I mentioned that Quickly is a command line tool? :) It should be easy to integrate with existing GUIs and it should also be easy to use Quickly to create a Quickly GUI.

Get started

After installing Quickly, you can launch $ quickly getstarted to get some hints on how-to-start.

Useful links

The good new is that Quickly 0.2.2 has landed into karmic. Just give it a try! (aptitude install quickly and relaunch a bash if you want to get all the advanced shell-completion goodness we will explain later).

The Quickly tour is going to take off and hope you will enjoy the flight :)

Next session will be on basic Quickly concepts: Quickly Core and templates.

Topics of this tour:

  1. Part 1: introduction
  2. Part 2: general concepts, core and templates
  3. Part 3: getting help
  4. Part 4: shell-completion
  5. Part 5: miscellaneous core stuff
  6. Part 6: creating templates
  7. Part 7: ubuntu-project template presentation
  8. Part 8: ubuntu-project template code editing
  9. Part 9: package your app and publish it with ubuntu-project template