User:Breton/GSoC2014/Melange

From GNU MediaGoblin Wiki
Jump to navigation Jump to search

This application was submitted to Melange with compliance to GNU template. Pasting it here.

Your name
    Boris Bobrov

Your email address
    breton@cynicmansion.ru

The name of the project
    Mediagoblin: Python 3 port + switch to Alembic

Summary
    Port all of MediaGoblin's code to python 3: https://issues.mediagoblin.org/ticket/813
    Currently MediaGoblin uses sqlalchemy-migrate, but it's fairly outdated and unmaintained.
    Port the migration infrastructure to using Alembic instead. Which is also python3-compatible.

Benefits
    Python 3 is a new modern language that gaines popularity.
    Also sqlalchemy-migrate used there is old and should be changed to a new shiny Alembic

Deliverables
    All code will be python3.3-compatible, it means, that there the whole codebase will work with python 2.6, 2.7, 3.3+, maybe 3.2.
    Minimal requirements' versions will be determined and the code will be ported to use them.
    Alembic will be switched to sqlalchemy-migrate. Alembic is a database-schema migration tool.

Plan
    A rough plan:
        1. do something about Paste. Paste as well as pastescript is python3-incompatible.
            - Drop it!
        2. sort out versions of dependencies. Babel < 1.0 does not support py3. Maybe switch to newer versions of babel? Etc.
        3. adopt tox -- https://bitbucket.org/hpk42/tox, use it for different Python versions and interpreters.
        4. follow suggestion on #813: "Start porting MediaGoblin's code to python 3 generally. Ignore migrations, just support MediaGoblin "starting with the latest database schema", or even easier, set up your database on the python 2 branch before you git checkout the python 3 branch. ;)"
            - There is an option to use "six". I suggest not to use it, for code cleanness. If some compatibility code will be required, it will be shipped in _compat module.
            - http://python3porting.com/noconv.html suggests to convert to python3 and then convert back to python2. I agree with that and will do so.
            - Hold up to ideas listed on http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/, like "Test for 2.x not 3.x".
            - The conversion will look like this: 3.3 -> 2.7 -> 2.6 [-> 3.2] [-> 3.4?].
            - To minimize the number of errors need to be fixed during an iteration, the conversion will be done by a number of fixes. A fix is a line from "2to3 -l". Every "fix" will be tested in order mentioned above, after it gives 0 errors, another one will be applied.
        5. Write migrations
            - Switch to Alembic
            - It still doesn't support hacks around SQLite migrations.
            - But there is a workaround which looks small and which we could use perhaps -- https://github.com/klugjohannes/alembic-sqlite
        6. if time left, backport to 3.2
    A little script involving 2to3 shows that these types of changes are required:
        import, set_literal, input, idioms, print, dict, ws_comma (sorted asc).
    Timeline:
        Bonding period: getting to know architecture better, reading requirements' changelogs, experimenting.
        19 May -- 27 May: drop Paste, drop sqlalchemy-migrate, getting dependencies, fix tests
        28 May -- 1 June: adopting tox, making current tests pass and getting failures on python 3.
        2 June -- 15 June: porting
        15 June -- 27 June (mid-term): if everything is done, porting to python 3.2. Else finishing what remains. Or start switching to Alembic.
        30 June -- 20 Jule: integrating Alembic
        31 Jule -- 11 August: backporting old migrations to Alembic

Communication
    We are going to chat in email, mailing lists and IRC. My nick in IRC is breton, I already hang out in #mediagoblin on freenode.
    I use git, mediagoblin is stored in git, we shall work using it.

Qualification
    Experience:
        3.5 years of Python
        3 years of Django
        3.5 years of C in university
        1.5 years of C++ in university
        4 years of javascript (though I don't write too much in it); with jQuery and pure
        6 years of HTML and CSS
        1.5 year of Scheme and 12 months of Common Lisp
        basic knowledge of system administration (set up nginx, uwsgi etc, familiar with cron, shell scripting)
        a couple of FreeBSD kernel modules
    I use
        Debian as main OS
        git (mercurial where required)
        vim
    I liked the project because it's:
        1. MediaGoblin. I like it's idea and what people do there;
        2. Python;
        3. Python 3. I don't have too much experience in Python 3, and I want to a) learn it better and b) learn how to port to it.
    You can find my github repo here: https://github.com/bretonium/
    I don't know some of the tools used there, such as Paste. I don't think it's a problem, because one of the subtasks is to drop it.