Filipe Saraiva's blog

Tecnologia, sociedade e política.

Archive for the ‘planetkde-english’ tag

Cantor – dynamic keywords in python backend

with 9 comments

In previous post, I mentioned about dynamic keywords in python backend. The idea is, after import a python module in Cantor workspace, functions, keywords, variables, and more from this module are load by Cantor and available to syntax highlighting and tab complete.

This feature is implemented for now. You can test it compiling Cantor from python-backend branch.

But, let me show more information about this feature.

There are several ways to import a python module in python console. You have “import modulename”, “import modulename as modulevariable”, “from modulename import *”, “from modulename import function_1, function_2, …”, and more. Each import way causes different consequences to user experience.

The four import ways mentioned in previous paragraph are supported by python backend. I will show these different import ways and how python backend behave for each one.

import modulename

The more basic import way. After this command, a variable named “modulename” is defined and the functions and more keywords of this module are available to access using “modulename.keyword”.

python_import_modulenameTab Complete


Syntax Highlighting

import modulename as modulevariable

This way the user define a name “modulevariable” to reference “modulename”, and “modulename” is not defined. So, you can access the functions and more from “modulename” using “modulevariable.keyword”.


Tab Complete


Syntax Highlighting

from modulename import *

This way the user import all functions and keywords from “modulename” but anything variable is defined to access “modulename”. The functions of the module are accessed directly.


Tab Complete


Syntax Highlighting

from modulename import function_1, function_2, …

The user import only specific functions from a “modulename”, no all functions.


Tab Complete


Syntax Highlighting

Cantor plugin

I developed a Cantor plugin to import modules. This plugin open a dialog to user enter a modulename and, after press Ok, Cantor run “import modulename” and keywords are available. The diaglog is accessible by “Packaging” menu, in toolbar.


Cantor Plugin

Handling Errors

The backend can identify several errors during import.


Handling Errors


Well, the feature is working and it is mature for use, however it don’t support all import ways in python. But, I think these five ways cover the most commons import ways used by most python scientific users.

The important thing is, this feature enable python backend to support the several python modules, and no only scipy, numpy, and matplotlib, as I proposed in begin of this project.

Let me know how you import a module in python. I will develop support to more import ways in future versions of the backend.

For now, wait for more news of this project soon!

Python backend for Cantor – Syntax Highlighting, Tab Complete, and Interactive Mode

with 11 comments

My GSoC’2013 project for development a python backend for Cantor reach some objectives in before weeks.

Firstly I developed preliminary versions of syntax highlighting and tab complete features. This version use XML file processing to provide a basic set of keywords and built-in functions to these features. To activate tab complete, press Tab button after some letter.  You can see some screenshots of these features below (click mouse right-button and enlarge it):


A simple syntax highlighting


More syntax highlighting and tab complete

Next, the preliminary version  of the backend developed during LaKademy was build to support python script mode. But it would be more interesting to support python interactive mode in Cantor console. So, to do it, I implemented preprocessing in python command before send it to python interpreter, adding some commands to simulate python interactive mode.

This solution use PyRun_SimpleString from python/C API to process python commands in python script mode. There is other functions from python/C API to process python commands in interactive mode, for example, PyRun_InteractiveOne, but this function requires the python commands in a file to process and the output of commands is a bit of hard to get. So, for now, PyRun_SimpleString + preprocessing commands is working very well.

You can see in screenshots below and above that variable values and operation values are show in Cantor console without use of print command. It is a one of characteristic of python interactive mode:

python_backend_aninhado1More examples of syntax highlighting and python interactive mode


More examples of syntax highlighting and python interactive mode

Now I am developing a feature to list all functions and keywords from a specific python module imported during the program execution. I am using dir command to do it. This feature will provide these keywords to use in syntax highlighting and tab complete in a dynamic way. Then, python backend will support any python module, and not scipy, numpy, and matplotlib only.

Python backend is available in python-backend branch in Cantor repository. You can test it, but remember this code is not stable and finalized for now.

Google Summer of Code 2013: Cantor + Python

with 3 comments

This year I have a project accepted to Google Summer of Code. This is my second time in the program and I am very happy and grateful for it

This year I come back to Cantor, the KDE mathematical environment for several mathematical softwares like Maxima, Sage, Scilab, etc. In 2011 I developed the Scilab backend during Google Summer of Code. My mentor was Sylvestre Ledru, from Scilab team.

This time my project is conclude the scientific python backend for Cantor. I began the development of this piece of software during LaKademy. The communication between Cantor and python is working properly. The software miss some features of IDE, like tab-complete and syntax highlight. I intent provide support to scipy, numpy and matplotlib too. Alexander Rieder, from KDE, is my supervisor.

There are some ideas about how to implement tab-complete and syntax highlight. It is possible using XML files (like I implemented in Scilab backend) or use the Kdevelop technology. I am researching which I will use.

More updates will come soon! Follow the tag gsoc2013-python-backend this blog!

I am a Mage!

with 7 comments

This is just a manner of speaking. = D

May 27, 2013. I officially became a packer on Mageia, Mandriva-based Linux distro. The date marks the creation of an account with access permission to repository and build system for me.

I started contributing to Mageia since the early days of the project, translating the manifesto to Portuguese. Since then I helped on forums, IRC, mailing lists, got mirrors with high performance in Brazil, and did more work in promotion. However, I wanted to provide software for Mageia, because this is a job who not everyone can contribute.

To become a packers I had to participate in a mentoring program where I was guided by my Portuguese friend José Jorge or zezinho. I learned a lot about the art of creating RPM packages. Thanks zezinho!

I’m packing SWI-Prolog and abnTeX2. I intend to maintain some scientific-related software and KDE stuff like themes and plasma applets.

Well, this is my way to contribute to free software. Thank you, community!

Written by Filipe Saraiva

June 2nd, 2013 at 5:56 pm

Mageia 3 is out!

without comments

In the night of May 18, mages, sorcerers, witches, and fairies took from the cauldron the new stable release of Mageia, now in your third version.

Mageia is a community Linux distribution based on Mandriva. This version have several softwares in their recent versions: KDE 4.10.2, GNOME 3.6, XFCE 4.10, Linux 3.8, systemd 195, rpm 4.11, LibreOffice 4.0.3, and more.

This release is dedicated to Eugeni Dodonov, former employer in Mandiva and a great free software developer. In your last work, Dodonov was in Intel developing a better integration between Intel graphics cards and Linux kernel. Dodonov died very young. He was cycling when was hit by a car. This accident happened in Sao Carlo city, Brazil, in 2012.

This release is special for me because the packages that I am the maintainer are available for Mageia users now. I am packing SWI-Prolog and abnTeX2. I intend make packages for scientific softwares and KDE stuff like themes and plasma applets. And, maybe, make a package to Cave Story because it is a beautiful game and everyone must play it! =)

Release notes, download link, tutorials to update from Mageia 2, and more news  are here.

Written by Filipe Saraiva

May 20th, 2013 at 9:44 pm

Downloading SRPM build requires using urpmi

without comments

Several Linux distributions have specific commands to download build requires of a package. For example, Debian and its derivatives have apt-get build-dep; in OpenSUSE is zypper si -d; Fedora have yum-builddep; etc.

There is in Mandriva and derivatives distros using  urpmi a command to do this too!  But it is mandatory to link the package SRPM source.

The command is:

urpmi –buildrequires <package.src.rpm>

Remember, there are two hyphens in buildrequires option. You must to substitute <package.src.rpm> for the src.rpm package address. For example, to download Choqok build requires you uses::

urpmi –buildrequires

To find the SRPM package you must visit a repository of your distro and copy the complete package name. For example, there is a Tier 1 repository to Mageia in C3SL, the link is

Written by Filipe Saraiva

May 5th, 2013 at 3:48 pm

KDE 4.10 Release Party – São Carlos, Brazil

with one comment

Yes, São Carlos will have a KDE 4.10 release party!

 The party will take place on February 20 at 19:30 in GIG pub.

Let’s talk about KDE in terms of technology and community, free software in world, free software community in São Carlos, and, of course, let’s drink some beers too! =)

More information about release party here.

Read more about KDE 4.10 news in release notes.

Written by Filipe Saraiva

February 20th, 2013 at 4:38 pm