Integration with external API's

Orçun Avşar

Short description: Melange data needs to be exported to/imported from Google Docs using Google APIs. There are various data types to be exported and imported. Melange represents plural data with lists. These lists are already exportable to CVS and should be exportable to Google SpreadSheets too. Documents and proposals also needs to be exportable to GDocs. All exported data should be imported in a similar way if required. This project aims to integrate Google APIs with Melange via OAuth authentication.

 1) Basics

1.1) Write a small introduction to yourself.

I'm Orcun Avsar, a regular human being and a computer engineering undergraduate student from Canakkale Onsekiz Mart University, Turkey. I like Free Software, GNU/Linux, Python and Web.

blog: http://orcuna.blogspot.com

ohloh: http://www.ohloh.net/accounts/orcuna

jabber: orcuna@jabber.org

1.2) State your preferred email address.

orc.avs@gmail.com

1.3) If you have chosen a nick for IRC, what is it?

orcuna

1.4) Why do you want to participate in Google Summer of Code?

It's fun and great experience for a student. It gives me chance to give something back to open source. These people (mentors) are experienced with what they do. I'm in a belief that i should follow the master to became the master like in Zen philosophy. I'm definitely not a person that wants to learn alone and this is an environmet just what i'm looking for.

1.5) What are you studying, subject, level and school?

Officially Computer Engineering, but it's more like Computer Science as hardware is not intense in the program.  Free software is very popular in my school. 

1.6) What country are you from, at what time are you most likely to be able to join IRC?

Turkey (GMT+2). My sleeping period changes during summer, but i can mostly be available from 9am to 2am (GMT 0) 

1.7) Do you have other commitments for the summer period? Do you plan to take any vacations? If yes, when.

No, but I can take one or two vacations for short periods (between 2-3 days).  I will inform everybody long before any vacation.

2) Experience

2.1) What programs/software have you worked on before?

I love Python. I developed applications with Django and PyQt. I'm experienced with GAE and GAE datastore.

2.2) Have you developed software in a team environment before? (As opposed to hacking on something on your own)

Yes.

2.3) Have you participated to the Google Summer of Code before? As a mentor or a student? In what project? Were you successful? If not, why?

No, i've send a proposal 2 years ago but it wasn't accepted. Last year i gave a break. 

2.4) Are you already involved with any open source development projects? If yes, please describe the project and the scope of your involvement.

I was involved with some open source projects with Pardus (a Turkish Gnu/Linux distro that has been to GSoC two times before). I firstly joined an internship program with Pardus. I contributed to Ozgurluk Icın [0] (means For Freedom) which is Pardus's official community platform. I developed with Django there. 

This year i joined CoMaK project for Pardus (Multiple Desktop Installations) [1] [2]. It's a project that project members are my school mates. It's actually developed in our school. We have our buildfarm, our package depo and not related to Pardus directly. But we use Pardus technologies in base. (ex: pisi, comak, mudur, kaptan)  Goal was to port Pardus to various desktop environments. We've ported to E17, LXDE, FluxBox, Gnome. My mission in team was to port Kaptan to those environments. Kaptan is Pardus's greeting manager that runs on first startup of system and allows users to customize desktop environment. We added a plugin support for Kaptan for other desktops, then implemented all plugins. [3] We also removed KDE dependencies of all Pardus technologies including Kaptan, making them pure-QT. 

See my ohloh profile for my Pardus commits. 

I'm also trying to get familiar with Melange. I prepared a patch for templating documents and using documents for sending student accept/reject emails. I've given a break for focusing on my proposals. I will continue developing it after proposal submit deadline. [4] [5] [6]  I also reported a very small bug. [7]

[0] http://www.ozgurlukicin.com

[1] http://comakp.blogspot.com

[2] http://worldforum.pardus-linux.nl/index.php?topic=3471.0

[3] http://svn.pardus.org.tr/projeler/COMAK/managers/kaptan/

[4] http://groups.google.com/group/melange-soc-dev/browse_thread/thread/28ca839dc1754c34

[5] http://groups.google.com/group/melange-soc-dev/browse_thread/thread/a486bf106c5ee3e6

[6] http://code.google.com/p/soc/issues/detail?id=320&colspec=ID%20Priority%20Status%20Type%20Owner%20Milestone%20Effort%20Skills%20Summary

[7] http://groups.google.com/group/melange-soc-dev/browse_thread/thread/afa45b6b11caabad?pli=1

3) Communication skills

3.1) Though most of our developers are not native English speakers, English is the project's working language. Describe your fluency level in written English.

My written English is good enough for joining a international project and technical communication.

3.2) What spoken languages are you fluent in?

I'm not fleunt in spoken English for a technical speech. I can speak English if opposite side speaks a clear American English or so on.

3.3) Do you give constructive advice?

I try to be a part of solution.

3.4) Do you receive advice well?

I try with my best.

3.5) Are you good at sorting useful criticisms from useless ones?

I hope yes.

3.6) How autonomous are you when developing? Would you rather discuss intensively changes and not start coding until you know what you want to do or would you rather code a proof of concept to "see how it turn out", taking the risk of having it thrown away if it doesn't match what the project want?

It really depends on conditions, but i like "see how it turn out" approach when it's not too risky and rolling back doesn't take too much effort. This evolutional approach gives chance of seeing wrong ways more clear. Beside this "try and see" method, i usually prefer to discuss what to do with a dialectic approach, especcially in a team work.

Google search is usually the basis of my researchs.

4) Project

4.1) Did you select a project from our ideas list? If that is the case, what project did you select? What do you want to especially concentrate on?

Yes, i selected "Integration with external APIs". I want to concantrate on Google APIs and Melange codebase in general. 

4.3) Why did you choose this project?

There are many reasons, first of all i like Google technologies and Google APIs. This is a subject that seems relatively easy but i haven't experienced before. This is going to be educational for me. Second Melange code seems so tidy and beautiful. As far as i see it's little different from convetional approach to Django. It's like a seperate small framework that is mixture of Django and GAE's webapp. I also liked the workings of Melange to make it a generic open source organization environment. I really want to contribute Melange and working with a project like Melange will improve my coding style, coding thinking, communication skills, familarity with web concepts.

I don't want to finish my work and go. Because this project is relatively simple than others i also want to contribute to other jobs like testing, code implemeting, documenting etc. if i finish my project before Summer of Code ends.

4.4) Include an estimated timeline for your work on the project. Don't forget to mention special things like "I booked holidays between A and B" and "I got an exam at ABC and won't be doing much then".

Please notice that this is a estimated timeline and it may not contain the big picture very well as you expected yet. Discussion phases also will redefine this timeline to achieve my goal. 

April 27 - May 13

  • Read Melange source-code
  • Read documentation and wiki pages
  • Read old important discussions, issues
  • Read new tests
  • Get familiar with tools that Melange use (like zc.buildout)
  • Get familiar with Google Data Apis and OAuth
  • Submit small patches to warm up.

May 13 - May 20 

  • Discuss with community. 
  • Share ideas. 
  • Think up structure. 
  • Discuss what other APIs else can be integrated including Google and others and what other authentication methods can be used. 
  • Get ready to start coding
  • Keep on submiting patches.

May 20 - June 5

  • Final exams at university. Must give a break. I can reply e-mails but rarely be on IRC.

June 5 - June 10

  • Start coding early stage of project. Create a look and feel.
  • Implement OpenAuth that just gets a access token at the end when user clicks on link.

June 10 - June 20

  • Integrate related libraries to project in order to access GDoc API
  • Write code to export sample data to Google Spreadsheet when user clicks "Export to GDocs" on lists
  • Write code to export documents to Google Docs.
  • Write code to export proposals to Google Docs.

June 20 - June 25

  • I may take a vacation 

June 25 - Jully 5

  • Arrange code to export all real data successfully to google docs including lists.

Jully 5 - Jully 15

  • Give a break coding to discuss more intense with mentors about current looking of project 
  • Make code design refactorings if needed.

Jully 15 - Midterm evalution

Jully 15 - Jully 20

  • Write unit tests for accomplished features. Make sure tests satisfies each critic phases like "is this document exported with the right content" 

Jully 20 - Jully 30

  • Write code for importing of Melange data from Google Docs. Share as much methods as possible with the export methods. Assamble import and export mechanism together. ex. put these methods in same class with shared attributes.

Jully 30 - August 5

  • Enhance unit tests with importing data .

August 5 - August 10

  • Discuss final look of project with mentors. Perform needed refactorings. Prepare code for final release.

August10 - August 20

  • Documentation

4.5) Include as much technical detail about your implementation as you can

OpenAuth: 

OAuth allows secure way of authentication by sharing tokens not password and username.

When user wants to export anything, Melange will produce a request token for user and redirect him/her to OAuth page with request token. When user signs to OAuth page, callback_url will be runned by OAuth, callback_url provides a oauth token as GET parametir. This oauth token then converted to access token that will be used to make requests. Access token will be store in cookie or session to allow reusability.

Google Api has very convenient tools to make this jobs easier. It can also helps digital signing of requests while hiding details from developers.

 

Google Docs Api:

Each request to Google Docs Api should made with a OAuth access token. Google Docs API's these features can be used with Melange:

to import data : "retrieving all spreadsheet documents", "retrieving all word processor documents"

to export data: "uploading documents", "creating an empty document", "updating content"

I didn't think over a design idea yet but an example export class might look like this very basicly. This is a pseudo prediction:

class DocumentExport:

        def __init__(self, token, document):

               # this initalizes the client 

        def export(self):

               self.save_temp_file( self.document.render() )

               gdoc = self.client.Upload("path/to/temp_file", self.document.tilte, content_type="html")

 

Testing:

Django has good tools for testing like a dummy client that makes fake requests. I will write Unit Tests with Django's TestCase. There are already many tests those will be guideline to write new tests.

 

4.6) What do you expect to gain from this project?

I expect to gain new abilities on web development. I will learn Google APIs and OAuth. Also improve my knowledge on Django, GAE. Working with Melange will provide me a rare chance to work with talented developers. I will be shown correct ways and start thinking like my mentors and become better. I will gain experiences of working together.

4.7) What would make you stay in the Melange community after the conclusion of GSoC?

 Staying in a open-source project as a member is very important for me. An open-source project is a living organism. I want to stay in the community to make Melange better. This GSoC project will be a argument that i can contribute to Melange. So i see this project as a first step to Melange and really excited about becoming a member of community.

5) Practical considerations

5.1) Are you familiar with any of the following tools or languages?

  • Mercurial (used for all commits)

            Yes, i've developed a few applications with bitbucket. Because my bitbucket projects are one man projects, commits are not atomic. But i know the concept of atomic commit, and obeyed this for other open-source projects that i participated.

  • HTML/CSS/Javascript (used in the frontend)

             Yes. I've developed an GAE application that makes heavy use of JavaScript (JQuery) [0]

             [0] https://bitbucket.org/orcunavsar/famer/src/34845662312f/famer2/static/cssjs/

  • Python (language used in the backend)

             Yes, Python is my preffered programming language.

  • AppEngine (platform used for the backend)

             I've developed a few GAE applications before [0] and familiar with differences and advantages of GAE. One application runs with Django on AppEngine.

             [0] https://bitbucket.org/orcunavsar/famer/src/34845662312f/famer2/

  • Django (framework used in the backend)

             Ozgurluk İcin is written with Django and i contributed it. 

5.2) Which tools do you normally use for development? Why do you use them?

Operating System: GNU/Linux (Pardus 2011). Linux is very educational for students and i believe the philosphy of Free Software.

Editor: Vim

Version Control: svn / git / mercurial. Git and Mercurial have advantages over svn, like offline commit and approach to version control. I love mercurial little more just for 'addremove' option and also because it's written in Python of course :)

and other tools / konsole programs that Linux provides. (ex : grep, cat, find, pipelining, diff, more, less ...) 

5.3) What programming languages are you fluent in?

Programming Languages: Python, C, C++, JavaScript

Markup Languages: HTML/XHTML, XML/JSON, CSS, LaTeX, ReStructuredText

5.4) Would you mind talking with your mentor on telephone / internet phone? We would like to have a backup way for communications for the case that somehow emails and IRC do fail. If you are willing to do so, please do list a phone number (including international code) so that we are able to contact you. We will *not* make any use of your number unless some case of "there is no way to contact you" does arise!

Of course,

prefered: (+90) 5058328373

backup: (+90) 5545488118