Filipe Saraiva's blog

Tecnologia, sociedade e política.

Archive for the ‘python-backend’ tag

KDE packagers: give some love to Cantor

with 11 comments


I have some posts to write about Cantor but first I would like to request a help to KDE packagers of several Linux distros around the world.

I received some mails from users asking “how can I use python in Cantor?” or “where is python support in Cantor?”. Well, python2-backend is available in Cantor since KDE 4.12 release. If you is using KDE >= 4.12 but you can not to use python in Cantor, maybe the package was not build correctly.

python 2 development library (commonly packed as python-devel in some Linux distros) is required to build python2-backend. python 2 is required to use Cantor with python 2.

Then if you are a Cantor user and can not to use Cantor with python, please write a bug report in the bug management system of your distro. You can to put a link in the bug report to this post too.

Anyway, if your distro bring or not bring python2-backend, write a comment below and I will make a table with this information.

[UPDATE May 13, 2014] – In FISL I and Paulo Andrade, a Mandriva/Conectiva employer, noticed that Cantor is missing the Python backend in Fedora. Paulo wrote a bug report and the packager fix it. Maybe in one week the Cantor with the fix will be available in Fedora repositories. Thanks Paulo!

Written by Filipe Saraiva

May 13th, 2014 at 12:47 am

See you at FISL 15!

without comments


Soon I am going to one of the biggest events in the world about free software, the International Free Software Forum (FISL)!

As usual this year will be very present in KDE activities – especially the lecture by Kévin Ottens on KDE Frameworks 5, and the KDE community meeting. It will be easy to find me on the KDE booth in the user group area too.

I intent to attend other lectures, for example the metamodeling using Qt with Sandro, the 30-year history of GNU with Aracele, devices for neuroscience studies with Cabelo, and some more - I’m still far from decided “my” FISL schedule.

May 9, 16:00h, I will present a paper on Free Software Workshop about the development of Python backend for Cantor.

The complete schedule of FISL activities has more than 300 lectures, workshops, short courses, and more!

See you there!

Nos vemos no FISL 15!

without comments


E logo mais tomo o rumo para um dos maiores eventos de software livre do mundo, o Fórum Internacional de Software Livre!

Como de costume esse ano estarei bastante presente nas atividades do KDE – destaque para a palestra do engenheiro de software Kévin Ottens sobre KDE Frameworks 5, e o encontro comunitário do KDE. Vai ser fácil me encontrar no stand que montaremos na área reservada para os grupos de usuários.

Outras palestras que pretendo assistir estão a metamodelagem em Qt com o Sandro, os 30 anos de história do GNU com a Aracele, os dispositivos para estudos de neurociência com o Cabelo, e mais alguns – ainda estou longe de decidir a “minha” programação do FISL.

E dia 9 às 16:00h apresentarei um artigo no Workshop de Software Livre sobre o desenvolvimento do backend para Python no Cantor.

A grade completa de atividades do FISL conta com mais de 300 palestras, oficinas, minicursos, e muito mais!

Nos vemos lá!

Novidades no Editor de Scripts do Cantor

without comments

Um post rápido sobre o Cantor antes da última metade das festas de Carnaval.

KDE 4.13 está com as funcionalidades congeladas agora, e tive tempo de desenvolver algumas melhorias para o editor de scripts do Cantor, que estará disponível no próximo lançamento estável do KDE por volta de 16 de abril.

Agora, os backends para Python 2 e Scilab tem suporte ao editor de scripts! Veja algumas imagens:

python_script_editorEditor de scripts do Cantor para Python 2

scilab_script_editor Editor de scripts do Cantor para Scilab

Você pode acessar o editor de scripts via barra de menu Exibir -> Mostrar Editor de Script. O editor é baseado em kate-part, então ele disponibiliza destaque de sintaxe, numeração de linhas, mini-mapa do texto, e todas as outras coisas legais disponíveis no Kate. Você também tem um botão Executar Script que, após pressionado, carrega o script na área de trabalho do Cantor, como pode ser visto nos exemplos.

Há outras novidades também para os demais backends do Cantor. O Editor de Scrips agora carrega o destaque de sintaxe padrão para cada backend – nas versões anteriores, isso não acontecia. E também, se você pressionar o botão Novo, o novo editor já terá o destaque de sintaxe padrão funcionando também.

Estas são as novidades do meu trabalho no Cantor para o KDE 4.13. Eu pretendo melhorar o backend para Python 2 e o editor de scripts em lançamentos futuros.

Mas agora é hora de aproveitar o restinho do carnaval nas festas de rua do Brasil. Feliz Carnaval! ;)

Cantor’s script editor news

with 4 comments

A small blogpost about Cantor before Brazilian Carnival parties.

KDE 4.13 is feature freeze now and I developed some improvements in Cantor’s script editor. It will be available in next KDE stable release around April 16.

Now Python 2 and Scilab backends have support to script editor! See some pictures:

python_script_editorCantor Script Editor for Python

scilab_script_editor Cantor Script Editor for Scilab

You can access script editor in menu bar View -> Show Script Editor. The script editor is based in kate-part, so you have syntax highlighting, line numbering, mini-map, and all cool stuffs from Kate. You have a Run Script button too, so you can just push this button and the script will be load in Cantor worksheet, as you can see in examples.

There is news for others Cantor backends too. Now script editor load default syntax highlighting for each backend – in old versions it did not happen. And, if you push New button, the new script editor will have the default syntax highlighting working too.

It is the news about my work in Cantor for KDE 4.13. I intent improve Python 2 backend and script editor for future releases.

But now it is time to go to Brazilian street parties! Happy Carnival! ;)

Cantor: Python 2 backend feature tour

with 15 comments


python2_selectCantor backend selection screen

In 2013 I developed a Python 2 backend for Cantor, a project funded in part by Google Summer of Code. Now this backend is available in Cantor released in KDE 4.12.

Cantor is a mathematical/scientific programming software, a frontend providing IDE features (syntax highlighting, tab-complete, variables management, and more) and a advanced terminal. Cantor support a lot of mathematical engines like Octave, Sage, Maxima, Kalgebra, Qualculate, R, Scilab (developed by me too), and now, Python 2. You can see Cantor as a Matlab-like software, but it uses other mathematical environment/software as programming language.

This post I will do a “feature tour” in Python 2 backend to show Cantor software for scientific python developers community.

Initial Screen – Syntax Highlighting and Tab Complete

python2_initialscreenCantor initial screen

After select the Python 2 backend, Cantor will show the initial screen. This window have a big widget for the Python 2 terminal, and two side panels – one to show the Python 2 help and the other to variables management.

Let’s see some commands inputs in the terminal:

python2_syntaxSyntax highlithing

Cantor is highlighting the Python 2 syntax and, in side panel, you can see the variables created.

Now, let’s create new variables with similar names to test the tab complete. See the picture below:

python2_completeTab complete for variables

After create variables variable_x, variable_y e variable_var, we can write in terminal var and type tab key twice – Cantor will show the variables and functions with the same piece of word. Tab complete is available for module functions too.

python2_complete2Tab complete for module functions

Cantor show error messages in terminal too. Next figure show a import error:

python2_errorError message

You can save the terminal state or just the input commands and their outputs in a file. Cantor allows upload/download a terminal example for a remote server. You can explore this features in “File” menu.

Help Panel

Cantor shows Python help from help command in a side panel. The picture below shows the help for complex class:

python2_helpHelp panel

Cantor uses Qt/KDE technologies, so you can change the window format moving the side panels. Next picture show the window with the variables management in the left side and the help panel in the right side.

python2_help_completePanels in different sides

Variables Management

python2_variables Variables management panel

Variables management panel shows the variables created in Cantor session, showing their labels and values. The panel have some additional functions too, in buttons bottom the widget. These functions are, from left to right, Add variableLoad variables, Save variables, and Clear all variables.

Add variable just open a pop-up window to input a label and a value to a variable.

Load variables and Save variables uses shelve module to data persistence. When the buttons are clicked, Cantor loads scripts to, in first case, read and load variables to the session, and, in second case, save the python dictionary in a file. The figures below show this operations:

python2_save_variablesSaving variables

python2_load_variablesLoading variables

The function Clear all variables delete each variable from Python dictionary. The code is below:


python_command_to_plotCode for graphic creation using matplotlib

python_plot_resultGraphic loaded in Cantor

The figures below show the graphic loaded in Cantor worksheet. When a session is exported, the graphic will be exported too. This feature can be configured to create the graphics in a new window – this is the default option.

Conclusion and Future

This is the first stable version of Python 2 support in Cantor. It is working good, but you can see the bug presence in some parts of software.

I would like to see some feedbacks from mathematical/scientific programming python community. I am not a “pythonist”, so the python community can find bugs and strange behaviours in the software better than me. I would like to see some feature suggestions too.

For the next version, Python 2 backend will have support to script editor – unfortunately, I can not develop it for this release.

If you are interested in the backend development, my blog have a set of posts (in Portuguese and English) about it. You can download the source code in Cantor repository – the license is GPLv2. And you can submit a bug report in KDE bugzilla.

And you can contact me in comments area below or in my mail address filipe at

Written by Filipe Saraiva

January 16th, 2014 at 10:42 am

Hello Planet Python

without comments

Hello Python community,

My name is Filipe Saraiva, I am not a python developer (I am a novice in python), but I am a C++ and KDE developer.

I developed a backend for Python 2 in Cantor, the KDE mathematical software. This backend was released in KDE 4.12 and now is available for all.

I would like to see some feedbacks from scientific python community about improves in this backend. I intent to develop a Python 3 and a iPython backend too in the future.

I will write a “tour post” about the Python 2 backend features soon, but you can see posts about the backend development in the tag python-backend (posts in English and Brazilian Portuguese).

Written by Filipe Saraiva

December 28th, 2013 at 5:25 pm